diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2020-05-31 17:10:15 -0400 |
---|---|---|
committer | Tudor Brindus <me@tbrindus.ca> | 2020-05-31 17:28:18 -0400 |
commit | 32148808ad7bf7d2c072dc6491453f97e8c3cd35 (patch) | |
tree | b07ccd3900810f1685584d40ca60f0f41191e685 /include | |
parent | 8ab4d9138054c6e4b003c9a89db65aae29a28bdb (diff) |
wlr_keyboard_group: introduce enter and leave
This introduces the enter and leave events for wlr_keyboard_group.
The enter event is emitted when a keyboard is added to the group while a
key is pressed that is not pressed by any other keyboard in the group.
The data is a wl_array of the pressed key codes unique to the keyboard
that should now be considered pressed.
Similarly the leave event is emitted when a keyboard is removed from the
group while at least one key is pressed that is not pressed by any other
keyboard in the group. The data is a wl_array of the pressed key codes
unique to the keyboard that should now be considered released.
The purpose of these events are to allow the compositor to update its
state to avoid corruption. Additionally, for the leave event, the
focused surface may have been notified of a key press for some or all of
the key codes and needs to be notified of a key release to avoid state
corruption.
These were previously emitted as normal key events, but they are not
normal key events. There is no actual key press or release associated
with the events. It's purely for state keeping purposes. Emitting them
as separate events allows the compositor to handle them differently.
Since these are purely for state keeping purposes and are not associated
with an actual key being pressed or released, bindings should not be
triggered as a result of these events.
Diffstat (limited to 'include')
-rw-r--r-- | include/types/wlr_keyboard.h | 8 | ||||
-rw-r--r-- | include/wlr/types/wlr_keyboard_group.h | 24 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/types/wlr_keyboard.h b/include/types/wlr_keyboard.h new file mode 100644 index 00000000..e28462b5 --- /dev/null +++ b/include/types/wlr_keyboard.h @@ -0,0 +1,8 @@ +#include "wlr/types/wlr_keyboard.h" + +void keyboard_key_update(struct wlr_keyboard *keyboard, + struct wlr_event_keyboard_key *event); + +bool keyboard_modifier_update(struct wlr_keyboard *keyboard); + +void keyboard_led_update(struct wlr_keyboard *keyboard); diff --git a/include/wlr/types/wlr_keyboard_group.h b/include/wlr/types/wlr_keyboard_group.h index 023887f3..0b3df226 100644 --- a/include/wlr/types/wlr_keyboard_group.h +++ b/include/wlr/types/wlr_keyboard_group.h @@ -18,6 +18,30 @@ struct wlr_keyboard_group { struct wlr_input_device *input_device; struct wl_list devices; // keyboard_group_device::link struct wl_list keys; // keyboard_group_key::link + + struct { + /* + * Sent when a keyboard has entered the group with keys currently + * pressed that are not pressed by any other keyboard in the group. The + * data for this signal will be a wl_array containing the key codes. + * This should be used to update the compositor's internal state. + * Bindings should not be triggered based off of these key codes and + * they should also not notify any surfaces of the key press. + */ + struct wl_signal enter; + + /* + * Sent when a keyboard has left the group with keys currently pressed + * that are not pressed by any other keyboard in the group. The data for + * this signal will be a wl_array containing the key codes. This should + * be used to update the compositor's internal state. Bindings should + * not be triggered based off of these key codes. Additionally, surfaces + * should only be notified if they received a corresponding key press + * for the key code. + */ + struct wl_signal leave; + } events; + void *data; }; |