diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-04-25 19:50:12 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2009-01-22 15:08:57 +1100 |
commit | 1bd7fd195d85681e722161f8c636a28f11b40abb (patch) | |
tree | 257da15b8ed79a362fda24f1cc7c4986dddd45fe | |
parent | 61c508fa78aa08ea2666fde950fbafad95d65056 (diff) |
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>
-rw-r--r-- | include/xkbstr.h | 11 | ||||
-rw-r--r-- | xkb/xkbActions.c | 8 | ||||
-rw-r--r-- | xkb/xkbtext.c | 4 | ||||
-rw-r--r-- | xkb/xkmread.c | 6 |
4 files changed, 10 insertions, 19 deletions
diff --git a/include/xkbstr.h b/include/xkbstr.h index c1752a30c..193f27618 100644 --- a/include/xkbstr.h +++ b/include/xkbstr.h @@ -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; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index c46bd8463..cd2688744 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= 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); diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index 213dbb7aa..debc2f9c6 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -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); diff --git a/xkb/xkmread.c b/xkb/xkmread.c index ff0537e10..9ba14c41f 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -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: |