xkb: Support noLock and noUnlock flags for LockMods

Submitted by Peter Hutterer on Aug. 11, 2011, 1:33 p.m.

Details

Message ID 20110811063333.GA31456@barra.bne.redhat.com
State Accepted, archived
Commit e3f6a76dd480717eae4b17ad8e2ff707de2ffe4c
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer Aug. 11, 2011, 1:33 p.m.
From: Andreas Wettstein <wettstein509@solnet.ch>

These flags are required by the XKB spec section 6.3.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 xkb/xkbActions.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 86352eb..1e94d26 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -344,15 +344,18 @@  _XkbFilterLockState(	XkbSrvInfoPtr	xkbi,
 	filter->keycode = keycode;
 	filter->active = 1;
 	filter->filterOthers = 0;
-	filter->priv = 0;
+	filter->priv = xkbi->state.locked_mods&pAction->mods.mask;
 	filter->filter = _XkbFilterLockState;
 	filter->upAction = *pAction;
-	xkbi->state.locked_mods^= pAction->mods.mask;
+	if (!(filter->upAction.mods.flags&XkbSA_LockNoLock))
+	    xkbi->state.locked_mods|= pAction->mods.mask;
 	xkbi->setMods = pAction->mods.mask;
     }
     else if (filter->keycode==keycode) {
 	filter->active = 0;
 	xkbi->clearMods = filter->upAction.mods.mask;
+	if (!(filter->upAction.mods.flags&XkbSA_LockNoUnlock))
+	    xkbi->state.locked_mods&= ~filter->priv;
     }
     return 1;
 }