Regroup actions into current vs. deprecated, resize vmod Use Xkbc* for all our actions that we intend to keep around, and Xkb* for deprecated ones we can hopefully get rid of, at least internally. While we're at it, make vmods be a uint32_t. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h
index 1057895..2c17304 100644
--- a/include/X11/extensions/XKBcommon.h
+++ b/include/X11/extensions/XKBcommon.h
@@ -28,85 +28,116 @@ authorization from the authors.
#ifndef _XKBCOMMON_H_
#define _XKBCOMMON_H_
+#include <stdint.h>
#include <stdio.h>
#include <X11/Xfuncproto.h>
#include <X11/extensions/XKBstrcommon.h>
#include <X11/extensions/XKBrulescommon.h>
/* Action structures used in the server */
+
+#define XkbcAnyActionDataSize 18
+typedef struct _XkbcAnyAction {
+ unsigned char type;
+ unsigned char pad[XkbcAnyActionDataSize];
+} XkbcAnyAction;
+
typedef struct _XkbcModAction {
unsigned char type;
- unsigned char flags;
- unsigned char mask;
- unsigned char real_mods;
- unsigned int vmods;
+ uint8_t flags;
+ uint32_t mask;
+ uint32_t real_mods;
+ uint32_t vmods;
} XkbcModAction;
-typedef struct _XkbcISOAction {
+typedef struct _XkbcGroupAction {
unsigned char type;
unsigned char flags;
- unsigned char mask;
- unsigned char real_mods;
- /* FIXME: Make this an int. */
- char group_XXX;
- unsigned char affect;
- unsigned int vmods;
-} XkbcISOAction;
+ int16_t group;
+} XkbcGroupAction;
-typedef struct _XkbcPtrAction {
+typedef struct _XkbcISOAction {
unsigned char type;
- unsigned char flags;
- int x;
- int y;
-} XkbcPtrAction;
+ uint8_t flags;
+ int16_t group;
+ uint32_t mask;
+ uint32_t vmods;
+ uint32_t real_mods;
+ uint8_t affect;
+} XkbcISOAction;
typedef struct _XkbcCtrlsAction {
unsigned char type;
unsigned char flags;
- unsigned long ctrls;
+ uint32_t ctrls;
} XkbcCtrlsAction;
-typedef struct _XkbcRedirectKeyAction {
+typedef struct _XkbcDeviceBtnAction {
+ unsigned char type;
+ unsigned char flags;
+ uint16_t device;
+ uint16_t button;
+ uint8_t count;
+} XkbcDeviceBtnAction;
+
+typedef struct _XkbcDeviceValuatorAction {
unsigned char type;
- unsigned char new_key;
- unsigned char mods_mask;
- unsigned char mods;
- unsigned int vmods_mask;
- unsigned int vmods;
-} XkbcRedirectKeyAction;
+ 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 v2_what;
+} XkbcDeviceValuatorAction;
+
+typedef struct _XkbcPtrDfltAction {
+ unsigned char type;
+ uint8_t flags;
+ uint8_t affect;
+ uint8_t value;
+} XkbcPtrDfltAction;
+
+typedef struct _XkbcSwitchScreenAction {
+ unsigned char type;
+ uint8_t flags;
+ uint8_t screen;
+} XkbcSwitchScreenAction;
typedef union _XkbcAction {
- XkbAnyAction any;
- XkbcModAction mods;
- XkbGroupAction group;
- XkbcISOAction iso;
- XkbcPtrAction ptr;
- XkbPtrBtnAction btn;
- XkbPtrDfltAction dflt;
- XkbSwitchScreenAction screen;
- XkbcCtrlsAction ctrls;
- XkbMessageAction msg;
- XkbcRedirectKeyAction redirect;
- XkbDeviceBtnAction devbtn;
- XkbDeviceValuatorAction devval;
+ XkbcAnyAction any;
+ XkbcModAction mods;
+ XkbcGroupAction group;
+ XkbcISOAction iso;
+ XkbcCtrlsAction ctrls;
+ XkbcDeviceBtnAction devbtn;
+ XkbcDeviceValuatorAction devval;
+ XkbcPtrDfltAction dflt;
+ XkbcSwitchScreenAction screen;
+ XkbRedirectKeyAction redirect; /* XXX wholly unnecessary? */
+ XkbPtrAction ptr; /* XXX delete for DeviceValuator */
+ XkbPtrBtnAction btn; /* XXX delete for DeviceBtn */
+ XkbMessageAction msg; /* XXX just delete */
unsigned char type;
} XkbcAction;
typedef struct _XkbcServerMapRec {
unsigned short num_acts;
unsigned short size_acts;
- XkbcAction * acts;
- XkbBehavior * behaviors;
- unsigned short * key_acts;
#if defined(__cplusplus) || defined(c_plusplus)
/* explicit is a C++ reserved word */
unsigned char * c_explicit;
#else
unsigned char * explicit;
#endif
- unsigned char vmods[XkbNumVirtualMods];
- unsigned short * vmodmap;
+
+ XkbcAction *acts;
+ XkbBehavior *behaviors;
+ unsigned short *key_acts;
+ unsigned char *explicits;
+ uint32_t vmods[XkbNumVirtualMods];
+ uint32_t *vmodmap;
} XkbcServerMapRec, *XkbcServerMapPtr;
/* Common keyboard description structure */
diff --git a/src/malloc.c b/src/malloc.c
index 3946d2c..1f814a0 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -221,7 +221,7 @@ XkbcAllocServerMap(XkbcDescPtr xkb, unsigned which, unsigned nNewActions)
if (!map->vmodmap) {
i = xkb->max_key_code + 1;
- map->vmodmap = _XkbTypedCalloc(i, unsigned short);
+ map->vmodmap = _XkbTypedCalloc(i, uint32_t);
if (!map->vmodmap)
return BadAlloc;
}
@@ -770,18 +770,18 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
}
if (xkb->server->vmodmap) {
- unsigned short *prev_vmodmap = xkb->server->vmodmap;
+ uint32_t *prev_vmodmap = xkb->server->vmodmap;
xkb->server->vmodmap = _XkbTypedRealloc(xkb->server->vmodmap,
maxKC + 1,
- unsigned short);
+ uint32_t);
if (!xkb->server->vmodmap) {
_XkbFree(prev_vmodmap);
return BadAlloc;
}
bzero(&xkb->server->vmodmap[xkb->max_key_code],
- tmp * sizeof(unsigned short));
+ tmp * sizeof(uint32_t));
if (changes)
changes->map.changed = _ExtendRange(changes->map.changed,
XkbVirtualModMapMask, maxKC,
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 3f0953d..1076030 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -587,10 +587,10 @@ HandleMovePtr(XkbcDescPtr xkb,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
- XkbcPtrAction *act;
+ XkbPtrAction *act;
Bool absolute;
- act = (XkbcPtrAction *) action;
+ act = (XkbPtrAction *) action;
if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
return ReportActionNotArray(action->type, field);
@@ -606,13 +606,13 @@ HandleMovePtr(XkbcDescPtr xkb,
{
if (absolute)
act->flags |= XkbSA_MoveAbsoluteX;
- act->x = rtrn.ival;
+ XkbSetPtrActionX(act, rtrn.ival);
}
else
{
if (absolute)
act->flags |= XkbSA_MoveAbsoluteY;
- act->y = rtrn.ival;
+ XkbSetPtrActionY(act, rtrn.ival);
}
return True;
}
@@ -813,7 +813,7 @@ HandleISOLock(XkbcDescPtr xkb,
if (CheckGroupField(action->type, value, &flags, &group))
{
act->flags = flags | XkbSA_ISODfltIsGroup;
- XkbSASetGroup(act, group);
+ act->group = group;
return True;
}
return False;
@@ -1036,14 +1036,14 @@ HandleRedirectKey(XkbcDescPtr xkb,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
- XkbcRedirectKeyAction *act;
+ XkbRedirectKeyAction *act;
unsigned t1, t2;
unsigned long tmp;
if (array_ndx != NULL)
return ReportActionNotArray(action->type, field);
- act = (XkbcRedirectKeyAction *) action;
+ act = (XkbRedirectKeyAction *) action;
switch (field)
{
case F_Keycode:
@@ -1069,11 +1069,11 @@ HandleRedirectKey(XkbcDescPtr xkb,
act->mods &= ~(t2 & 0xff);
t2 = (t2 >> 8) & 0xffff;
- act->vmods_mask |= t2;
+ XkbSARedirectSetVModsMask(act, XkbSARedirectVModsMask(act) | t2);
if (field == F_Modifiers)
- act->vmods |= t2;
+ XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) | t2);
else
- act->vmods &= ~t2;
+ XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) & ~t2);
return True;
}
return True;
@@ -1277,7 +1277,7 @@ ApplyActionFactoryDefaults(XkbcAction * action)
{ /* increment default button */
action->dflt.affect = XkbSA_AffectDfltBtn;
action->dflt.flags = 0;
- XkbSASetPtrDfltValue(&action->dflt, 1);
+ action->dflt.value = 1;
}
else if (action->type == XkbSA_ISOLock)
{
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 461c759..1f3a40e 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -118,7 +118,7 @@ InitCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
info->dflt.interp.flags = 0;
info->dflt.interp.virtual_mod = XkbNoModifier;
info->dflt.interp.act.type = XkbSA_NoAction;
- for (i = 0; i < XkbAnyActionDataSize; i++)
+ for (i = 0; i < XkbcAnyActionDataSize; i++)
{
info->dflt.interp.act.data[i] = 0;
}
@@ -146,7 +146,7 @@ ClearCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
info->dflt.interp.flags = 0;
info->dflt.interp.virtual_mod = XkbNoModifier;
info->dflt.interp.act.type = XkbSA_NoAction;
- for (i = 0; i < XkbAnyActionDataSize; i++)
+ for (i = 0; i < XkbcAnyActionDataSize; i++)
{
info->dflt.interp.act.data[i] = 0;
}