summaryrefslogtreecommitdiffstats
path: root/swaylock
diff options
context:
space:
mode:
authorLibravatar Oscar Cowdery Lack <oscar.cowderylack@gmail.com>2019-01-03 09:12:01 +1100
committerLibravatar Oscar Cowdery Lack <oscar.cowderylack@gmail.com>2019-01-03 09:28:14 +1100
commit76cd3f2642127c1b3a02e863d4d4bf9d5dc34d60 (patch)
treeab8016c16c05b28f7977f4091d6ccc563b6c36ad /swaylock
parentFix fullscreen view rendering crash (diff)
downloadsway-76cd3f2642127c1b3a02e863d4d4bf9d5dc34d60.tar.gz
sway-76cd3f2642127c1b3a02e863d4d4bf9d5dc34d60.tar.zst
sway-76cd3f2642127c1b3a02e863d4d4bf9d5dc34d60.zip
swaylock: Fix caps lock not updating immediately
Partially fixes #2788. This change makes it so the lock screen is redrawn whenever the caps lock modifier state changes, rather on relying on the keypress event. This didn't work because caps lock is disabled when the key is released, not pressed, so the caps lock indicator does not go away until the next keypress event.
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/password.c8
-rw-r--r--swaylock/seat.c6
2 files changed, 5 insertions, 9 deletions
diff --git a/swaylock/password.c b/swaylock/password.c
index 3059203a..3bd113ad 100644
--- a/swaylock/password.c
+++ b/swaylock/password.c
@@ -146,14 +146,6 @@ void swaylock_handle_key(struct swaylock_state *state,
146 schedule_indicator_clear(state); 146 schedule_indicator_clear(state);
147 break; 147 break;
148 case XKB_KEY_Caps_Lock: 148 case XKB_KEY_Caps_Lock:
149 /* The state is getting active after this
150 * so we need to manually toggle it */
151 state->xkb.caps_lock = !state->xkb.caps_lock;
152 state->auth_state = AUTH_STATE_INPUT_NOP;
153 damage_state(state);
154 schedule_indicator_clear(state);
155 schedule_password_clear(state);
156 break;
157 case XKB_KEY_Shift_L: 149 case XKB_KEY_Shift_L:
158 case XKB_KEY_Shift_R: 150 case XKB_KEY_Shift_R:
159 case XKB_KEY_Control_L: 151 case XKB_KEY_Control_L:
diff --git a/swaylock/seat.c b/swaylock/seat.c
index 7b72114f..f0b1385e 100644
--- a/swaylock/seat.c
+++ b/swaylock/seat.c
@@ -63,8 +63,12 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
63 struct swaylock_state *state = data; 63 struct swaylock_state *state = data;
64 xkb_state_update_mask(state->xkb.state, 64 xkb_state_update_mask(state->xkb.state,
65 mods_depressed, mods_latched, mods_locked, 0, 0, group); 65 mods_depressed, mods_latched, mods_locked, 0, 0, group);
66 state->xkb.caps_lock = xkb_state_mod_name_is_active(state->xkb.state, 66 int caps_lock = xkb_state_mod_name_is_active(state->xkb.state,
67 XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED); 67 XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED);
68 if (caps_lock != state->xkb.caps_lock) {
69 state->xkb.caps_lock = caps_lock;
70 damage_state(state);
71 }
68 state->xkb.control = xkb_state_mod_name_is_active(state->xkb.state, 72 state->xkb.control = xkb_state_mod_name_is_active(state->xkb.state,
69 XKB_MOD_NAME_CTRL, 73 XKB_MOD_NAME_CTRL,
70 XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); 74 XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED);