]> git.mdlowis.com Git - proto/labwc.git/commit
Clear keyboard/pointer focus on Move/Resize, window switcher and menu
authortokyo4j <hrak1529@gmail.com>
Sat, 28 Dec 2024 15:48:55 +0000 (00:48 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Sun, 29 Dec 2024 07:27:34 +0000 (16:27 +0900)
commitbad788ccdd04c8ce42fc43fd3a9d614e27813ad6
tree97146b9722c775584a1fa7be9ff97810787b2f4e
parentbd7a533dd675199791c44fb514e549cf1e86f6e0
Clear keyboard/pointer focus on Move/Resize, window switcher and menu

The previous revert fixed the problem of stuck modifier keys with
keybinds in Blender, but made Firefox show its menu bar with Alt-*
keybinds. This is fundamentally inevitable due to the limitation of
wayland protocol, but at least for the default Alt-Tab keybind for
window switcher, we can mitigate this problem by clearing the keyboard
focus when the window switcher is activated. This is what KWin does, and
we decided to follow that.

So in this commit, keyboard and pointer focus are temporarily cleared
while Move/Resize, window switcher and menu interactions and restored
after them. We slightly deviate from KWin as KWin doesn't clear the
keyboard focus while Move/Resize, but it solves our existing problem
that Firefox shows its menu bar after dragging it with default Alt-Drag
mousebind, and this is what Mutter does.

We considered other solutions, but they don't work well:
1. Send wl_keyboard.{leave,enter} every time keybinds/mousebinds are
   triggered. This solves the Firefox's menu bar problem, but that
   sounds like a workaround and sending unnecessary events every time is
   not desirable.
2. Send release events for both modifiers and keys even when they are
   bound to keybinds. This is what Mutter is doing, but it looks like an
   implementation issue and violates wayland protocol.
include/labwc.h
src/action.c
src/input/cursor.c
src/input/keyboard.c
src/interactive.c
src/menu/menu.c
src/osd.c
src/seat.c
src/view.c