You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 17:36:07 +00:00
Add WINDOW_FLAG_MOUSE_PASSTHROUGH flag and enabled it for tooltips. Expose window_set_mouse_passthrough to Window.
This commit is contained in:
@@ -735,6 +735,9 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
|
||||
if (p_flags & WINDOW_FLAG_NO_FOCUS_BIT) {
|
||||
wd.no_focus = true;
|
||||
}
|
||||
if (p_flags & WINDOW_FLAG_MOUSE_PASSTHROUGH_BIT) {
|
||||
wd.mpass = true;
|
||||
}
|
||||
if (p_flags & WINDOW_FLAG_POPUP_BIT) {
|
||||
wd.is_popup = true;
|
||||
}
|
||||
@@ -918,7 +921,7 @@ void DisplayServerWindows::window_set_mouse_passthrough(const Vector<Vector2> &p
|
||||
void DisplayServerWindows::_update_window_mouse_passthrough(WindowID p_window) {
|
||||
ERR_FAIL_COND(!windows.has(p_window));
|
||||
|
||||
if (windows[p_window].mpath.size() == 0) {
|
||||
if (windows[p_window].mpass || windows[p_window].mpath.size() == 0) {
|
||||
SetWindowRgn(windows[p_window].hWnd, nullptr, TRUE);
|
||||
} else {
|
||||
POINT *points = (POINT *)memalloc(sizeof(POINT) * windows[p_window].mpath.size());
|
||||
@@ -1499,6 +1502,10 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W
|
||||
wd.no_focus = p_enabled;
|
||||
_update_window_style(p_window);
|
||||
} break;
|
||||
case WINDOW_FLAG_MOUSE_PASSTHROUGH: {
|
||||
wd.mpass = p_enabled;
|
||||
_update_window_mouse_passthrough(p_window);
|
||||
} break;
|
||||
case WINDOW_FLAG_POPUP: {
|
||||
ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup.");
|
||||
ERR_FAIL_COND_MSG(IsWindowVisible(wd.hWnd) && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened.");
|
||||
@@ -1530,6 +1537,9 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window
|
||||
case WINDOW_FLAG_NO_FOCUS: {
|
||||
return wd.no_focus;
|
||||
} break;
|
||||
case WINDOW_FLAG_MOUSE_PASSTHROUGH: {
|
||||
return wd.mpass;
|
||||
} break;
|
||||
case WINDOW_FLAG_POPUP: {
|
||||
return wd.is_popup;
|
||||
} break;
|
||||
@@ -2464,6 +2474,11 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||
|
||||
// Process window messages.
|
||||
switch (uMsg) {
|
||||
case WM_NCHITTEST: {
|
||||
if (windows[window_id].mpass) {
|
||||
return HTTRANSPARENT;
|
||||
}
|
||||
} break;
|
||||
case WM_MOUSEACTIVATE: {
|
||||
if (windows[window_id].no_focus) {
|
||||
return MA_NOACTIVATEANDEAT; // Do not activate, and discard mouse messages.
|
||||
|
||||
Reference in New Issue
Block a user