mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
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.
16 lines
474 B
C
16 lines
474 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef LABWC_KEY_STATE_H
|
|
#define LABWC_KEY_STATE_H
|
|
|
|
struct seat;
|
|
|
|
/*
|
|
* All keycodes in these functions are (Linux) libinput evdev scancodes which is
|
|
* what 'wlr_keyboard' uses (e.g. 'seat->keyboard_group->keyboard->keycodes').
|
|
* Note: These keycodes are different to XKB scancodes by a value of 8.
|
|
*/
|
|
|
|
void key_state_indicator_update(struct seat *seat);
|
|
void key_state_indicator_toggle(void);
|
|
|
|
#endif /* LABWC_KEY_STATE_H */
|