diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-10 18:34:12 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-10 18:34:12 -0500 |
commit | a7710c5537cb005acaeb2afe9a53bafa3e022817 (patch) | |
tree | b24327e97548fc528895e82f000b6e668cab93ac /include | |
parent | Include wayland-server.h instead of -core.h (diff) | |
download | sway-a7710c5537cb005acaeb2afe9a53bafa3e022817.tar.gz sway-a7710c5537cb005acaeb2afe9a53bafa3e022817.tar.zst sway-a7710c5537cb005acaeb2afe9a53bafa3e022817.zip |
Initialize keyboard in registry poll
Diffstat (limited to 'include')
-rw-r--r-- | include/client/registry.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/client/registry.h b/include/client/registry.h index 5e47b18e..2ab02174 100644 --- a/include/client/registry.h +++ b/include/client/registry.h | |||
@@ -2,16 +2,70 @@ | |||
2 | #define _SWAY_CLIENT_REGISTRY_H | 2 | #define _SWAY_CLIENT_REGISTRY_H |
3 | 3 | ||
4 | #include <wayland-client.h> | 4 | #include <wayland-client.h> |
5 | #include <xkbcommon/xkbcommon.h> | ||
5 | #include "wayland-desktop-shell-client-protocol.h" | 6 | #include "wayland-desktop-shell-client-protocol.h" |
6 | #include "wayland-swaylock-client-protocol.h" | 7 | #include "wayland-swaylock-client-protocol.h" |
7 | #include "list.h" | 8 | #include "list.h" |
8 | 9 | ||
10 | enum mod_bit { | ||
11 | MOD_SHIFT = 1<<0, | ||
12 | MOD_CAPS = 1<<1, | ||
13 | MOD_CTRL = 1<<2, | ||
14 | MOD_ALT = 1<<3, | ||
15 | MOD_MOD2 = 1<<4, | ||
16 | MOD_MOD3 = 1<<5, | ||
17 | MOD_LOGO = 1<<6, | ||
18 | MOD_MOD5 = 1<<7, | ||
19 | }; | ||
20 | |||
21 | enum mask { | ||
22 | MASK_SHIFT, | ||
23 | MASK_CAPS, | ||
24 | MASK_CTRL, | ||
25 | MASK_ALT, | ||
26 | MASK_MOD2, | ||
27 | MASK_MOD3, | ||
28 | MASK_LOGO, | ||
29 | MASK_MOD5, | ||
30 | MASK_LAST | ||
31 | }; | ||
32 | |||
9 | struct output_state { | 33 | struct output_state { |
10 | struct wl_output *output; | 34 | struct wl_output *output; |
11 | uint32_t flags; | 35 | uint32_t flags; |
12 | uint32_t width, height; | 36 | uint32_t width, height; |
13 | }; | 37 | }; |
14 | 38 | ||
39 | struct xkb { | ||
40 | struct xkb_state *state; | ||
41 | struct xkb_context *context; | ||
42 | struct xkb_keymap *keymap; | ||
43 | xkb_mod_mask_t masks[MASK_LAST]; | ||
44 | }; | ||
45 | |||
46 | struct input { | ||
47 | int *repeat_fd; | ||
48 | |||
49 | struct xkb xkb; | ||
50 | |||
51 | xkb_keysym_t sym; | ||
52 | uint32_t code; | ||
53 | uint32_t last_code; | ||
54 | uint32_t modifiers; | ||
55 | |||
56 | xkb_keysym_t repeat_sym; | ||
57 | uint32_t repeat_key; | ||
58 | |||
59 | int32_t repeat_rate_sec; | ||
60 | int32_t repeat_rate_nsec; | ||
61 | int32_t repeat_delay_sec; | ||
62 | int32_t repeat_delay_nsec; | ||
63 | |||
64 | struct { | ||
65 | void (*key)(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t code); | ||
66 | } notify; | ||
67 | }; | ||
68 | |||
15 | struct registry { | 69 | struct registry { |
16 | struct wl_compositor *compositor; | 70 | struct wl_compositor *compositor; |
17 | struct wl_display *display; | 71 | struct wl_display *display; |
@@ -22,6 +76,7 @@ struct registry { | |||
22 | struct wl_shm *shm; | 76 | struct wl_shm *shm; |
23 | struct desktop_shell *desktop_shell; | 77 | struct desktop_shell *desktop_shell; |
24 | struct lock *swaylock; | 78 | struct lock *swaylock; |
79 | struct input *input; | ||
25 | list_t *outputs; | 80 | list_t *outputs; |
26 | }; | 81 | }; |
27 | 82 | ||