mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
keyboard: simplify key state handling
We used to store both `pressed` keys and `bound` keys and derive `pressed_sent` keys from them, which are notified to the client when switching focus. But I think this was overengineered and we can remove `pressed` keys and `bound` keys. Instead we now directly modify `pressed_sent` keys just before calling `wlr_seat_keyboard_notify_key()`. Technically we could even remove `pressed_sent` keys as they are duplicated in wlr_seat->keyboard_state.keyboard->keycodes, but we keep `pressed_sent` keys as it is easier to access. The only place which required `bound` keys was `handle_modifiers()`. This function checked `bound` keys to keep widnow switcher alive when Alt-Tab is pressed and only the Alt modifier is released. The window switcher is then finished when Tab key is released. I replaced the check with `(seat->keyboard_group->keyboard.num_keycodes > 0)`. This slightly changes the behavior; when Alt-Tab and any other key e.g. X are pressed and Tab key and Alt modifier are released, the window switcher is now kept alive. But I don't think this breaks any workflows for users.
This commit is contained in:
parent
98b3d911eb
commit
885db240f3
5 changed files with 33 additions and 125 deletions
|
|
@ -83,6 +83,9 @@ struct seat {
|
|||
|
||||
struct lab_set bound_buttons;
|
||||
|
||||
/* Keys that have been pressed and not consumed by compositor actions */
|
||||
struct lab_set pressed_sent_keys;
|
||||
|
||||
struct {
|
||||
bool active;
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue