diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-10-03 10:36:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-03 10:36:16 -0400 |
commit | 5f3c56de2805f11e84e0bb17edc30f455f0a3aaf (patch) | |
tree | 598f2b661eb02e78f78d6cd3f56a9877c23fc2d9 /include/wlr | |
parent | ddba002d2ac8060863db622c5391dc4b10f40760 (diff) | |
parent | eadda29e841383c6649e8f85494516aff00b493f (diff) |
Merge pull request #184 from emersion/rootston-keys
Keyboard modifiers
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_keyboard.h | 35 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 1 |
2 files changed, 30 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index af205c63..9ec8ddd4 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -6,11 +6,25 @@ #include <wayland-server.h> #include <xkbcommon/xkbcommon.h> -enum WLR_KEYBOARD_LED { +#define WLR_LED_COUNT 3 + +enum wlr_keyboard_led { WLR_LED_NUM_LOCK = 1, WLR_LED_CAPS_LOCK = 2, WLR_LED_SCROLL_LOCK = 4, - WLR_LED_LAST +}; + +#define WLR_MODIFIER_COUNT 8 + +enum wlr_keyboard_modifier { + WLR_MODIFIER_SHIFT = 1, + WLR_MODIFIER_CAPS = 2, + WLR_MODIFIER_CTRL = 4, + WLR_MODIFIER_ALT = 8, + WLR_MODIFIER_MOD2 = 16, + WLR_MODIFIER_MOD3 = 32, + WLR_MODIFIER_LOGO = 64, + WLR_MODIFIER_MOD5 = 128, }; struct wlr_keyboard_impl; @@ -23,18 +37,25 @@ struct wlr_keyboard { size_t keymap_size; struct xkb_keymap *keymap; struct xkb_state *xkb_state; - xkb_led_index_t leds[WLR_LED_LAST]; + xkb_led_index_t led_indexes[WLR_LED_COUNT]; + xkb_mod_index_t mod_indexes[WLR_MODIFIER_COUNT]; + + struct { + xkb_mod_mask_t depressed; + xkb_mod_mask_t latched; + xkb_mod_mask_t locked; + xkb_mod_mask_t group; + } modifiers; struct { struct wl_signal key; + struct wl_signal modifiers; struct wl_signal keymap; } events; void *data; }; -void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); - enum wlr_key_state { WLR_KEY_RELEASED, WLR_KEY_PRESSED, @@ -48,6 +69,8 @@ struct wlr_event_keyboard_key { }; void wlr_keyboard_set_keymap(struct wlr_keyboard *kb, - struct xkb_keymap *keymap); + struct xkb_keymap *keymap); +void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); +uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard); #endif diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 6927cd16..489bd529 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -37,6 +37,7 @@ struct wlr_seat_keyboard { struct wlr_seat *seat; struct wlr_keyboard *keyboard; struct wl_listener key; + struct wl_listener modifiers; struct wl_listener keymap; struct wl_listener destroy; struct wl_list link; |