From 987f72d4f474cfa2ba0fb2a4c794720153c34abc Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 30 Aug 2017 17:24:44 +0100 Subject: [PATCH] Actions: Break latch on modifier/group changes Right now, only a few actions result in breaking a key latch. Add modifier/group actions to this, as presumably the effect of the latch should not last beyond already shifting the modifier/group state. This was discovered with a real-world use in an input device for the physically impaired, where shift latches, but pressing shift twice goes to caps lock (note shift vs. caps lock, so not pure latch-to-lock). This is possible to implement with current keymap files, but locking caps lock would not break the shift latch. Hence, the following key sequence: [Shift] [a -> a] [Shift] [Shift] [b -> b] [c -> C] would occur, as the modifier state when pressing b was lock locked and shift latched. With this patch, the sequence is correct: [Shift] [a -> a] [Shift] [Shift -> Lock] [b -> B] [c -> C] Signed-off-by: Daniel Stone --- src/state.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/state.c b/src/state.c index 6a88d9661..18c661593 100644 --- a/src/state.c +++ b/src/state.c @@ -430,6 +430,12 @@ xkb_action_breaks_latch(const union xkb_action *action) case ACTION_TYPE_CTRL_LOCK: case ACTION_TYPE_SWITCH_VT: case ACTION_TYPE_TERMINATE: + case ACTION_TYPE_MOD_SET: + case ACTION_TYPE_MOD_LATCH: + case ACTION_TYPE_MOD_LOCK: + case ACTION_TYPE_GROUP_SET: + case ACTION_TYPE_GROUP_LATCH: + case ACTION_TYPE_GROUP_LOCK: return true; default: return false;