xserver: Branch 'mpx' - 8 commits
Peter Hutterer
whot at kemper.freedesktop.org
Mon May 26 01:04:42 PDT 2008
Xi/exevents.c | 6 -
Xi/gtmotion.c | 14 +--
dix/devices.c | 24 +----
dix/getevents.c | 181 ++++++++++++++++++++++++++++++++++++-----
hw/dmx/input/dmxxinput.c | 5 -
hw/kdrive/src/kinput.c | 1
hw/vfb/InitInput.c | 2
hw/xfree86/common/xf86Helper.c | 4
hw/xfree86/common/xf86Xinput.h | 2
hw/xnest/Pointer.c | 1
include/input.h | 14 ---
include/inputstr.h | 7 -
12 files changed, 185 insertions(+), 76 deletions(-)
New commits:
commit 5fe57787faa2ea4f2f57b25455d200bf924206d6
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Mon May 26 17:23:34 2008 +0930
dix: store the absolute values in the motion history.
The core protocol requires absolute values and it's a bit hard to get them if
we only have relative ones in the history. Switch the motion history to
absolute, and if we really need the relative values, we can probably generated
them from the abs. ones in the future.
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 7cc5c26..ce1312e 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -119,7 +119,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.nEvents = 0;
rep.axes = axes;
- rep.mode = v->mode & DeviceMode;
+ rep.mode = Absolute; /* XXX we don't do relative at the moment */
rep.length = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
diff --git a/dix/getevents.c b/dix/getevents.c
index 643e977..b5657a8 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1003,10 +1003,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
y = rescaleValuatorAxis(pDev->last.valuators[1], NULL,
pDev->valuator->axes + 1, scr->height);
- updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+ updateMotionHistory(pDev, ms, first_valuator, num_valuators,
+ &pDev->last.valuators[first_valuator]);
if (master)
updateMotionHistory(master, ms, first_valuator, num_valuators,
- valuators);
+ &pDev->last.valuators[first_valuator]);
/* Update the valuators with the true value sent to the client*/
if(v0) *v0 = x;
commit 1883485edd7eb90c0b76bca41c71e26ae2c0b91a
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Mon May 26 16:35:23 2008 +0930
If core motion history is required, scale back to screen coords and INT16.
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 8b59d67..7cc5c26 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -135,7 +135,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
size = sizeof(Time) + (axes * sizeof(INT32));
rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,/* XXX */
start.milliseconds, stop.milliseconds,
- (ScreenPtr) NULL);
+ (ScreenPtr) NULL, FALSE);
}
if (rep.nEvents > 0) {
length = (rep.nEvents * size + 3) >> 2;
diff --git a/dix/devices.c b/dix/devices.c
index 9db276b..60d48b2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2308,12 +2308,9 @@ ProcGetMotionEvents(ClientPtr client)
{
if (CompareTimeStamps(stop, currentTime) == LATER)
stop = currentTime;
- coords = (xTimecoord *)xalloc(mouse->valuator->numMotionEvents
- * sizeof(xTimecoord));
- if (!coords)
- return BadAlloc;
- count = GetMotionHistory(mouse, coords, start.milliseconds,
- stop.milliseconds, pWin->drawable.pScreen);
+ count = GetMotionHistory(mouse, &coords, start.milliseconds,
+ stop.milliseconds, pWin->drawable.pScreen,
+ TRUE);
xmin = pWin->drawable.x - wBorderWidth (pWin);
xmax = pWin->drawable.x + (int)pWin->drawable.width +
wBorderWidth (pWin);
diff --git a/dix/getevents.c b/dix/getevents.c
index 349823d..643e977 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -258,15 +258,16 @@ AllocateMotionHistory(DeviceIntPtr pDev)
pDev->name, size * pDev->valuator->numMotionEvents);
}
-
/**
* Dump the motion history between start and stop into the supplied buffer.
* Only records the event for a given screen in theory, but in practice, we
* sort of ignore this.
+ *
+ * If core is set, we only generate x/y, in INT16, scaled to screen coords.
*/
_X_EXPORT int
GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
- unsigned long stop, ScreenPtr pScreen)
+ unsigned long stop, ScreenPtr pScreen, BOOL core)
{
char *ibuff = NULL, *obuff;
int i = 0, ret = 0;
@@ -277,10 +278,15 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
int dflt;
AxisInfo from, *to; /* for scaling */
CARD32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
+ INT16 *corebuf;
+ AxisInfo core_axis = {0};
if (!pDev->valuator || !pDev->valuator->numMotionEvents)
return 0;
+ if (core && !pScreen)
+ return 0;
+
if (pDev->isMaster)
size = (sizeof(INT32) * 3 * MAX_VALUATORS) + sizeof(Time);
else
@@ -304,7 +310,36 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
return ret;
}
else if (current >= start) {
- if (pDev->isMaster)
+ if (core)
+ {
+ memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
+
+ icbuf = (INT32*)(ibuff + sizeof(Time));
+ corebuf = (INT16*)(obuff + sizeof(Time));
+
+ /* fetch x coordinate + range */
+ memcpy(&from.min_value, icbuf++, sizeof(INT32));
+ memcpy(&from.max_value, icbuf++, sizeof(INT32));
+ memcpy(&coord, icbuf++, sizeof(INT32));
+
+ /* scale to screen coords */
+ to = &core_axis;
+ to->max_value = pScreen->width;
+ coord = rescaleValuatorAxis(coord, &from, to, pScreen->width);
+
+ memcpy(corebuf, &coord, sizeof(INT16));
+ corebuf++;
+
+ /* fetch y coordinate + range */
+ memcpy(&from.min_value, icbuf++, sizeof(INT32));
+ memcpy(&from.max_value, icbuf++, sizeof(INT32));
+ memcpy(&coord, icbuf++, sizeof(INT32));
+
+ to->max_value = pScreen->height;
+ coord = rescaleValuatorAxis(coord, &from, to, pScreen->height);
+ memcpy(corebuf, &coord, sizeof(INT16));
+
+ } else if (pDev->isMaster)
{
memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
@@ -345,7 +380,10 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
/* don't advance by size here. size may be different to the
* actually written size if the MD has less valuators than MAX */
- obuff += (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ if (core)
+ obuff += sizeof(INT32) + sizeof(Time);
+ else
+ obuff += (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
ret++;
}
}
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 1dd0bbc..eaa6c76 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -2933,9 +2933,9 @@ xf86MotionHistoryAllocate(LocalDevicePtr local)
_X_EXPORT int
xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
- unsigned long stop, ScreenPtr pScreen)
+ unsigned long stop, ScreenPtr pScreen, BOOL core)
{
- return GetMotionHistory(pDev, buff, start, stop, pScreen);
+ return GetMotionHistory(pDev, buff, start, stop, pScreen, core);
}
_X_EXPORT void
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index dd72ec7..02f657d 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -197,7 +197,7 @@ void xf86DeleteInput(InputInfoPtr pInp, int flags);
void xf86MotionHistoryAllocate(LocalDevicePtr local);
int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
+ ScreenPtr pScreen, BOOL core);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
diff --git a/include/input.h b/include/input.h
index 3071d75..a816385 100644
--- a/include/input.h
+++ b/include/input.h
@@ -486,7 +486,8 @@ extern int GetMotionHistory(
xTimecoord **buff,
unsigned long start,
unsigned long stop,
- ScreenPtr pScreen);
+ ScreenPtr pScreen,
+ BOOL core);
extern void SwitchCorePointer(DeviceIntPtr pDev);
commit 0b88510069bdf6d020d73b424f62c2923c0db4a4
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Mon May 26 13:53:45 2008 +0930
Ensure the motion history is merged for master devices.
Add each event to the master's MH as well as to the SDs. In the MD, store
min/max and the actual value. When retrieving the MH, rescale all coordinates
to the current coordinate range and only post those valuators that are
currently active on the device.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index f13959f..725c578 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -571,12 +571,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
v = to->valuator;
if (!v)
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->first_motion = 0;
- v->last_motion = 0;
+ v->numAxes = from->valuator->numAxes;
v->axes = (AxisInfoPtr)&v[1];
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 7994890..8b59d67 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -132,12 +132,8 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
stop = currentTime;
num_events = v->numMotionEvents;
if (num_events) {
- size = sizeof(Time) + (axes * sizeof(INT32));
- tsize = num_events * size;
- coords = (INT32 *) xalloc(tsize);
- if (!coords)
- return BadAlloc;
- rep.nEvents = GetMotionHistory(dev, (xTimecoord *) coords,/* XXX */
+ size = sizeof(Time) + (axes * sizeof(INT32));
+ rep.nEvents = GetMotionHistory(dev, (xTimecoord **) &coords,/* XXX */
start.milliseconds, stop.milliseconds,
(ScreenPtr) NULL);
}
diff --git a/dix/getevents.c b/dix/getevents.c
index 6e723f8..349823d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -253,6 +253,9 @@ AllocateMotionHistory(DeviceIntPtr pDev)
pDev->valuator->motion = xcalloc(pDev->valuator->numMotionEvents, size);
pDev->valuator->first_motion = 0;
pDev->valuator->last_motion = 0;
+ if (!pDev->valuator->motion)
+ ErrorF("[dix] %s: Failed to alloc motion history (%d bytes).\n",
+ pDev->name, size * pDev->valuator->numMotionEvents);
}
@@ -262,18 +265,32 @@ AllocateMotionHistory(DeviceIntPtr pDev)
* sort of ignore this.
*/
_X_EXPORT int
-GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
unsigned long stop, ScreenPtr pScreen)
{
- char *ibuff = NULL, *obuff = (char *) buff;
+ char *ibuff = NULL, *obuff;
int i = 0, ret = 0;
+ int j, coord;
Time current;
/* The size of a single motion event. */
- int size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ int size;
+ int dflt;
+ AxisInfo from, *to; /* for scaling */
+ CARD32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
if (!pDev->valuator || !pDev->valuator->numMotionEvents)
return 0;
+ if (pDev->isMaster)
+ size = (sizeof(INT32) * 3 * MAX_VALUATORS) + sizeof(Time);
+ else
+ size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+
+ *buff = xalloc(size * pDev->valuator->numMotionEvents);
+ if (!(*buff))
+ return 0;
+ obuff = *buff;
+
for (i = pDev->valuator->first_motion;
i != pDev->valuator->last_motion;
i = (i + 1) % pDev->valuator->numMotionEvents) {
@@ -287,8 +304,48 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
return ret;
}
else if (current >= start) {
- memcpy(obuff, ibuff, size);
- obuff += size;
+ if (pDev->isMaster)
+ {
+ memcpy(obuff, ibuff, sizeof(Time)); /* copy timestamp */
+
+ ocbuf = (INT32*)(obuff + sizeof(Time));
+ icbuf = (INT32*)(ibuff + sizeof(Time));
+ for (j = 0; j < MAX_VALUATORS; j++)
+ {
+ if (j >= pDev->valuator->numAxes)
+ break;
+
+ /* fetch min/max/coordinate */
+ memcpy(&from.min_value, icbuf++, sizeof(INT32));
+ memcpy(&from.max_value, icbuf++, sizeof(INT32));
+ memcpy(&coord, icbuf++, sizeof(INT32));
+
+ to = (j < pDev->valuator->numAxes) ? &pDev->valuator->axes[j] : NULL;
+
+ /* x/y scaled to screen if no range is present */
+ if (j == 0 && (from.max_value < from.min_value))
+ from.max_value = pScreen->width;
+ else if (j == 1 && (from.max_value < from.min_value))
+ from.max_value = pScreen->height;
+
+ if (j == 0 && (to->max_value < to->min_value))
+ dflt = pScreen->width;
+ else if (j == 1 && (to->max_value < to->min_value))
+ dflt = pScreen->height;
+ else
+ dflt = 0;
+
+ /* scale from stored range into current range */
+ coord = rescaleValuatorAxis(coord, &from, to, 0);
+ memcpy(ocbuf, &coord, sizeof(INT32));
+ ocbuf++;
+ }
+ } else
+ memcpy(obuff, ibuff, size);
+
+ /* don't advance by size here. size may be different to the
+ * actually written size if the MD has less valuators than MAX */
+ obuff += (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
ret++;
}
}
@@ -300,29 +357,63 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
/**
* Update the motion history for a specific device, with the list of
* valuators.
+ *
+ * Layout of the history buffer:
+ * for SDs: [time] [val0] [val1] ... [valn]
+ * for MDs: [time] [min_val0] [max_val0] [val0] [min_val1] ... [valn]
+ *
+ * For events that have some valuators unset (first_valuator > 0):
+ * min_val == max_val == val == 0.
*/
static void
updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
int num_valuators, int *valuators)
{
char *buff = (char *) pDev->valuator->motion;
+ ValuatorClassPtr v;
+ int i;
if (!pDev->valuator->numMotionEvents)
return;
- buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
+ v = pDev->valuator;
+ if (pDev->isMaster)
+ {
+ buff += ((sizeof(INT32) * 3 * MAX_VALUATORS) + sizeof(CARD32)) *
+ v->last_motion;
+
+ memcpy(buff, &ms, sizeof(Time));
+ buff += sizeof(Time);
+
+ memset(buff, 0, sizeof(INT32) * 3 * MAX_VALUATORS);
+ buff += 3 * sizeof(INT32) * first_valuator;
+
+ for (i = first_valuator; i < first_valuator + num_valuators; i++)
+ {
+ memcpy(buff, &v->axes[i].min_value, sizeof(INT32));
+ buff += sizeof(INT32);
+ memcpy(buff, &v->axes[i].max_value, sizeof(INT32));
+ buff += sizeof(INT32);
+ memcpy(buff, &valuators[i - first_valuator], sizeof(INT32));
+ buff += sizeof(INT32);
+ }
+ } else
+ {
+
+ buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
pDev->valuator->last_motion;
- memcpy(buff, &ms, sizeof(Time));
- buff += sizeof(Time);
- bzero(buff, sizeof(INT32) * pDev->valuator->numAxes);
+ memcpy(buff, &ms, sizeof(Time));
+ buff += sizeof(Time);
- buff += sizeof(INT32) * first_valuator;
- memcpy(buff, valuators, sizeof(INT32) * num_valuators);
+ memset(buff, 0, sizeof(INT32) * pDev->valuator->numAxes);
+ buff += sizeof(INT32) * first_valuator;
- pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
- pDev->valuator->numMotionEvents;
+ memcpy(buff, valuators, sizeof(INT32) * num_valuators);
+ }
+ pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
+ pDev->valuator->numMotionEvents;
/* If we're wrapping around, just keep the circular buffer going. */
if (pDev->valuator->first_motion == pDev->valuator->last_motion)
pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
@@ -875,6 +966,9 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
pDev->valuator->axes + 1, scr->height);
updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+ if (master)
+ updateMotionHistory(master, ms, first_valuator, num_valuators,
+ valuators);
/* Update the valuators with the true value sent to the client*/
if(v0) *v0 = x;
diff --git a/include/input.h b/include/input.h
index 70f3de6..3071d75 100644
--- a/include/input.h
+++ b/include/input.h
@@ -483,7 +483,7 @@ extern void AllocateMotionHistory(
extern int GetMotionHistory(
DeviceIntPtr pDev,
- xTimecoord *buff,
+ xTimecoord **buff,
unsigned long start,
unsigned long stop,
ScreenPtr pScreen);
commit d22c25bda450f6f1dfa634f0f72b32c4bec429cd
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Mon May 26 09:26:18 2008 +0930
dix: Allocate MD's motion history to be large enough for potential valuators
Since we can't predict how many valuators may be in a future SD attached to an
MD, we need to preallocate a history buffer that is large enough to keep
MAX_VALUATORS coordinates per event.
In addition, the history buffer needs to memorize the coordinate ranges at the
time, thus requiring MDs to store (min_val, max_val, current_val, time)
instead of (current_val, time) for each motion history entry.
This commit only fixes the allocation.
diff --git a/dix/getevents.c b/dix/getevents.c
index dda681d..6e723f8 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -232,15 +232,25 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
_X_EXPORT void
AllocateMotionHistory(DeviceIntPtr pDev)
{
+ int size;
if (pDev->valuator->motion)
xfree(pDev->valuator->motion);
if (pDev->valuator->numMotionEvents < 1)
return;
- pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes)
- + sizeof(Time)) *
- pDev->valuator->numMotionEvents);
+ /* An MD must have a motion history size large enough to keep all
+ * potential valuators, plus the respective range of the valuators.
+ * 3 * INT32 for (min_val, max_val, curr_val))
+ */
+ if (pDev->isMaster)
+ size = sizeof(INT32) * 3 * MAX_VALUATORS;
+ else
+ size = sizeof(INT32) * pDev->valuator->numAxes;
+
+ size += sizeof(Time);
+
+ pDev->valuator->motion = xcalloc(pDev->valuator->numMotionEvents, size);
pDev->valuator->first_motion = 0;
pDev->valuator->last_motion = 0;
}
diff --git a/include/inputstr.h b/include/inputstr.h
index 86b1667..5e745b3 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -167,9 +167,9 @@ typedef struct _ValuatorClassRec {
int numMotionEvents;
int first_motion;
int last_motion;
- void *motion; /* motion history buffer */
-
- WindowPtr motionHintWindow;
+ void *motion; /* motion history buffer. Different layout
+ for MDs and SDs!*/
+ WindowPtr motionHintWindow;
AxisInfoPtr axes;
unsigned short numAxes;
commit 0877de13ac6ddfb55108aa3456d47f970c6c442c
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Sun May 25 22:49:54 2008 +0930
Remove GetMotionProc from ValuatorClassRec.
With the MD/SD device hierarchy we need control over the generation of the
motion history as well as the conversion later before posting it to the
client. So let's not let the drivers change it.
No x.org driver currently uses it anyway, linuxwacom doesn't either so dumping
it seems safe enough.
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 4f4d7cb..7994890 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -137,9 +137,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
coords = (INT32 *) xalloc(tsize);
if (!coords)
return BadAlloc;
- rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
- start.milliseconds, stop.milliseconds,
- (ScreenPtr) NULL);
+ rep.nEvents = GetMotionHistory(dev, (xTimecoord *) coords,/* XXX */
+ start.milliseconds, stop.milliseconds,
+ (ScreenPtr) NULL);
}
if (rep.nEvents > 0) {
length = (rep.nEvents * size + 3) >> 2;
diff --git a/dix/devices.c b/dix/devices.c
index 2521186..9db276b 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -492,7 +492,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
for (i = 1; i <= 32; i++)
map[i] = i;
InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
- GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
+ (PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), 2);
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
pDev->last.valuators[0] = pDev->valuator->axisVal[0];
@@ -643,7 +643,7 @@ FreeDeviceClass(int type, pointer *class)
ValuatorClassPtr *v = (ValuatorClassPtr*)class;
/* Counterpart to 'biggest hack ever' in init. */
- if ((*v)->motion && (*v)->GetMotionProc == GetMotionHistory)
+ if ((*v)->motion)
xfree((*v)->motion);
xfree((*v));
break;
@@ -1157,7 +1157,6 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
_X_EXPORT Bool
InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
- ValuatorMotionProcPtr motionProc,
int numMotionEvents, int mode)
{
int i;
@@ -1175,7 +1174,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
valc->motion = NULL;
valc->first_motion = 0;
valc->last_motion = 0;
- valc->GetMotionProc = motionProc;
valc->numMotionEvents = numMotionEvents;
valc->motionHintWindow = NullWindow;
@@ -1187,9 +1185,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
valc->dyremaind = 0;
dev->valuator = valc;
- /* biggest hack ever. */
- if (motionProc == GetMotionHistory)
- AllocateMotionHistory(dev);
+ AllocateMotionHistory(dev);
for (i=0; i<numAxes; i++) {
InitValuatorAxisStruct(dev, i, NO_AXIS_LIMITS, NO_AXIS_LIMITS,
@@ -1414,14 +1410,13 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
_X_EXPORT Bool
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
- ValuatorMotionProcPtr motionProc,
PtrCtrlProcPtr controlProc, int numMotionEvents,
int numAxes)
{
DeviceIntPtr dev = (DeviceIntPtr)device;
return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
- InitValuatorClassDeviceStruct(dev, numAxes, motionProc,
+ InitValuatorClassDeviceStruct(dev, numAxes,
numMotionEvents, 0) &&
InitPtrFeedbackClassDeviceStruct(dev, controlProc));
}
@@ -2317,10 +2312,8 @@ ProcGetMotionEvents(ClientPtr client)
* sizeof(xTimecoord));
if (!coords)
return BadAlloc;
- count = (*mouse->valuator->GetMotionProc) (mouse, coords,
- start.milliseconds,
- stop.milliseconds,
- pWin->drawable.pScreen);
+ count = GetMotionHistory(mouse, coords, start.milliseconds,
+ stop.milliseconds, pWin->drawable.pScreen);
xmin = pWin->drawable.x - wBorderWidth (pWin);
xmax = pWin->drawable.x + (int)pWin->drawable.width +
wBorderWidth (pWin);
diff --git a/dix/getevents.c b/dix/getevents.c
index 7c7c63f..dda681d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -238,8 +238,8 @@ AllocateMotionHistory(DeviceIntPtr pDev)
if (pDev->valuator->numMotionEvents < 1)
return;
- pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
- sizeof(Time)) *
+ pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes)
+ + sizeof(Time)) *
pDev->valuator->numMotionEvents);
pDev->valuator->first_motion = 0;
pDev->valuator->last_motion = 0;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index c6724e4..005465f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -438,7 +438,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
- GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes);
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 3b001ee..2af3c64 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -295,7 +295,7 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
map[1] = 1;
map[2] = 2;
map[3] = 3;
- InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
+ InitPointerDeviceStruct(pDev, map, 3,
(PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
break;
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index b0de13b..8f764a6 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -56,7 +56,6 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff)
for (i = 0; i <= nmap; i++)
map[i] = i; /* buttons are already mapped */
InitPointerDeviceStruct(&pDev->public, map, nmap,
- GetMotionHistory,
xnestChangePointerControl,
GetMotionHistorySize(), 2);
break;
diff --git a/include/input.h b/include/input.h
index 9b92ea3..70f3de6 100644
--- a/include/input.h
+++ b/include/input.h
@@ -274,17 +274,9 @@ extern Bool InitButtonClassDeviceStruct(
int /*numButtons*/,
CARD8* /*map*/);
-typedef int (*ValuatorMotionProcPtr)(
- DeviceIntPtr /*pdevice*/,
- xTimecoord * /*coords*/,
- unsigned long /*start*/,
- unsigned long /*stop*/,
- ScreenPtr /*pScreen*/);
-
extern Bool InitValuatorClassDeviceStruct(
DeviceIntPtr /*device*/,
int /*numAxes*/,
- ValuatorMotionProcPtr /* motionProc */,
int /*numMotionEvents*/,
int /*mode*/);
@@ -358,7 +350,6 @@ extern Bool InitPointerDeviceStruct(
DevicePtr /*device*/,
CARD8* /*map*/,
int /*numButtons*/,
- ValuatorMotionProcPtr /*motionProc*/,
PtrCtrlProcPtr /*controlProc*/,
int /*numMotionEvents*/,
int /*numAxes*/);
diff --git a/include/inputstr.h b/include/inputstr.h
index d26eb13..86b1667 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -164,11 +164,10 @@ typedef struct _AxisInfo {
} AxisInfo, *AxisInfoPtr;
typedef struct _ValuatorClassRec {
- ValuatorMotionProcPtr GetMotionProc;
int numMotionEvents;
int first_motion;
int last_motion;
- void *motion;
+ void *motion; /* motion history buffer */
WindowPtr motionHintWindow;
commit 00b4339168c10dd4ce026deb8e04bfb63dfd11dc
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Sun May 25 22:34:11 2008 +0930
dmx: remove some #if 0'd code.
diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c
index 97bea75..692e647 100644
--- a/hw/dmx/input/dmxxinput.c
+++ b/hw/dmx/input/dmxxinput.c
@@ -98,13 +98,8 @@ int ChangePointerDevice(DeviceIntPtr old_dev,
}
dmxLocalNew->savedMotionProc = new_dev->valuator->GetMotionProc;
dmxLocalNew->savedMotionEvents = new_dev->valuator->numMotionEvents;
-#if 00 /*BP*/
- new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
- new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
-#else
new_dev->valuator->GetMotionProc = GetMotionHistory;
new_dev->valuator->numMotionEvents = GetMaximumEventsNum();
-#endif
/* Switch our notion of core pointer */
dmxLocalOld->isCore = 0;
dmxLocalOld->sendsCore = dmxLocalOld->savedSendsCore;
commit 096117cf023dc92dcadc91677931fc6ad1feb4a0
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Sun May 25 10:38:33 2008 +0930
Xi: reset motion history when swapping device classes.
This isn't really the correct solution, but it'll have to do until I figured
out how to transfer the history over correctly.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index a48ba11..f13959f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -574,6 +574,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
memcpy(v, from->valuator, sizeof(ValuatorClassRec));
v->motion = NULL;
AllocateMotionHistory(to); /*XXX should be copied somehow */
+ v->first_motion = 0;
+ v->last_motion = 0;
v->axes = (AxisInfoPtr)&v[1];
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
commit ba557e0263eee0b75847c596f31c71492611b22c
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Sat May 24 17:23:10 2008 +0930
Xi: remove deprecated comment.
Axis clipping wouldn't be necessary here, it's already performed in GPE.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index f477a73..a48ba11 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -839,8 +839,6 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
* swap = (event - device)
* dev = event
* event = delta
- *
- * XXX: axis clipping for relative events?
*/
axisvals = v->axisVal;
int delta;
More information about the xorg-commit
mailing list