#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 */
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;
}
}
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,
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);
{
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;
}
if (CheckGroupField(action->type, value, &flags, &group))
{
act->flags = flags | XkbSA_ISODfltIsGroup;
- XkbSASetGroup(act, group);
+ act->group = group;
return True;
}
return False;
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:
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;
{ /* 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)
{
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;
}
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;
}