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:
parent
00b4339168
commit
0877de13ac
|
@ -137,9 +137,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||||
coords = (INT32 *) xalloc(tsize);
|
coords = (INT32 *) xalloc(tsize);
|
||||||
if (!coords)
|
if (!coords)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
rep.nEvents = (v->GetMotionProc) (dev, (xTimecoord *) coords, /* XXX */
|
rep.nEvents = GetMotionHistory(dev, (xTimecoord *) coords,/* XXX */
|
||||||
start.milliseconds, stop.milliseconds,
|
start.milliseconds, stop.milliseconds,
|
||||||
(ScreenPtr) NULL);
|
(ScreenPtr) NULL);
|
||||||
}
|
}
|
||||||
if (rep.nEvents > 0) {
|
if (rep.nEvents > 0) {
|
||||||
length = (rep.nEvents * size + 3) >> 2;
|
length = (rep.nEvents * size + 3) >> 2;
|
||||||
|
|
|
@ -492,7 +492,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
||||||
for (i = 1; i <= 32; i++)
|
for (i = 1; i <= 32; i++)
|
||||||
map[i] = i;
|
map[i] = i;
|
||||||
InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
|
InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
|
||||||
GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
|
(PtrCtrlProcPtr)NoopDDA,
|
||||||
GetMotionHistorySize(), 2);
|
GetMotionHistorySize(), 2);
|
||||||
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
|
pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
|
||||||
pDev->last.valuators[0] = pDev->valuator->axisVal[0];
|
pDev->last.valuators[0] = pDev->valuator->axisVal[0];
|
||||||
|
@ -643,7 +643,7 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
ValuatorClassPtr *v = (ValuatorClassPtr*)class;
|
ValuatorClassPtr *v = (ValuatorClassPtr*)class;
|
||||||
|
|
||||||
/* Counterpart to 'biggest hack ever' in init. */
|
/* Counterpart to 'biggest hack ever' in init. */
|
||||||
if ((*v)->motion && (*v)->GetMotionProc == GetMotionHistory)
|
if ((*v)->motion)
|
||||||
xfree((*v)->motion);
|
xfree((*v)->motion);
|
||||||
xfree((*v));
|
xfree((*v));
|
||||||
break;
|
break;
|
||||||
|
@ -1157,7 +1157,6 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
||||||
ValuatorMotionProcPtr motionProc,
|
|
||||||
int numMotionEvents, int mode)
|
int numMotionEvents, int mode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1175,7 +1174,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
||||||
valc->motion = NULL;
|
valc->motion = NULL;
|
||||||
valc->first_motion = 0;
|
valc->first_motion = 0;
|
||||||
valc->last_motion = 0;
|
valc->last_motion = 0;
|
||||||
valc->GetMotionProc = motionProc;
|
|
||||||
|
|
||||||
valc->numMotionEvents = numMotionEvents;
|
valc->numMotionEvents = numMotionEvents;
|
||||||
valc->motionHintWindow = NullWindow;
|
valc->motionHintWindow = NullWindow;
|
||||||
|
@ -1187,9 +1185,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
|
||||||
valc->dyremaind = 0;
|
valc->dyremaind = 0;
|
||||||
dev->valuator = valc;
|
dev->valuator = valc;
|
||||||
|
|
||||||
/* biggest hack ever. */
|
AllocateMotionHistory(dev);
|
||||||
if (motionProc == GetMotionHistory)
|
|
||||||
AllocateMotionHistory(dev);
|
|
||||||
|
|
||||||
for (i=0; i<numAxes; i++) {
|
for (i=0; i<numAxes; i++) {
|
||||||
InitValuatorAxisStruct(dev, i, NO_AXIS_LIMITS, NO_AXIS_LIMITS,
|
InitValuatorAxisStruct(dev, i, NO_AXIS_LIMITS, NO_AXIS_LIMITS,
|
||||||
|
@ -1414,14 +1410,13 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
|
||||||
|
|
||||||
_X_EXPORT Bool
|
_X_EXPORT Bool
|
||||||
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
|
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
|
||||||
ValuatorMotionProcPtr motionProc,
|
|
||||||
PtrCtrlProcPtr controlProc, int numMotionEvents,
|
PtrCtrlProcPtr controlProc, int numMotionEvents,
|
||||||
int numAxes)
|
int numAxes)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev = (DeviceIntPtr)device;
|
DeviceIntPtr dev = (DeviceIntPtr)device;
|
||||||
|
|
||||||
return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
|
return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
|
||||||
InitValuatorClassDeviceStruct(dev, numAxes, motionProc,
|
InitValuatorClassDeviceStruct(dev, numAxes,
|
||||||
numMotionEvents, 0) &&
|
numMotionEvents, 0) &&
|
||||||
InitPtrFeedbackClassDeviceStruct(dev, controlProc));
|
InitPtrFeedbackClassDeviceStruct(dev, controlProc));
|
||||||
}
|
}
|
||||||
|
@ -2317,10 +2312,8 @@ ProcGetMotionEvents(ClientPtr client)
|
||||||
* sizeof(xTimecoord));
|
* sizeof(xTimecoord));
|
||||||
if (!coords)
|
if (!coords)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
count = (*mouse->valuator->GetMotionProc) (mouse, coords,
|
count = GetMotionHistory(mouse, coords, start.milliseconds,
|
||||||
start.milliseconds,
|
stop.milliseconds, pWin->drawable.pScreen);
|
||||||
stop.milliseconds,
|
|
||||||
pWin->drawable.pScreen);
|
|
||||||
xmin = pWin->drawable.x - wBorderWidth (pWin);
|
xmin = pWin->drawable.x - wBorderWidth (pWin);
|
||||||
xmax = pWin->drawable.x + (int)pWin->drawable.width +
|
xmax = pWin->drawable.x + (int)pWin->drawable.width +
|
||||||
wBorderWidth (pWin);
|
wBorderWidth (pWin);
|
||||||
|
|
|
@ -238,8 +238,8 @@ AllocateMotionHistory(DeviceIntPtr pDev)
|
||||||
if (pDev->valuator->numMotionEvents < 1)
|
if (pDev->valuator->numMotionEvents < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
|
pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes)
|
||||||
sizeof(Time)) *
|
+ sizeof(Time)) *
|
||||||
pDev->valuator->numMotionEvents);
|
pDev->valuator->numMotionEvents);
|
||||||
pDev->valuator->first_motion = 0;
|
pDev->valuator->first_motion = 0;
|
||||||
pDev->valuator->last_motion = 0;
|
pDev->valuator->last_motion = 0;
|
||||||
|
|
|
@ -438,7 +438,6 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
|
||||||
}
|
}
|
||||||
|
|
||||||
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
|
InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
|
||||||
GetMotionHistory,
|
|
||||||
(PtrCtrlProcPtr)NoopDDA,
|
(PtrCtrlProcPtr)NoopDDA,
|
||||||
GetMotionHistorySize(), pi->nAxes);
|
GetMotionHistorySize(), pi->nAxes);
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
|
||||||
map[1] = 1;
|
map[1] = 1;
|
||||||
map[2] = 2;
|
map[2] = 2;
|
||||||
map[3] = 3;
|
map[3] = 3;
|
||||||
InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
|
InitPointerDeviceStruct(pDev, map, 3,
|
||||||
(PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
|
(PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff)
|
||||||
for (i = 0; i <= nmap; i++)
|
for (i = 0; i <= nmap; i++)
|
||||||
map[i] = i; /* buttons are already mapped */
|
map[i] = i; /* buttons are already mapped */
|
||||||
InitPointerDeviceStruct(&pDev->public, map, nmap,
|
InitPointerDeviceStruct(&pDev->public, map, nmap,
|
||||||
GetMotionHistory,
|
|
||||||
xnestChangePointerControl,
|
xnestChangePointerControl,
|
||||||
GetMotionHistorySize(), 2);
|
GetMotionHistorySize(), 2);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -274,17 +274,9 @@ extern Bool InitButtonClassDeviceStruct(
|
||||||
int /*numButtons*/,
|
int /*numButtons*/,
|
||||||
CARD8* /*map*/);
|
CARD8* /*map*/);
|
||||||
|
|
||||||
typedef int (*ValuatorMotionProcPtr)(
|
|
||||||
DeviceIntPtr /*pdevice*/,
|
|
||||||
xTimecoord * /*coords*/,
|
|
||||||
unsigned long /*start*/,
|
|
||||||
unsigned long /*stop*/,
|
|
||||||
ScreenPtr /*pScreen*/);
|
|
||||||
|
|
||||||
extern Bool InitValuatorClassDeviceStruct(
|
extern Bool InitValuatorClassDeviceStruct(
|
||||||
DeviceIntPtr /*device*/,
|
DeviceIntPtr /*device*/,
|
||||||
int /*numAxes*/,
|
int /*numAxes*/,
|
||||||
ValuatorMotionProcPtr /* motionProc */,
|
|
||||||
int /*numMotionEvents*/,
|
int /*numMotionEvents*/,
|
||||||
int /*mode*/);
|
int /*mode*/);
|
||||||
|
|
||||||
|
@ -358,7 +350,6 @@ extern Bool InitPointerDeviceStruct(
|
||||||
DevicePtr /*device*/,
|
DevicePtr /*device*/,
|
||||||
CARD8* /*map*/,
|
CARD8* /*map*/,
|
||||||
int /*numButtons*/,
|
int /*numButtons*/,
|
||||||
ValuatorMotionProcPtr /*motionProc*/,
|
|
||||||
PtrCtrlProcPtr /*controlProc*/,
|
PtrCtrlProcPtr /*controlProc*/,
|
||||||
int /*numMotionEvents*/,
|
int /*numMotionEvents*/,
|
||||||
int /*numAxes*/);
|
int /*numAxes*/);
|
||||||
|
|
|
@ -164,11 +164,10 @@ typedef struct _AxisInfo {
|
||||||
} AxisInfo, *AxisInfoPtr;
|
} AxisInfo, *AxisInfoPtr;
|
||||||
|
|
||||||
typedef struct _ValuatorClassRec {
|
typedef struct _ValuatorClassRec {
|
||||||
ValuatorMotionProcPtr GetMotionProc;
|
|
||||||
int numMotionEvents;
|
int numMotionEvents;
|
||||||
int first_motion;
|
int first_motion;
|
||||||
int last_motion;
|
int last_motion;
|
||||||
void *motion;
|
void *motion; /* motion history buffer */
|
||||||
|
|
||||||
WindowPtr motionHintWindow;
|
WindowPtr motionHintWindow;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue