xserver: Branch 'mpx' - 2 commits
Peter Hutterer
whot at kemper.freedesktop.org
Thu Nov 22 00:38:01 PST 2007
Xext/xtest.c | 4 ++--
Xi/exevents.c | 1 +
Xi/warpdevp.c | 4 ++--
dix/devices.c | 6 ++----
dix/getevents.c | 28 ++++++++++++++--------------
hw/xfree86/common/xf86Xinput.c | 8 ++++----
include/inputstr.h | 4 ++--
7 files changed, 27 insertions(+), 28 deletions(-)
New commits:
commit 691da031319dc59b9496101358c267f317abfd1e
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Thu Nov 22 17:44:39 2007 +1030
Xi: allocate motion history for master device.
We're still missing out on the actual content of the history but at least this
way we don't segfault.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index d72f00a..8c8cdfd 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -338,6 +338,7 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
FatalError("[Xi] no memory for class shift.\n");
memcpy(v, from->valuator, sizeof(ValuatorClassRec));
v->motion = NULL;
+ AllocateMotionHistory(to); /*XXX should be copied somehow */
v->axes = (AxisInfoPtr)&v[1];
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
commit f9269bebae27bbc9d0e03e02943166b83946623d
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Thu Nov 22 17:30:14 2007 +1030
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.
diff --git a/Xext/xtest.c b/Xext/xtest.c
index bd203b1..371be4e 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 a675bdc..85fa7a9 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 7d889a2..98cd290 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 585fddd..6791bd8 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 810f45b..7223f1d 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 0589097..bcb8079 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 {
More information about the xorg-commit
mailing list