Stop color picker tooltip from stealing input events

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 #79500.
This commit is contained in:
Anni Ryynänen 2024-06-06 20:00:05 +03:00
parent e96ad5af98
commit ae1e2182ec
No known key found for this signature in database
GPG Key ID: 0C29030C4FA87DDC
3 changed files with 12 additions and 3 deletions

View File

@ -4190,8 +4190,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();

View File

@ -3430,8 +3430,11 @@ void DisplayServerMacOS::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)) {
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;

View File

@ -3574,8 +3574,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();