diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-05-25 22:49:54 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-05-25 22:49:54 +0930 |
commit | 0877de13ac6ddfb55108aa3456d47f970c6c442c (patch) | |
tree | 6e28eef360b45c19031e73bb6eb101f729464391 | |
parent | 00b4339168c10dd4ce026deb8e04bfb63dfd11dc (diff) |
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.
-rw-r--r-- | Xi/gtmotion.c | 6 | ||||
-rw-r--r-- | dix/devices.c | 19 | ||||
-rw-r--r-- | dix/getevents.c | 4 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 1 | ||||
-rw-r--r-- | hw/vfb/InitInput.c | 2 | ||||
-rw-r--r-- | hw/xnest/Pointer.c | 1 | ||||
-rw-r--r-- | include/input.h | 9 | ||||
-rw-r--r-- | include/inputstr.h | 3 |
8 files changed, 13 insertions, 32 deletions
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 4f4d7cb77..7994890d3 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 252118690..9db276b16 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 7c7c63fda..dda681d27 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 c6724e487..005465fb6 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 3b001eea7..2af3c6421 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 b0de13b5f..8f764a624 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 9b92ea33d..70f3de64f 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 d26eb1377..86b166721 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; |