Restore compatible action structs
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 20 Oct 2010 19:57:45 +0000 (15:57 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 20 Oct 2010 19:57:45 +0000 (15:57 -0400)
This unbreaks the X server code to serialize an xkb_desc, but loses the
32 bit vmod fields.  Needs some work...

include/X11/extensions/XKBcommon.h
src/xkbcomp/action.c
src/xkbcomp/compat.c

index 6bf7d8a..9a42834 100644 (file)
@@ -85,118 +85,99 @@ struct xkb_rule_names {
 };
 
 struct xkb_any_action {
-    unsigned char   type;
-    unsigned char   pad[18];
+    uint8_t   type;
+    uint8_t   data[7];
 };
 
 struct xkb_mod_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
+    uint8_t         mask;
     uint8_t         real_mods;
-    uint32_t        mask;
-    uint32_t        vmods;
+    uint16_t        vmods;
 };
 
 struct xkb_group_action {
-    unsigned char   type;
-    unsigned char   flags;
+    uint8_t         type;
+    uint8_t         flags;
     int16_t         group;
 };
 
 struct xkb_iso_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
-    int16_t         group;
-    uint32_t        mask;
-    uint32_t        vmods;
+    uint8_t         mask;
     uint8_t         real_mods;
-   uint8_t         affect;
+    uint8_t         group;
+    uint8_t         affect;
+    uint16_t        vmods;
 };
 
 struct xkb_controls_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
     uint32_t        ctrls;
 };
 
 struct xkb_device_button_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
-    uint16_t        device;
-    uint16_t        button;
     uint8_t         count;
+    uint8_t         button;
+    uint8_t         device;
 };
 
 struct xkb_device_valuator_action {
-    unsigned char   type;
+    uint8_t         type;
+    uint8_t         device;
     uint8_t         v1_what;
-    uint16_t        device;
-    uint16_t        v1_index;
-    int16_t         v1_value;
-    uint16_t        v2_index;
-    int16_t         v2_value;
+    uint8_t         v1_index;
+    uint8_t         v1_value;
     uint8_t         v2_what;
+    uint8_t         v2_index;
+    uint8_t         v2_value;
 };
 
 struct xkb_pointer_default_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
     uint8_t         affect;
     uint8_t         value;
 };
 
 struct xkb_switch_screen_action {
-    unsigned char   type;
+    uint8_t         type;
     uint8_t         flags;
     uint8_t         screen;
 };
 
 struct xkb_redirect_key_action {
-       unsigned char   type;
-       unsigned char   new_key;
-       unsigned char   mods_mask;
-       unsigned char   mods;
-       unsigned char   vmods_mask0;
-       unsigned char   vmods_mask1;
-       unsigned char   vmods0;
-       unsigned char   vmods1;
-};
-#define        XkbSARedirectVMods(a)           ((((unsigned int)(a)->vmods1)<<8)|\
-                                       ((unsigned int)(a)->vmods0))
-#define        XkbSARedirectSetVMods(a,m)      (((a)->vmods_mask1=(((m)>>8)&0xff)),\
-                                        ((a)->vmods_mask0=((m)&0xff)))
-#define        XkbSARedirectVModsMask(a)       ((((unsigned int)(a)->vmods_mask1)<<8)|\
-                                       ((unsigned int)(a)->vmods_mask0))
-#define        XkbSARedirectSetVModsMask(a,m)  (((a)->vmods_mask1=(((m)>>8)&0xff)),\
-                                        ((a)->vmods_mask0=((m)&0xff)))
-
+    uint8_t            type;
+    uint8_t            new_key;
+    uint8_t            mods_mask;
+    uint8_t            mods;
+    uint16_t           vmods_mask;
+    uint16_t           vmods;
+};
 
 struct xkb_pointer_action {
-       unsigned char   type;
-       unsigned char   flags;
-       unsigned char   high_XXX;
-       unsigned char   low_XXX;
-       unsigned char   high_YYY;
-       unsigned char   low_YYY;
+    uint8_t    type;
+    uint8_t    flags;
+    uint16_t   x;
+    uint16_t   y;
 };
