Bug 497075 - Gtk4 popover prevents focusing kicker
Summary: Gtk4 popover prevents focusing kicker
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.2.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-05 11:20 UTC by postix
Modified: 2025-07-09 20:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2024-12-05 11:20:29 UTC
STEPS TO REPRODUCE
1.  Open gtk4-demo
2.  Click on the hamburger button to open a popover
3. Hit Meta to open kicker
4. Type something

OBSERVED RESULT
The input field of Kicker is not focused. On typing Kicker closes.

EXPECTED RESULT
Gtk4 popovers are treated like context menus and close on hitting Meta to open kicker.


SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.8-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Gtk: 4.16.4
Comment 1 David Edmundson 2024-12-09 16:59:09 UTC
It seems we don't dismiss the popup on Qt either, we just send a keyboard_leave which it handles differently.
Comment 2 postix 2024-12-15 21:51:08 UTC
I've noticed that the Gtk4 popover also stays above kicker: 

1) Create a panel on the top or left edge
2) Make kicker wide enough so that it covers the gtk4-demo app
3) Open the popover in the gtk4-demo
4) Hit Meta to open kicker
Comment 3 Bug Janitor Service 2025-01-03 13:43:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6963
Comment 4 postix 2025-06-09 11:29:23 UTC
For reproducing, instead of opening kicker, you can also use Alt+Tab.

I've found another case, where the gtk4 popover doesn't close even on clicking somewhere after tabbing to another window. Would you like to have a reproducer for this as well or do you think this case is also covered already?
Comment 5 David Edmundson 2025-07-09 09:58:55 UTC
Git commit 43f7621eb1ef22704c4c12c21c29945bffa37e47 by David Edmundson.
Committed on 09/07/2025 at 09:17.
Pushed by davidedmundson into branch 'master'.

wayland: close popups upon window activation

Popups should grab all input on Wayland, however there are numerous
(deliberate) ways to get outside the grab, such as a shortcut that opens
a new window or pressing alt-tab.

If a popup is active when the focus changes we are left in a state where
the new window visibly has focus and appears on top of the popup's main
window, but the popup is still visible with an input grab. This is a
broken state.

This patch cancels popups if the focus window changes for whatever
reason.

Cancelling a popup also destroys the window server side rather than
waiting for the client to handle the popupDone so there is no racey
aspect for the next input.

M  +45   -0    autotests/integration/xdgshellwindow_test.cpp
M  +7    -0    src/popup_input_filter.cpp
M  +1    -1    src/popup_input_filter.h

https://invent.kde.org/plasma/kwin/-/commit/43f7621eb1ef22704c4c12c21c29945bffa37e47
Comment 6 Vlad Zahorodnii 2025-07-09 13:42:16 UTC
Git commit 51c0880f47ecd2e29ceb61e9dd9b30a535d18ff8 by Vlad Zahorodnii.
Committed on 09/07/2025 at 13:28.
Pushed by vladz into branch 'Plasma/6.4'.

wayland: close popups upon window activation

Popups should grab all input on Wayland, however there are numerous
(deliberate) ways to get outside the grab, such as a shortcut that opens
a new window or pressing alt-tab.

If a popup is active when the focus changes we are left in a state where
the new window visibly has focus and appears on top of the popup's main
window, but the popup is still visible with an input grab. This is a
broken state.

This patch cancels popups if the focus window changes for whatever
reason.

Cancelling a popup also destroys the window server side rather than
waiting for the client to handle the popupDone so there is no racey
aspect for the next input.


(cherry picked from commit 43f7621eb1ef22704c4c12c21c29945bffa37e47)

Co-authored-by: David Edmundson <kde@davidedmundson.co.uk>

M  +45   -0    autotests/integration/xdgshellwindow_test.cpp
M  +7    -0    src/popup_input_filter.cpp
M  +1    -1    src/popup_input_filter.h

https://invent.kde.org/plasma/kwin/-/commit/51c0880f47ecd2e29ceb61e9dd9b30a535d18ff8