diff options
author | 2018-06-08 16:03:50 +0100 | |
---|---|---|
committer | 2018-06-08 16:03:50 +0100 | |
commit | c65c84444e58404f951c628221b7485da0684f19 (patch) | |
tree | 578c0249b9ecf8eb8579b828862db3107d1a22bd /swaylock/seat.c | |
parent | Merge pull request #2119 from martinetd/gcc-strtruncation (diff) | |
parent | swaylock: implement ^U to clear buffer (diff) | |
download | sway-c65c84444e58404f951c628221b7485da0684f19.tar.gz sway-c65c84444e58404f951c628221b7485da0684f19.tar.zst sway-c65c84444e58404f951c628221b7485da0684f19.zip |
Merge pull request #2121 from martinetd/swaylock-ctrl-u
swaylock: implement ^U to clear buffer
Diffstat (limited to 'swaylock/seat.c')
-rw-r--r-- | swaylock/seat.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/swaylock/seat.c b/swaylock/seat.c index a81899a6..6c66d220 100644 --- a/swaylock/seat.c +++ b/swaylock/seat.c | |||
@@ -7,28 +7,6 @@ | |||
7 | #include "swaylock/swaylock.h" | 7 | #include "swaylock/swaylock.h" |
8 | #include "swaylock/seat.h" | 8 | #include "swaylock/seat.h" |
9 | 9 | ||
10 | const char *XKB_MASK_NAMES[MASK_LAST] = { | ||
11 | XKB_MOD_NAME_SHIFT, | ||
12 | XKB_MOD_NAME_CAPS, | ||
13 | XKB_MOD_NAME_CTRL, | ||
14 | XKB_MOD_NAME_ALT, | ||
15 | "Mod2", | ||
16 | "Mod3", | ||
17 | XKB_MOD_NAME_LOGO, | ||
18 | "Mod5", | ||
19 | }; | ||
20 | |||
21 | const enum mod_bit XKB_MODS[MASK_LAST] = { | ||
22 | MOD_SHIFT, | ||
23 | MOD_CAPS, | ||
24 | MOD_CTRL, | ||
25 | MOD_ALT, | ||
26 | MOD_MOD2, | ||
27 | MOD_MOD3, | ||
28 | MOD_LOGO, | ||
29 | MOD_MOD5 | ||
30 | }; | ||
31 | |||
32 | static void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, | 10 | static void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, |
33 | uint32_t format, int32_t fd, uint32_t size) { | 11 | uint32_t format, int32_t fd, uint32_t size) { |
34 | struct swaylock_state *state = data; | 12 | struct swaylock_state *state = data; |
@@ -84,16 +62,13 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, | |||
84 | uint32_t mods_locked, uint32_t group) { | 62 | uint32_t mods_locked, uint32_t group) { |
85 | struct swaylock_state *state = data; | 63 | struct swaylock_state *state = data; |
86 | xkb_state_update_mask(state->xkb.state, | 64 | xkb_state_update_mask(state->xkb.state, |
87 | mods_depressed, mods_latched, mods_locked, 0, 0, group); | 65 | mods_depressed, mods_latched, mods_locked, 0, 0, group); |
88 | xkb_mod_mask_t mask = xkb_state_serialize_mods(state->xkb.state, | 66 | state->xkb.caps_lock = xkb_state_mod_name_is_active(state->xkb.state, |
89 | XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); | 67 | XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED); |
90 | state->xkb.modifiers = 0; | 68 | state->xkb.control = xkb_state_mod_name_is_active(state->xkb.state, |
91 | state->xkb.caps_lock = xkb_state_mod_name_is_active(state->xkb.state, XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED); | 69 | XKB_MOD_NAME_CTRL, |
92 | for (uint32_t i = 0; i < MASK_LAST; ++i) { | 70 | XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); |
93 | if (mask & state->xkb.masks[i]) { | 71 | |
94 | state->xkb.modifiers |= XKB_MODS[i]; | ||
95 | } | ||
96 | } | ||
97 | } | 72 | } |
98 | 73 | ||
99 | static void keyboard_repeat_info(void *data, struct wl_keyboard *wl_keyboard, | 74 | static void keyboard_repeat_info(void *data, struct wl_keyboard *wl_keyboard, |