Merge pull request #3367 from oscarwcl/swaylock-fix-capslock

swaylock: Fix caps lock not updating immediately
This commit is contained in:
Drew DeVault 2019-01-05 23:45:38 -05:00 committed by GitHub
commit 728e5700dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View file

@ -146,14 +146,6 @@ void swaylock_handle_key(struct swaylock_state *state,
schedule_indicator_clear(state); schedule_indicator_clear(state);
break; break;
case XKB_KEY_Caps_Lock: case XKB_KEY_Caps_Lock:
/* The state is getting active after this
* so we need to manually toggle it */
state->xkb.caps_lock = !state->xkb.caps_lock;
state->auth_state = AUTH_STATE_INPUT_NOP;
damage_state(state);
schedule_indicator_clear(state);
schedule_password_clear(state);
break;
case XKB_KEY_Shift_L: case XKB_KEY_Shift_L:
case XKB_KEY_Shift_R: case XKB_KEY_Shift_R:
case XKB_KEY_Control_L: case XKB_KEY_Control_L:

View file

@ -63,8 +63,12 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
struct swaylock_state *state = data; struct swaylock_state *state = data;
xkb_state_update_mask(state->xkb.state, xkb_state_update_mask(state->xkb.state,
mods_depressed, mods_latched, mods_locked, 0, 0, group); mods_depressed, mods_latched, mods_locked, 0, 0, group);
state->xkb.caps_lock = xkb_state_mod_name_is_active(state->xkb.state, int caps_lock = xkb_state_mod_name_is_active(state->xkb.state,
XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED); XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED);
if (caps_lock != state->xkb.caps_lock) {
state->xkb.caps_lock = caps_lock;
damage_state(state);
}
state->xkb.control = xkb_state_mod_name_is_active(state->xkb.state, state->xkb.control = xkb_state_mod_name_is_active(state->xkb.state,
XKB_MOD_NAME_CTRL, XKB_MOD_NAME_CTRL,
XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED);