Output "affect" flags for control locks, modifier locks, and ISOLock.  Output
flag "genKeyEvent" flag for message actions.  Do not generate output for any of
these if the flags have their default setting, to avoid problems of parsing
this output with versions of xkbcomp that do not support these flags.

Signed-off-by: Andreas Wettstein <[email protected]>
---
 src/xkbtext.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 51 insertions(+), 5 deletions(-)

diff --git a/src/xkbtext.c b/src/xkbtext.c
index b5d4750..d80c7a3 100644
--- a/src/xkbtext.c
+++ b/src/xkbtext.c
@@ -886,8 +886,22 @@ CopyModActionArgs(Display *dpy, XkbDescPtr xkb, XkbAction 
*action,
     }
     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:
+            TryCopyStr(buf, ",affect=unlock", sz);
+            break;
+        case XkbSA_LockNoUnlock:
+            TryCopyStr(buf, ",affect=lock", sz);
+            break;
+        case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
+            TryCopyStr(buf, ",affect=neither", sz);
+            break;
+        default:
+            break;
+       }
         return True;
+    }
     if (act->flags & XkbSA_ClearLocks)
         TryCopyStr(buf, ",clearLocks", sz);
     if (act->flags & XkbSA_LatchToLock)
@@ -906,11 +920,11 @@ CopyGroupActionArgs(Display *dpy, XkbDescPtr xkb, 
XkbAction *action,
     act = &action->group;
     TryCopyStr(buf, "group=", sz);
     if (act->flags & XkbSA_GroupAbsolute)
-        snprintf(tbuf, sizeof(buf), "%d", XkbSAGroup(act) + 1);
+        snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act) + 1);
     else if (XkbSAGroup(act) < 0)
-        snprintf(tbuf, sizeof(buf), "%d", XkbSAGroup(act));
+        snprintf(tbuf, sizeof(tbuf), "%d", XkbSAGroup(act));
     else
-        snprintf(tbuf, sizeof(buf), "+%d", XkbSAGroup(act));
+        snprintf(tbuf, sizeof(tbuf), "+%d", XkbSAGroup(act));
     TryCopyStr(buf, tbuf, sz);
     if (act->type == XkbSA_LockGroup)
         return True;
@@ -1049,8 +1063,12 @@ CopyISOLockArgs(Display *dpy, XkbDescPtr xkb, XkbAction 
*action,
             TryCopyStr(buf, "none", sz);
     }
     TryCopyStr(buf, ",affect=", sz);
-    if ((act->affect & XkbSA_ISOAffectMask) == 0)
+    if ((act->affect & XkbSA_ISOAffectMask) == 0) {
         TryCopyStr(buf, "all", sz);
+    }
+    else if ((act->affect & XkbSA_ISOAffectMask) == XkbSA_ISOAffectMask) {
+        TryCopyStr(buf, "none", sz);
+    }
     else {
         int nOut = 0;
 
@@ -1074,6 +1092,18 @@ CopyISOLockArgs(Display *dpy, XkbDescPtr xkb, XkbAction 
*action,
             nOut++;
         }
     }
+    switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
+    case XkbSA_LockNoLock:
+       TryCopyStr(buf, "+unlock", sz);
+        break;
+    case XkbSA_LockNoUnlock:
+       TryCopyStr(buf, "+lock", sz);
+        break;
+    case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
+       TryCopyStr(buf, "+neither", sz);
+        break;
+    default: ;
+    }
     return True;
 }
 
@@ -1183,6 +1213,20 @@ CopySetLockControlsArgs(Display *dpy, XkbDescPtr xkb, 
XkbAction *action,
             nOut++;
         }
     }
+    if (action->type == XkbSA_LockControls) {
+       switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
+       case XkbSA_LockNoLock:
+           TryCopyStr(buf, ",affect=unlock", sz);
+            break;
+       case XkbSA_LockNoUnlock:
+           TryCopyStr(buf, ",affect=lock", sz);
+            break;
+       case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
+           TryCopyStr(buf, ",affect=neither", sz);
+            break;
+       default: ;
+       }
+    }
     return True;
 }
 
@@ -1218,6 +1262,8 @@ CopyActionMessageArgs(Display *dpy, XkbDescPtr xkb, 
XkbAction *action,
     TryCopyStr(buf, tbuf, sz);
     snprintf(tbuf, sizeof(tbuf), ",data[5]=0x%02x", act->message[5]);
     TryCopyStr(buf, tbuf, sz);
+    if (act->flags & XkbSA_MessageGenKeyEvent)
+       TryCopyStr(buf, ",genKeyEvent", sz);
     return True;
 }
 
-- 
1.8.3.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to