Skip to content

Commit

Permalink
Stop color picker tooltip from stealing input events
Browse files Browse the repository at this point in the history
Input events go to the tooltip because it's added to `popup_list` in
DisplayServer `popup_open`. I think there's no harm in tooltips being omitted
from the list, so this commit blocks non-popup windows from being added if they
have `FLAG_NO_FOCUS` and `FLAG_MOUSE_PASSTHROUGH`.

I'm not happy with this way of detecting tooltips. It'll also catch other
windows where this behavior may or may not be wanted.

I thought about adding `FLAG_TOOLTIP`, but went with the smaller change for
now.

Fixes godotengine#79500.
  • Loading branch information
anniryynanen authored and sorascode committed Jul 22, 2024
1 parent 6cbf18b commit f8e98d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion platform/linuxbsd/x11/display_server_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4184,8 +4184,11 @@ void DisplayServerX11::popup_open(WindowID p_window) {
}
}

// Detect tooltips and other similar popups that shouldn't block input to their parent.
bool ignores_input = window_get_flag(WINDOW_FLAG_NO_FOCUS, p_window) && window_get_flag(WINDOW_FLAG_MOUSE_PASSTHROUGH, p_window);

WindowData &wd = windows[p_window];
if (wd.is_popup || has_popup_ancestor) {
if (wd.is_popup || (has_popup_ancestor && !ignores_input)) {
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
List<WindowID>::Element *E = popup_list.back();
Expand Down
5 changes: 4 additions & 1 deletion platform/macos/display_server_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3366,8 +3366,11 @@
}
}

// Detect tooltips and other similar popups that shouldn't block input to their parent.
bool ignores_input = window_get_flag(WINDOW_FLAG_NO_FOCUS, p_window) && window_get_flag(WINDOW_FLAG_MOUSE_PASSTHROUGH, p_window);

WindowData &wd = windows[p_window];
if (wd.is_popup || has_popup_ancestor) {
if (wd.is_popup || (has_popup_ancestor && !ignores_input)) {
bool was_empty = popup_list.is_empty();
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
Expand Down
5 changes: 4 additions & 1 deletion platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3575,8 +3575,11 @@ void DisplayServerWindows::popup_open(WindowID p_window) {
}
}

// Detect tooltips and other similar popups that shouldn't block input to their parent.
bool ignores_input = window_get_flag(WINDOW_FLAG_NO_FOCUS, p_window) && window_get_flag(WINDOW_FLAG_MOUSE_PASSTHROUGH, p_window);

WindowData &wd = windows[p_window];
if (wd.is_popup || has_popup_ancestor) {
if (wd.is_popup || (has_popup_ancestor && !ignores_input)) {
// Find current popup parent, or root popup if new window is not transient.
List<WindowID>::Element *C = nullptr;
List<WindowID>::Element *E = popup_list.back();
Expand Down

0 comments on commit f8e98d5

Please sign in to comment.