XKB: Sanitise pointer actions
Turn two unsigned chars into one int. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
61c508fa78
commit
1bd7fd195d
|
@ -149,16 +149,9 @@ typedef struct _XkbISOAction {
|
||||||
typedef struct _XkbPtrAction {
|
typedef struct _XkbPtrAction {
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
/* FIXME: Make this an int. */
|
int x;
|
||||||
unsigned char high_XXX;
|
int y;
|
||||||
unsigned char low_XXX;
|
|
||||||
unsigned char high_YYY;
|
|
||||||
unsigned char low_YYY;
|
|
||||||
} XkbPtrAction;
|
} 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 {
|
typedef struct _XkbPtrBtnAction {
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
|
|
|
@ -523,15 +523,15 @@ Bool accel;
|
||||||
xkbi->mouseKeysCounter= 0;
|
xkbi->mouseKeysCounter= 0;
|
||||||
xkbi->mouseKey= keycode;
|
xkbi->mouseKey= keycode;
|
||||||
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
|
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
|
||||||
x= XkbPtrActionX(&pAction->ptr);
|
x= pAction->ptr.x;
|
||||||
y= XkbPtrActionY(&pAction->ptr);
|
y= pAction->ptr.y;
|
||||||
XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
|
XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
|
||||||
AccessXCancelRepeatKey(xkbi,keycode);
|
AccessXCancelRepeatKey(xkbi,keycode);
|
||||||
xkbi->mouseKeysAccel= accel&&
|
xkbi->mouseKeysAccel= accel&&
|
||||||
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
|
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
|
||||||
xkbi->mouseKeysFlags= pAction->ptr.flags;
|
xkbi->mouseKeysFlags= pAction->ptr.flags;
|
||||||
xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
|
xkbi->mouseKeysDX= x;
|
||||||
xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
|
xkbi->mouseKeysDY= y;
|
||||||
xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
|
xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
|
||||||
xkbi->desc->ctrls->mk_delay,
|
xkbi->desc->ctrls->mk_delay,
|
||||||
_XkbPtrAccelExpire,(pointer)xkbi);
|
_XkbPtrAccelExpire,(pointer)xkbi);
|
||||||
|
|
|
@ -731,8 +731,8 @@ int x,y;
|
||||||
char tbuf[32];
|
char tbuf[32];
|
||||||
|
|
||||||
act= &action->ptr;
|
act= &action->ptr;
|
||||||
x= XkbPtrActionX(act);
|
x= act->x;
|
||||||
y= XkbPtrActionY(act);
|
y= act->y;
|
||||||
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
|
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
|
||||||
sprintf(tbuf,"x=%d",x);
|
sprintf(tbuf,"x=%d",x);
|
||||||
else sprintf(tbuf,"x=+%d",x);
|
else sprintf(tbuf,"x=+%d",x);
|
||||||
|
|
|
@ -467,10 +467,8 @@ XkbAction *act;
|
||||||
break;
|
break;
|
||||||
case XkbSA_MovePtr:
|
case XkbSA_MovePtr:
|
||||||
act->ptr.flags = wire.actionData[0];
|
act->ptr.flags = wire.actionData[0];
|
||||||
act->ptr.high_XXX = wire.actionData[1];
|
act->ptr.x = (wire.actionData[1] << 8) | wire.actionData[2];
|
||||||
act->ptr.low_XXX = wire.actionData[2];
|
act->ptr.y = (wire.actionData[3] << 8) | wire.actionData[4];
|
||||||
act->ptr.high_YYY = wire.actionData[3];
|
|
||||||
act->ptr.low_YYY = wire.actionData[4];
|
|
||||||
break;
|
break;
|
||||||
case XkbSA_PtrBtn:
|
case XkbSA_PtrBtn:
|
||||||
case XkbSA_LockPtrBtn:
|
case XkbSA_LockPtrBtn:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user