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 {
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
/* FIXME: Make this an int. */
|
||||
unsigned char high_XXX;
|
||||
unsigned char low_XXX;
|
||||
unsigned char high_YYY;
|
||||
unsigned char low_YYY;
|
||||
int x;
|
||||
int y;
|
||||
} 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;
|
||||
|
|
|
@ -523,15 +523,15 @@ Bool accel;
|
|||
xkbi->mouseKeysCounter= 0;
|
||||
xkbi->mouseKey= keycode;
|
||||
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
|
||||
x= XkbPtrActionX(&pAction->ptr);
|
||||
y= XkbPtrActionY(&pAction->ptr);
|
||||
x= pAction->ptr.x;
|
||||
y= pAction->ptr.y;
|
||||
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= XkbPtrActionX(&pAction->ptr);
|
||||
xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
|
||||
xkbi->mouseKeysDX= x;
|
||||
xkbi->mouseKeysDY= y;
|
||||
xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
|
||||
xkbi->desc->ctrls->mk_delay,
|
||||
_XkbPtrAccelExpire,(pointer)xkbi);
|
||||
|
|
|
@ -731,8 +731,8 @@ int x,y;
|
|||
char tbuf[32];
|
||||
|
||||
act= &action->ptr;
|
||||
x= XkbPtrActionX(act);
|
||||
y= XkbPtrActionY(act);
|
||||
x= act->x;
|
||||
y= act->y;
|
||||
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
|
||||
sprintf(tbuf,"x=%d",x);
|
||||
else sprintf(tbuf,"x=+%d",x);
|
||||
|
|
|
@ -467,10 +467,8 @@ XkbAction *act;
|
|||
break;
|
||||
case XkbSA_MovePtr:
|
||||
act->ptr.flags = wire.actionData[0];
|
||||
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];
|
||||
act->ptr.x = (wire.actionData[1] << 8) | wire.actionData[2];
|
||||
act->ptr.y = (wire.actionData[3] << 8) | wire.actionData[4];
|
||||
break;
|
||||
case XkbSA_PtrBtn:
|
||||
case XkbSA_LockPtrBtn:
|
||||
|
|
Loading…
Reference in New Issue
Block a user