From 7e020f433917b925b7fa21a728faaf1e1e34a24c Mon Sep 17 00:00:00 2001 From: Andreas Wettstein Date: Sun, 28 Oct 2012 17:14:12 +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 | 6 ++++++ 2 Dateien geändert, 9 Zeilen hinzugefügt(+) diff --git a/include/xkbstr.h b/include/xkbstr.h index 935330c..423101e 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..bf26eeb 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -366,6 +366,12 @@ _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); } return 1; } -- 1.7.11.3