Skip to content

Commit

Permalink
Actions: Break latch on modifier/group changes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
fooishbar committed Aug 30, 2017
1 parent 14686cd commit 987f72d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 987f72d

Please sign in to comment.