Fix close dropdown popups correctly on focus loss (X11)#118075
Fix close dropdown popups correctly on focus loss (X11)#118075MWRAlves wants to merge 1 commit intogodotengine:masterfrom
Conversation
On X11, dropdown menus and similar no-focus popups could remain open after switching to another window or workspace. This happened because some popup windows could stay internally marked as focused even after the application had actually lost focus. Use the X11 input focus state to detect real application focus loss, and when that happens, clear stale focused state from popup windows marked as both popup and no-focus.
|
Thanks! Can you give concrete steps to reproduce the bug (without your PR), as well as which windowing manager you're testing with? In the past, we've issues with window focus, where a change to fix one WM broke another WM, and so we'll need to test this across several WM's to ensure there are no regressions |
|
The bug was tested on Ubuntu 24.04, GNOME Shell (Mutter), Wayland session. I tested the bug in two ways: using a regular menu in the editor and right-clicking on a node. On an unpatched build, I can reproduce the bug with these steps, for each method: For the editor menu case:
For the right-click case:
I can also include a video of the bug if that would help. I'm eager to solve this as well as possible. |
Fixes #104267
Fixes an X11 issue where dropdown menus and similar popups could remain open after switching to another window or workspace.
On X11, some no_focus popup windows could remain internally marked as focused even after the application had actually lost focus. This stale focus state prevented the normal application focus loss path from fully updating popup state, which could leave dropdowns visible after Alt-Tab or workspace switching.
This change keeps the fix X11-specific, the only place I verified the bug occurred in my system as opposed to Wayland, by:
using _window_focus_check() to determine whether the application still has focus
clearing stale focused state for is_popup && no_focus windows only when the application has actually lost focus
Manual Testing:
(On X11 display server)
Open an editor dropdown menu, Alt-Tab away: popup no longer persists
Open an editor dropdown menu, switch workspace: popup no longer persists
Verify normal popup dismissal still works inside the editor