summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-11-22 17:30:14 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-11-22 17:30:14 +1030
commitf9269bebae27bbc9d0e03e02943166b83946623d (patch)
tree8bba08ee9391ec60613a58cf8941e65f18e82d58
parent9ed43eff48201520797f89a12bb3b2f5819bd99f (diff)
DeviceIntRec: move lastx/lasty from valuator into DeviceIntRec.
We free the ValuatorClassRec quite regularly. If a SIGIO is handled while we're swapping device classes, we can bring the server down when we try to access lastx/lasty of the master device.
-rw-r--r--Xext/xtest.c4
-rw-r--r--Xi/warpdevp.c4
-rw-r--r--dix/devices.c6
-rw-r--r--dix/getevents.c28
-rw-r--r--hw/xfree86/common/xf86Xinput.c8
-rw-r--r--include/inputstr.h4
6 files changed, 26 insertions, 28 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c
index bd203b193..371be4e9e 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -444,8 +444,8 @@ ProcXTestFakeInput(client)
(dev, root->drawable.pScreen,
ev->u.keyButtonPointer.rootX,
ev->u.keyButtonPointer.rootY, FALSE);
- dev->valuator->lastx = ev->u.keyButtonPointer.rootX;
- dev->valuator->lasty = ev->u.keyButtonPointer.rootY;
+ dev->lastx = ev->u.keyButtonPointer.rootX;
+ dev->lasty = ev->u.keyButtonPointer.rootY;
break;
case ButtonPress:
case ButtonRelease:
diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c
index a675bdcd1..85fa7a902 100644
--- a/Xi/warpdevp.c
+++ b/Xi/warpdevp.c
@@ -176,8 +176,8 @@ ProcXWarpDevicePointer(ClientPtr client)
}
/* if we don't update the device, we get a jump next time it moves */
- pDev->valuator->lastx = x;
- pDev->valuator->lasty = x;
+ pDev->lastx = x;
+ pDev->lasty = x;
miPointerUpdateSprite(pDev);
/* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it
diff --git a/dix/devices.c b/dix/devices.c
index 7d889a2c1..98cd290e2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -505,9 +505,9 @@ CorePointerProc(DeviceIntPtr pDev, int what)
GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), 2);
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
- pDev->valuator->lastx = pDev->valuator->axisVal[0];
+ pDev->lastx = pDev->valuator->axisVal[0];
pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
- pDev->valuator->lasty = pDev->valuator->axisVal[1];
+ pDev->lasty = pDev->valuator->axisVal[1];
classes->key = pDev->key;
classes->valuator = pDev->valuator;
@@ -1226,8 +1226,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
valc->mode = mode;
valc->axes = (AxisInfoPtr)(valc + 1);
valc->axisVal = (int *)(valc->axes + numAxes);
- valc->lastx = 0;
- valc->lasty = 0;
valc->dxremaind = 0;
valc->dyremaind = 0;
dev->valuator = valc;
diff --git a/dix/getevents.c b/dix/getevents.c
index 585fddd69..6791bd820 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -487,8 +487,8 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
if (master->valuator && pDev->valuator)
{
- pDev->valuator->lastx = master->valuator->lastx;
- pDev->valuator->lasty = master->valuator->lasty;
+ pDev->lastx = master->lastx;
+ pDev->lasty = master->lasty;
}
master->u.lastSlave = pDev;
numEvents++;
@@ -671,8 +671,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
{
CreateClassesChangedEvent(events, master, pDev);
- pDev->valuator->lastx = master->valuator->lastx;
- pDev->valuator->lasty = master->valuator->lasty;
+ pDev->lastx = master->lastx;
+ pDev->lasty = master->lasty;
master->u.lastSlave = pDev;
num_events++;
@@ -728,14 +728,14 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
x = valuators[0];
}
else {
- x = pDev->valuator->lastx;
+ x = pDev->lastx;
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
y = valuators[1 - first_valuator];
}
else {
- y = pDev->valuator->lasty;
+ y = pDev->lasty;
}
}
else {
@@ -744,14 +744,14 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
valuators);
if (first_valuator == 0 && num_valuators >= 1)
- x = pDev->valuator->lastx + valuators[0];
+ x = pDev->lastx + valuators[0];
else
- x = pDev->valuator->lastx;
+ x = pDev->lastx;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
- y = pDev->valuator->lasty + valuators[1 - first_valuator];
+ y = pDev->lasty + valuators[1 - first_valuator];
else
- y = pDev->valuator->lasty;
+ y = pDev->lasty;
}
/* Clip both x and y to the defined limits (usually co-ord space limit). */
@@ -772,12 +772,12 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
- pDev->valuator->lastx = x;
- pDev->valuator->lasty = y;
+ pDev->lastx = x;
+ pDev->lasty = y;
if (master)
{
- master->valuator->lastx = x;
- master->valuator->lasty = y;
+ master->lastx = x;
+ master->lasty = y;
}
if (!coreOnly)
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 810f45b33..7223f1dfa 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -554,14 +554,14 @@ xf86PostMotionEventP(DeviceIntPtr device,
{
dx = valuators[0];
if (is_absolute)
- dx -= device->valuator->lastx;
+ dx -= device->lastx;
}
if (first_valuator == 1 || num_valuators >= 2)
{
dy = valuators[1 - first_valuator];
if (is_absolute)
- dy -= device->valuator->lasty;
+ dy -= device->lasty;
}
if (DGAStealMotionEvent(device, index, dx, dy))
@@ -825,11 +825,11 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
if (axnum == 0) {
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
- dev->valuator->lastx = dev->valuator->axisVal[0];
+ dev->lastx = dev->valuator->axisVal[0];
}
else if (axnum == 1) {
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
- dev->valuator->lasty = dev->valuator->axisVal[1];
+ dev->lasty = dev->valuator->axisVal[1];
}
}
diff --git a/include/inputstr.h b/include/inputstr.h
index 0589097ec..bcb8079b4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -174,8 +174,6 @@ typedef struct _ValuatorClassRec {
AxisInfoPtr axes;
unsigned short numAxes;
int *axisVal;
- int lastx, lasty; /* last event recorded, not posted to
- * client; see dix/devices.c */
int dxremaind, dyremaind; /* for acceleration */
CARD8 mode;
} ValuatorClassRec, *ValuatorClassPtr;
@@ -421,6 +419,8 @@ typedef struct _DeviceIntRec {
DeviceIntPtr master; /* master device */
DeviceIntPtr lastSlave; /* last slave device used */
} u;
+ int lastx, lasty; /* last event recorded, not posted to
+ * client; see dix/devices.c */
} DeviceIntRec;
typedef struct {