compositor modifier hook

This commit is contained in:
Tony Crisci 2018-01-05 07:00:50 -05:00
parent c8b9c0ad0e
commit 0ef2df21f2
6 changed files with 51 additions and 34 deletions

View file

@ -32,6 +32,13 @@ enum wlr_keyboard_modifier {
struct wlr_keyboard_impl;
struct wlr_keyboard_modifiers {
xkb_mod_mask_t depressed;
xkb_mod_mask_t latched;
xkb_mod_mask_t locked;
xkb_mod_mask_t group;
};
struct wlr_keyboard {
struct wlr_keyboard_impl *impl;
// TODO: Should this store key repeat info too?
@ -45,12 +52,7 @@ struct wlr_keyboard {
uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
size_t num_keycodes;
struct {
xkb_mod_mask_t depressed;
xkb_mod_mask_t latched;
xkb_mod_mask_t locked;
xkb_mod_mask_t group;
} modifiers;
struct wlr_keyboard_modifiers *modifiers;
struct {
int32_t rate;

View file

@ -71,7 +71,8 @@ struct wlr_keyboard_grab_interface {
struct wlr_surface *surface);
void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time,
uint32_t key, uint32_t state);
void (*modifiers)(struct wlr_seat_keyboard_grab *grab);
void (*modifiers)(struct wlr_seat_keyboard_grab *grab,
struct wlr_keyboard_modifiers *modifiers);
void (*cancel)(struct wlr_seat_keyboard_grab *grab);
};
@ -344,6 +345,11 @@ bool wlr_seat_pointer_has_grab(struct wlr_seat *seat);
*/
void wlr_seat_set_keyboard(struct wlr_seat *seat, struct wlr_input_device *dev);
/**
* Get the active keyboard for the seat.
*/
struct wlr_keyboard *wlr_seat_get_keyboard(struct wlr_seat *seat);
/**
* Start a grab of the keyboard of this seat. The grabber is responsible for
* handling all keyboard events until the grab ends.
@ -375,13 +381,15 @@ void wlr_seat_keyboard_notify_key(struct wlr_seat *seat, uint32_t time,
* Send the modifier state to focused keyboard resources. Compositors should use
* `wlr_seat_keyboard_notify_modifiers()` to respect any keyboard grabs.
*/
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat);
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
struct wlr_keyboard_modifiers *modifiers);
/**
* Notify the seat that the modifiers for the keyboard have changed. Defers to
* any keyboard grabs.
*/
void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat);
void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat,
struct wlr_keyboard_modifiers *modifiers);
/**
* Notify the seat that the keyboard focus has changed and request it to be the