diff options
author | marha <marha@users.sourceforge.net> | 2010-08-20 07:50:24 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-08-20 07:50:24 +0000 |
commit | 3799f1085abb02c5721f4c33f42c063edb68029d (patch) | |
tree | 8a7f504e9bd1099a8508d4ffe2eda47ad9f5c452 /xorg-server/dix/getevents.c | |
parent | 07d3578ce63d87c9a87d54d85f5c8057d30fdc58 (diff) | |
parent | 0ef233ddca61b9f3c72aa5f806ee818348f3aa20 (diff) | |
download | vcxsrv-3799f1085abb02c5721f4c33f42c063edb68029d.tar.gz vcxsrv-3799f1085abb02c5721f4c33f42c063edb68029d.tar.bz2 vcxsrv-3799f1085abb02c5721f4c33f42c063edb68029d.zip |
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/dix/getevents.c')
-rw-r--r-- | xorg-server/dix/getevents.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/xorg-server/dix/getevents.c b/xorg-server/dix/getevents.c index 92e96b0bb..171868e26 100644 --- a/xorg-server/dix/getevents.c +++ b/xorg-server/dix/getevents.c @@ -927,17 +927,19 @@ GetKeyboardEvents(EventList *events, DeviceIntPtr pDev, int type, int key_code) int
GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
int key_code, int first_valuator,
- int num_valuators, int *valuators) {
+ int num_valuators, int *valuators_in) {
int num_events = 0;
CARD32 ms = 0;
DeviceEvent *event;
RawDeviceEvent *raw;
+ int valuators[MAX_VALUATORS];
/* refuse events from disabled devices */
if (!pDev || !pDev->enabled)
return 0;
if (!events ||!pDev->key || !pDev->focus || !pDev->kbdfeed ||
+ num_valuators > MAX_VALUATORS ||
(type != KeyPress && type != KeyRelease) ||
(key_code < 8 || key_code > 255))
return 0;
@@ -962,6 +964,8 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type, events++;
num_events++;
+ memcpy(valuators, valuators_in, num_valuators * sizeof(int));
+
init_raw(pDev, raw, ms, type, key_code);
set_raw_valuators(raw, first_valuator, num_valuators, valuators,
raw->valuators.data_raw);
@@ -1082,7 +1086,7 @@ transformAbsolute(DeviceIntPtr dev, int v[MAX_VALUATORS]) int
GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int first_valuator, int num_valuators,
- int *valuators) {
+ int *valuators_in) {
int num_events = 1;
CARD32 ms;
DeviceEvent *event;
@@ -1091,6 +1095,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, cx, cy; /* only screen coordinates */
float x_frac = 0.0, y_frac = 0.0, cx_frac, cy_frac;
ScreenPtr scr = miPointerGetScreen(pDev);
+ int valuators[MAX_VALUATORS];
/* refuse events from disabled devices */
if (!pDev->enabled)
@@ -1099,6 +1104,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, ms = GetTimeInMillis(); /* before pointer update to help precision */
if (!scr || !pDev->valuator || first_valuator < 0 ||
+ num_valuators > MAX_VALUATORS ||
((num_valuators + first_valuator) > pDev->valuator->numAxes) ||
(type != MotionNotify && type != ButtonPress && type != ButtonRelease) ||
(type != MotionNotify && !pDev->button) ||
@@ -1112,6 +1118,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, events++;
num_events++;
+ memcpy(valuators, valuators_in, num_valuators * sizeof(int));
+
init_raw(pDev, raw, ms, type, buttons);
set_raw_valuators(raw, first_valuator, num_valuators, valuators,
raw->valuators.data_raw);
@@ -1198,10 +1206,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, */
int
GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type,
- int first_valuator, int num_valuators, int *valuators)
+ int first_valuator, int num_valuators, int *valuators_in)
{
int num_events = 1;
DeviceEvent *event;
+ int valuators[MAX_VALUATORS];
/* refuse events from disabled devices */
if (!pDev->enabled)
@@ -1217,7 +1226,7 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, num_valuators = 0;
/* You fail. */
- if (first_valuator < 0 ||
+ if (first_valuator < 0 || num_valuators > MAX_VALUATORS ||
(num_valuators + first_valuator) > pDev->valuator->numAxes)
return 0;
@@ -1227,8 +1236,10 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type, init_event(pDev, event, GetTimeInMillis());
event->type = (type == ProximityIn) ? ET_ProximityIn : ET_ProximityOut;
- if (num_valuators)
+ if (num_valuators) {
+ memcpy(valuators, valuators_in, num_valuators * sizeof(int));
clipValuators(pDev, first_valuator, num_valuators, valuators);
+ }
set_valuators(pDev, event, first_valuator, num_valuators, valuators);
|