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.
This commit is contained in:
Peter Hutterer 2008-05-25 22:49:54 +09:30
parent 00b4339168
commit 0877de13ac
8 changed files with 13 additions and 32 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -438,7 +438,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
}
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), pi->nAxes);

View File

@ -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;

View File

@ -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;

View File

@ -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*/);

View File

@ -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;