-#define        XkbIntTo2Chars(i,h,l)   (((h)=((i>>8)&0xff)),((l)=((i)&0xff)))
-#define        XkbPtrActionX(a)      (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX))
-#define        XkbPtrActionY(a)      (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY))
-#define        XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX))
-#define        XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY))
 
 struct xkb_message_action {
-       unsigned char   type;
-       unsigned char   flags;
-       unsigned char   message[6];
+    uint8_t    type;
+    uint8_t    flags;
+    uint8_t    message[6];
 };
 
 struct xkb_pointer_button_action {
-       unsigned char   type;
-       unsigned char   flags;
-       unsigned char   count;
-       unsigned char   button;
+    uint8_t    type;
+    uint8_t    flags;
+    uint8_t    count;
+    uint8_t    button;
 };
 
 union xkb_action {
index fa6a80c..d0b5860 100644 (file)
@@ -606,13 +606,13 @@ HandleMovePtr(struct xkb_desc * xkb,
         {
             if (absolute)
                 act->flags |= XkbSA_MoveAbsoluteX;
-            XkbSetPtrActionX(act, rtrn.ival);
+            act->x = rtrn.ival;
         }
         else
         {
             if (absolute)
                 act->flags |= XkbSA_MoveAbsoluteY;
-            XkbSetPtrActionY(act, rtrn.ival);
+            act->y = rtrn.ival;
         }
         return True;
     }
@@ -1069,11 +1069,11 @@ HandleRedirectKey(struct xkb_desc * xkb,
                 act->mods &= ~(t2 & 0xff);
 
             t2 = (t2 >> 8) & 0xffff;
-            XkbSARedirectSetVModsMask(act, XkbSARedirectVModsMask(act) | t2);
+            act->vmods_mask |= t2;
             if (field == F_Modifiers)
-                XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) | t2);
+                act->vmods |= t2;
             else
-                XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) & ~t2);
+                act->vmods &= ~t2;
             return True;
         }
         return True;
@@ -1200,7 +1200,7 @@ HandlePrivate(struct xkb_desc * xkb,
                     ACTION("Extra %d bytes ignored\n", len - 6);
                     return False;
                 }
-                strncpy((char *) action->pad, rtrn.str, sizeof action->pad);
+                strncpy((char *) action->data, rtrn.str, sizeof action->data);
             }
             free(rtrn.str);
             return True;
@@ -1215,7 +1215,7 @@ HandlePrivate(struct xkb_desc * xkb,
                 return False;
             }
             ndx = rtrn.uval;
-            if (ndx >= sizeof action->pad)
+            if (ndx >= sizeof action->data)
             {
                 ERROR("The data for a private action is 18 bytes long\n");
                 ACTION("Attempt to use data[%d] ignored\n", ndx);
@@ -1229,7 +1229,7 @@ HandlePrivate(struct xkb_desc * xkb,
                 ACTION("Illegal datum %d ignored\n", rtrn.ival);
                 return False;
             }
-            action->pad[ndx] = rtrn.uval;
+            action->data[ndx] = rtrn.uval;
             return True;
         }
     }
index de2c25b..af231ff 100644 (file)
@@ -119,9 +119,9 @@ InitCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
     info->dflt.interp.flags = 0;
     info->dflt.interp.virtual_mod = XkbNoModifier;
     info->dflt.interp.act.type = XkbSA_NoAction;
-    for (i = 0; i < sizeof info->dflt.interp.act.pad; i++)
+    for (i = 0; i < sizeof info->dflt.interp.act.data; i++)
     {
-        info->dflt.interp.act.pad[i] = 0;
+        info->dflt.interp.act.data[i] = 0;
     }
     ClearIndicatorMapInfo(&info->ledDflt);
     info->ledDflt.defs.fileID = info->fileID;
@@ -147,9 +147,9 @@ ClearCompatInfo(CompatInfo * info, struct xkb_desc * xkb)
     info->dflt.interp.flags = 0;
     info->dflt.interp.virtual_mod = XkbNoModifier;
     info->dflt.interp.act.type = XkbSA_NoAction;
-    for (i = 0; i < sizeof info->dflt.interp.act.pad; i++)
+    for (i = 0; i < sizeof info->dflt.interp.act.data; i++)
     {
-        info->dflt.interp.act.pad[i] = 0;
+        info->dflt.interp.act.data[i] = 0;
     }
     ClearIndicatorMapInfo(&info->ledDflt);
     info->nInterps = 0;