aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/getevents.c21
-rw-r--r--xorg-server/dix/window.c2
2 files changed, 18 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);
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index 62f790c08..f4d6ca5d8 100644
--- a/xorg-server/dix/window.c
+++ b/xorg-server/dix/window.c
@@ -921,6 +921,8 @@ DeleteWindow(pointer value, XID wid)
if (pWin->prevSib)
pWin->prevSib->nextSib = pWin->nextSib;
}
+ else
+ pWin->drawable.pScreen->root = NULL;
dixFreeObjectWithPrivates(pWin, PRIVATE_WINDOW);
return Success;
}