summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-07-10 11:10:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-10 11:23:52 +1000
commit3711d68f657c77b947cc4670cc4eac4f62de3af8 (patch)
treee58d62b1ff84d9a69ef1ad22c6f4d070af9d2554
parent08df24555cb432eb0d90a3f63275e9485e777c4c (diff)
Revert "XKB: Sanitise * actions" commits (#19602)
Reverts the following four patches: feb757f384382c7782ceac55 "XKB: Sanitise vmods for redirected keys" b5f49382fe48f0a762d9a15f "XKB: Sanitise ctrls action" 1bd7fd195d85681e722161f8 "XKB: Sanitise pointer actions" 61c508fa78aa08ea2666fde9 "XKB: Sanitise vmods in actions" Strictly speaking, the structs used in the server are not part of the client ABI. Practically, they are as we copy from the wire straight into the structs. Changing the struct sizes breaks various wire/server conversions. Even when the structs have the same size, some internal magic causes conversions to fail. Visible by diffing the output files of: setxkbmap -layout de; xkbcomp -xkb :0 busted.xkb setxkbmap -layout de -print | xkbcomp -xkb - correct.xkb Interestingly enough, busted.xkb is the working one although the output is incorrect. Revert the four offending patches until the exact cause of this breakage can be determined. This patch restores functionality to Level3 modifiers. X.Org Bug 19602 <http://bugs.freedesktop.org/show_bug.cgi?id=19602> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--include/xkbstr.h53
-rw-r--r--xkb/XKBMisc.c8
-rw-r--r--xkb/xkbActions.c18
-rw-r--r--xkb/xkbUtils.c4
-rw-r--r--xkb/xkbtext.c14
-rw-r--r--xkb/xkmread.c28
6 files changed, 84 insertions, 41 deletions
diff --git a/include/xkbstr.h b/include/xkbstr.h
index ec19b30c2..4afe010d2 100644
--- a/include/xkbstr.h
+++ b/include/xkbstr.h
@@ -123,8 +123,14 @@ typedef struct _XkbModAction {
unsigned char flags;
unsigned char mask;
unsigned char real_mods;
- unsigned int vmods;
+ /* FIXME: Make this an int. */
+ unsigned char vmods1;
+ unsigned char vmods2;
} XkbModAction;
+#define XkbModActionVMods(a) ((short) (((a)->vmods1 << 8) | (a)->vmods2))
+#define XkbSetModActionVMods(a,v) \
+ ((a)->vmods1 = (((v) >> 8) & 0xff), \
+ (a)->vmods2 = (v) & 0xff)
typedef struct _XkbGroupAction {
unsigned char type;
@@ -143,15 +149,23 @@ typedef struct _XkbISOAction {
/* FIXME: Make this an int. */
char group_XXX;
unsigned char affect;
- unsigned int vmods;
+ unsigned char vmods1;
+ unsigned char vmods2;
} XkbISOAction;
typedef struct _XkbPtrAction {
unsigned char type;
unsigned char flags;
- int x;
- int y;
+ /* FIXME: Make this an int. */
+ unsigned char high_XXX;
+ unsigned char low_XXX;
+ unsigned char high_YYY;
+ unsigned char low_YYY;
} XkbPtrAction;
+#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))
typedef struct _XkbPtrBtnAction {
unsigned char type;
@@ -180,8 +194,20 @@ typedef struct _XkbSwitchScreenAction {
typedef struct _XkbCtrlsAction {
unsigned char type;
unsigned char flags;
- unsigned long ctrls;
+ /* FIXME: Make this an int. */
+ unsigned char ctrls3;
+ unsigned char ctrls2;
+ unsigned char ctrls1;
+ unsigned char ctrls0;
} XkbCtrlsAction;
+#define XkbActionSetCtrls(a, c) ((a)->ctrls3 = ((c) >> 24) & 0xff, \
+ (a)->ctrls2 = ((c) >> 16) & 0xff, \
+ (a)->ctrls1 = ((c) >> 8) & 0xff, \
+ (a)->ctrls0 = (c) & 0xff)
+#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\
+ (((unsigned int)(a)->ctrls2)<<16)|\
+ (((unsigned int)(a)->ctrls1)<<8)|\
+ ((unsigned int) (a)->ctrls0))
typedef struct _XkbMessageAction {
unsigned char type;
@@ -194,10 +220,23 @@ typedef struct _XkbRedirectKeyAction {
unsigned char new_key;
unsigned char mods_mask;
unsigned char mods;
- unsigned int vmods_mask;
- unsigned int vmods;
+ /* FIXME: Make this an int. */
+ unsigned char vmods_mask0;
+ unsigned char vmods_mask1;
+ unsigned char vmods0;
+ unsigned char vmods1;
} XkbRedirectKeyAction;
+#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\
+ ((unsigned int)(a)->vmods0))
+/* FIXME: This is blatantly not setting vmods. Yeesh. */
+#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)))
+
typedef struct _XkbDeviceBtnAction {
unsigned char type;
unsigned char flags;
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 9cb7061f3..867906046 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -343,7 +343,7 @@ unsigned tmp;
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
if (act->mods.flags&XkbSA_UseModMapMods)
act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= act->mods.vmods)!=0) {
+ if ((tmp= XkbModActionVMods(&act->mods))!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->mods.mask|= tmp;
}
@@ -351,7 +351,7 @@ unsigned tmp;
case XkbSA_ISOLock:
if (act->iso.flags&XkbSA_UseModMapMods)
act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= act->iso.vmods)!=0) {
+ if ((tmp= XkbModActionVMods(&act->iso))!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->iso.mask|= tmp;
}
@@ -666,7 +666,7 @@ unsigned int tmp;
switch (act->type) {
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
- if (((tmp= act->mods.vmods)&changed)!=0) {
+ if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->mods.mask= act->mods.real_mods;
act->mods.mask|= tmp;
@@ -674,7 +674,7 @@ unsigned int tmp;
}
break;
case XkbSA_ISOLock:
- if ((((tmp= act->iso.vmods)!=0)&changed)!=0) {
+ if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->iso.mask= act->iso.real_mods;
act->iso.mask|= tmp;
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 417c6171c..5909b06d2 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -523,15 +523,15 @@ Bool accel;
xkbi->mouseKeysCounter= 0;
xkbi->mouseKey= keycode;
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
- x= pAction->ptr.x;
- y= pAction->ptr.y;
+ x= XkbPtrActionX(&pAction->ptr);
+ y= XkbPtrActionY(&pAction->ptr);
XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
xkbi->mouseKeysFlags= pAction->ptr.flags;
- xkbi->mouseKeysDX= x;
- xkbi->mouseKeysDY= y;
+ xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
+ xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
xkbi->desc->ctrls->mk_delay,
_XkbPtrAccelExpire,(pointer)xkbi);
@@ -671,7 +671,7 @@ XkbEventCauseRec cause;
filter->keycode = keycode;
filter->active = 1;
filter->filterOthers = 0;
- change= pAction->ctrls.ctrls;
+ change= XkbActionCtrls(&pAction->ctrls);
filter->priv = change;
filter->filter = _XkbFilterControls;
filter->upAction = *pAction;
@@ -834,8 +834,8 @@ ProcessInputProc backupproc;
ev.type = ET_KeyPress;
ev.detail.key = pAction->redirect.new_key;
- mask= pAction->redirect.vmods_mask;
- mods= pAction->redirect.vmods;
+ mask= XkbSARedirectVModsMask(&pAction->redirect);
+ mods= XkbSARedirectVMods(&pAction->redirect);
if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
mask|= pAction->redirect.mods_mask;
@@ -865,8 +865,8 @@ ProcessInputProc backupproc;
ev.type = ET_KeyRelease;
ev.detail.key = filter->upAction.redirect.new_key;
- mask= filter->upAction.redirect.vmods_mask;
- mods= filter->upAction.redirect.vmods;
+ mask= XkbSARedirectVModsMask(&filter->upAction.redirect);
+ mods= XkbSARedirectVMods(&filter->upAction.redirect);
if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
mask|= filter->upAction.redirect.mods_mask;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 0bd41cd34..e25247f4e 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -183,13 +183,13 @@ register unsigned tmp;
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
if (act->mods.flags&XkbSA_UseModMapMods)
act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= act->mods.vmods)!=0)
+ if ((tmp= XkbModActionVMods(&act->mods))!=0)
act->mods.mask|= XkbMaskForVMask(xkb,tmp);
break;
case XkbSA_ISOLock:
if (act->iso.flags&XkbSA_UseModMapMods)
act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= act->iso.vmods)!=0)
+ if ((tmp= XkbModActionVMods(&act->iso))!=0)
act->iso.mask|= XkbMaskForVMask(xkb,tmp);
break;
}
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 836d47e28..2f5819985 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -682,7 +682,7 @@ XkbModAction * act;
unsigned tmp;
act= &action->mods;
- tmp= act->vmods;
+ tmp= XkbModActionVMods(act);
TryCopyStr(buf,"modifiers=",sz);
if (act->flags&XkbSA_UseModMapMods)
TryCopyStr(buf,"modMapMods",sz);
@@ -735,8 +735,8 @@ int x,y;
char tbuf[32];
act= &action->ptr;
- x= act->x;
- y= act->y;
+ x= XkbPtrActionX(act);
+ y= XkbPtrActionY(act);
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
sprintf(tbuf,"x=%d",x);
else sprintf(tbuf,"x=+%d",x);
@@ -822,7 +822,7 @@ char tbuf[64];
}
else {
unsigned tmp;
- tmp= act->vmods;
+ tmp= XkbModActionVMods(act);
TryCopyStr(buf,"modifiers=",sz);
if (act->flags&XkbSA_UseModMapMods)
TryCopyStr(buf,"modMapMods",sz);
@@ -894,7 +894,7 @@ unsigned tmp;
char tbuf[32];
act= &action->ctrls;
- tmp= act->ctrls;
+ tmp= XkbActionCtrls(act);
TryCopyStr(buf,"controls=",sz);
if (tmp==0)
TryCopyStr(buf,"none",sz);
@@ -1010,8 +1010,8 @@ unsigned vmods,vmods_mask;
act= &action->redirect;
kc= act->new_key;
- vmods= act->vmods;
- vmods_mask= act->vmods_mask;
+ vmods= XkbSARedirectVMods(act);
+ vmods_mask= XkbSARedirectVModsMask(act);
if (xkb && xkb->names && xkb->names->keys && (kc<=xkb->max_key_code) &&
(xkb->names->keys[kc].name[0]!='\0')) {
char *kn;
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index 206c40382..3e0567928 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -457,7 +457,8 @@ XkbAction *act;
act->mods.flags = wire.actionData[0];
act->mods.mask = wire.actionData[1];
act->mods.real_mods = wire.actionData[2];
- act->mods.vmods = (wire.actionData[3] << 8) | wire.actionData[4];
+ act->mods.vmods1 = wire.actionData[3];
+ act->mods.vmods2 = wire.actionData[4];
break;
case XkbSA_SetGroup:
case XkbSA_LatchGroup:
@@ -467,8 +468,10 @@ XkbAction *act;
break;
case XkbSA_MovePtr:
act->ptr.flags = wire.actionData[0];
- act->ptr.x = (wire.actionData[1] << 8) | wire.actionData[2];
- act->ptr.y = (wire.actionData[3] << 8) | wire.actionData[4];
+ act->ptr.high_XXX = wire.actionData[1];
+ act->ptr.low_XXX = wire.actionData[2];
+ act->ptr.high_YYY = wire.actionData[3];
+ act->ptr.low_YYY = wire.actionData[4];
break;
case XkbSA_PtrBtn:
case XkbSA_LockPtrBtn:
@@ -494,7 +497,8 @@ XkbAction *act;
act->iso.real_mods = wire.actionData[2];
act->iso.group_XXX = wire.actionData[3];
act->iso.affect = wire.actionData[4];
- act->iso.vmods = (wire.actionData[5] << 8) | wire.actionData[6];
+ act->iso.vmods1 = wire.actionData[5];
+ act->iso.vmods2 = wire.actionData[6];
break;
case XkbSA_SwitchScreen:
act->screen.flags = wire.actionData[0];
@@ -503,19 +507,19 @@ XkbAction *act;
case XkbSA_SetControls:
case XkbSA_LockControls:
act->ctrls.flags = wire.actionData[0];
- act->ctrls.ctrls = (wire.actionData[1] << 24) | \
- (wire.actionData[2] << 16) | \
- (wire.actionData[3] << 8) | \
- wire.actionData[4];
+ act->ctrls.ctrls3 = wire.actionData[1];
+ act->ctrls.ctrls2 = wire.actionData[2];
+ act->ctrls.ctrls1 = wire.actionData[3];
+ act->ctrls.ctrls0 = wire.actionData[4];
break;
case XkbSA_RedirectKey:
act->redirect.new_key = wire.actionData[0];
act->redirect.mods_mask = wire.actionData[1];
act->redirect.mods = wire.actionData[2];
- act->redirect.vmods_mask = (wire.actionData[3] << 8) | \
- wire.actionData[4];
- act->redirect.vmods = (wire.actionData[5] << 8) | \
- wire.actionData[6];
+ act->redirect.vmods_mask0 = wire.actionData[3];
+ act->redirect.vmods_mask1 = wire.actionData[4];
+ act->redirect.vmods0 = wire.actionData[4];
+ act->redirect.vmods1 = wire.actionData[5];
break;
case XkbSA_DeviceValuator:
act->devval.device = wire.actionData[0];