[PATCH 4/4] libxkbfile: Support 'noLock'/'noUnlock' flags and group locks in LockMods #865, #27903

Andreas Wettstein wettstein509 at solnet.ch
Sat Nov 10 08:08:41 PST 2012


Support 'noLock' and 'noUnlock' flags in 'LockMods', as well as the possibility
to specify a group change in 'LockMods".

Signed-off-by: Andreas Wettstein <wettstein509 at solnet.ch>
---
 src/xkbtext.c | 24 +++++++++++++++++++++++-
 1 Datei geändert, 23 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/src/xkbtext.c b/src/xkbtext.c
index 3a82b17..c6ffcc9 100644
--- a/src/xkbtext.c
+++ b/src/xkbtext.c
@@ -802,6 +802,7 @@ CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,
 {
 XkbModAction *	act;
 unsigned	tmp;
+char            tbuf[32];
 
     act= &action->mods;
     tmp= XkbModActionVMods(act);
@@ -814,8 +815,29 @@ unsigned	tmp;
 		     sz);
     }
     else TryCopyStr(buf,"none",sz);
-    if (act->type==XkbSA_LockMods)
+    if (act->type==XkbSA_LockMods){
+	switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
+	    case XkbSA_LockNoLock:
+		sprintf(tbuf,",affect=unlock"); break;
+	    case XkbSA_LockNoUnlock:
+		sprintf(tbuf,",affect=lock"); break;
+	    case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
+		sprintf(tbuf,",affect=neither"); break;
+	    default:
+		sprintf(tbuf,""); break;
+	}
+	TryCopyStr(buf,tbuf,sz);
+	if(XkbSAGroup(act) != 0 || act->group_flags&XkbSA_GroupAbsolute){
+	    TryCopyStr(buf,",group=",sz);
+	    if (act->group_flags&XkbSA_GroupAbsolute)
+		sprintf(tbuf,"%d",XkbSAGroup(act)+1);
+	    else if (XkbSAGroup(act)<0)
+		sprintf(tbuf,"%d",XkbSAGroup(act));
+	    else sprintf(tbuf,"+%d",XkbSAGroup(act));
+	    TryCopyStr(buf,tbuf,sz);
+	}
 	return True;
+    }
     if (act->flags&XkbSA_ClearLocks)
 	TryCopyStr(buf,",clearLocks",sz);
     if (act->flags&XkbSA_LatchToLock)
-- 
1.7.11.3



More information about the xorg-devel mailing list