From 1f2588e71515a38a7e4e3d4f0dac2473f59a36e6 Mon Sep 17 00:00:00 2001 From: Andreas Wettstein Date: Mon, 29 Oct 2012 09:37:10 +0100 Subject: [PATCH] xkb: LockMods can lock another group on key release #865 Two unused bytes in XkbModAction are used to allow LockMods to perform group locks as well. These two bytes are interpreted as the flags and the group_XXX bytes in XkbGroupAction. When the key that LockMods is assigned to is pressed and released before any other key is pressed, a group lock as specified by these two bytes is performed. Otherwise, LockMods operates according to the XKB protocol specification. If the two bytes are zero, which is the case by default, also no group change happens, so LockMods operates according to the specification. Signed-off-by: Andreas Wettstein --- include/xkbstr.h | 3 +++ xkb/xkbActions.c | 7 +++++++ 2 Dateien geändert, 10 Zeilen hinzugefügt(+) diff --git a/include/xkbstr.h b/include/xkbstr.h index 935330c..8fd7daf 100644 --- a/include/xkbstr.h +++ b/include/xkbstr.h @@ -127,6 +127,9 @@ typedef struct _XkbModAction { /* FIXME: Make this an int. */ unsigned char vmods1; unsigned char vmods2; + /* The effect on groups is an extension beyond the XKB specification */ + unsigned char group_flags; + char group_XXX; } XkbModAction; #define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2)) diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 1adb389..4da624d 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -366,6 +366,13 @@ _XkbFilterLockState(XkbSrvInfoPtr xkbi, xkbi->clearMods = filter->upAction.mods.mask; if (!(filter->upAction.mods.flags & XkbSA_LockNoUnlock)) xkbi->state.locked_mods &= ~filter->priv; + if (filter->upAction.mods.group_flags&XkbSA_GroupAbsolute) + xkbi->state.locked_group= XkbSAGroup(&filter->upAction.mods); + else xkbi->state.locked_group+= XkbSAGroup(&filter->upAction.mods); + }else if(pAction){ + /* Another key has been pressed: do not change group on release */ + XkbSASetGroup(&filter->upAction.mods, 0); + filter->upAction.mods.group_flags&= ~XkbSA_GroupAbsolute; } return 1; } -- 1.7.11.3