Skip to content

Commit d48426c

Browse files
Break modifier latches when a group is latched
This ensures the behavior is as expected when using latched groups to implement e.g. “additional symbols” layers. Signed-off-by: Jules Bertholet <[email protected]>
1 parent 1600066 commit d48426c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Changed latching behavior so that latching a group breaks active modifier latches.

src/state.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ xkb_action_breaks_latch(const union xkb_action *action, bool is_group_latch)
328328
case ACTION_TYPE_CTRL_SET:
329329
case ACTION_TYPE_CTRL_LOCK:
330330
return true;
331+
case ACTION_TYPE_GROUP_LATCH:
332+
// Group latches break mod latches, but not other group latches
333+
return !is_group_latch;
331334
default:
332335
return false;
333336
}
@@ -410,7 +413,7 @@ xkb_filter_group_latch_func(struct xkb_state *state,
410413
/* XXX beep beep! */
411414
return XKB_FILTER_CONSUME;
412415
}
413-
else if (xkb_action_breaks_latch(&(actions[k]))) {
416+
else if (xkb_action_breaks_latch(&(actions[k]), true)) {
414417
/* Breaks the latch */
415418
state->components.latched_group = 0;
416419
filter->func = NULL;
@@ -566,7 +569,7 @@ xkb_filter_mod_latch_func(struct xkb_state *state,
566569
/* XXX beep beep! */
567570
return XKB_FILTER_CONSUME;
568571
}
569-
else if (xkb_action_breaks_latch(&(actions[k]))) {
572+
else if (xkb_action_breaks_latch(&(actions[k]), false)) {
570573
/* XXX: This may be totally broken, we might need to break the
571574
* latch in the next run after this press? */
572575
state->components.latched_mods &= ~filter->action.mods.mods.mask;

0 commit comments

Comments
 (0)