Checkpoint DMX updates: things are working much better now, but still not 100% right.
Use new dmxCoreMotion2() function which enqueues motion events with GetPointerEvents()/mieqEnqueue(). The clipAxis() code in GetPointerEvents() is causing some grief. The limits seem to have always been (0,0) according to the original calls to InitValuatorAxisStruct() in dmxinputinit.c. Terrible hack for now: Call InitValuatorAxisStruct() with hard-coded max values of 1280 (my screen width).
This commit is contained in:
parent
3c7413e0c2
commit
ebdc8ce5c1
|
@ -889,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
|
||||||
gx = start->rootXOrigin + x;
|
gx = start->rootXOrigin + x;
|
||||||
gy = start->rootYOrigin + y;
|
gy = start->rootYOrigin + y;
|
||||||
if (x && y && (GX != gx || GY != gy))
|
if (x && y && (GX != gx || GY != gy))
|
||||||
dmxCoreMotion(gx, gy, 0, DMX_NO_BLOCK);
|
dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
|
||||||
|
|
||||||
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
|
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
|
||||||
_dmxSetCursor(pScreen, pCursor, x, y);
|
_dmxSetCursor(pScreen, pCursor, x, y);
|
||||||
|
|
|
@ -154,7 +154,7 @@ typedef enum {
|
||||||
|
|
||||||
extern void dmxGetGlobalPosition(int *x, int *y);
|
extern void dmxGetGlobalPosition(int *x, int *y);
|
||||||
extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
|
extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
|
||||||
extern void dmxCoreMotion(int x, int y, int delta,
|
extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
|
||||||
DMXBlockType block);
|
DMXBlockType block);
|
||||||
|
|
||||||
/* Support for dynamic addition of inputs. This functions is defined in
|
/* Support for dynamic addition of inputs. This functions is defined in
|
||||||
|
|
|
@ -395,7 +395,7 @@ void dmxBackendCollectEvents(DevicePtr pDev,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
#if 00 /*BP*/
|
#if 001 /*BP*/
|
||||||
DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
|
DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
|
||||||
" newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
|
" newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
|
||||||
dmxScreen->index, priv->myScreen,
|
dmxScreen->index, priv->myScreen,
|
||||||
|
|
|
@ -191,7 +191,42 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
|
|
||||||
|
#if 11/*BP*/
|
||||||
|
|
||||||
|
static void enqueueMotion(DevicePtr pDev, int x, int y)
|
||||||
|
{
|
||||||
|
GETDMXINPUTFROMPDEV;
|
||||||
|
DeviceIntPtr p = dmxLocal->pDevice;
|
||||||
|
int i, nevents, valuators[3];
|
||||||
|
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||||
|
int detail = 0;
|
||||||
|
|
||||||
|
valuators[0] = x;
|
||||||
|
valuators[1] = y;
|
||||||
|
valuators[2] = detail;
|
||||||
|
nevents = GetPointerEvents(events,
|
||||||
|
/*pDev*/p,
|
||||||
|
MotionNotify,
|
||||||
|
detail,
|
||||||
|
POINTER_ABSOLUTE,
|
||||||
|
0, 2, valuators);
|
||||||
|
ErrorF("MOTION2 %d, %d n = %d\n", valuators[0], valuators[1], nevents);
|
||||||
|
/*
|
||||||
|
ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n",
|
||||||
|
detail, e->xmotion.state,
|
||||||
|
valuators[0], valuators[1], valuators[2],
|
||||||
|
nevents);
|
||||||
|
*/
|
||||||
|
for (i = 0; i < nevents; i++)
|
||||||
|
mieqEnqueue(p, events + i);
|
||||||
|
xfree(events);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
|
||||||
{
|
{
|
||||||
DMXScreenInfo *dmxScreen;
|
DMXScreenInfo *dmxScreen;
|
||||||
DMXInputInfo *dmxInput;
|
DMXInputInfo *dmxInput;
|
||||||
|
@ -214,6 +249,106 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
|
||||||
if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1;
|
if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1;
|
||||||
if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1;
|
if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1;
|
||||||
|
|
||||||
|
ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY);
|
||||||
|
|
||||||
|
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
|
||||||
|
localX = dmxGlobalX - dmxScreen->rootXOrigin;
|
||||||
|
localY = dmxGlobalY - dmxScreen->rootYOrigin;
|
||||||
|
if ((pScreen = miPointerGetScreen(inputInfo.pointer))
|
||||||
|
&& pScreen->myNum == dmxScreen->index) {
|
||||||
|
/* Screen is old screen */
|
||||||
|
if (block)
|
||||||
|
dmxSigioBlock();
|
||||||
|
#if 000
|
||||||
|
miPointerSetPosition(inputInfo.pointer, &localX, &localY,
|
||||||
|
GetTimeInMillis());
|
||||||
|
#else
|
||||||
|
if (pDev)
|
||||||
|
enqueueMotion(pDev, localX, localY);
|
||||||
|
#endif
|
||||||
|
if (block)
|
||||||
|
dmxSigioUnblock();
|
||||||
|
} else {
|
||||||
|
/* Screen is new */
|
||||||
|
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
|
||||||
|
pScreen->myNum, dmxScreen->index, localX, localY);
|
||||||
|
if (block)
|
||||||
|
dmxSigioBlock();
|
||||||
|
dmxeqProcessInputEvents();
|
||||||
|
miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
|
||||||
|
localX, localY);
|
||||||
|
#if 000
|
||||||
|
miPointerSetPosition(inputInfo.pointer, &localX, &localY,
|
||||||
|
GetTimeInMillis());
|
||||||
|
#else
|
||||||
|
if (pDev)
|
||||||
|
enqueueMotion(pDev, localX, localY);
|
||||||
|
#endif
|
||||||
|
if (block)
|
||||||
|
dmxSigioUnblock();
|
||||||
|
}
|
||||||
|
#if 00
|
||||||
|
miPointerGetPosition(inputInfo.pointer, &localX, &localY);
|
||||||
|
|
||||||
|
if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
|
||||||
|
dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
|
||||||
|
dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
|
||||||
|
ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY,
|
||||||
|
localX, localY);
|
||||||
|
DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d"
|
||||||
|
" on screen index=%d/%d localX=%d localY=%d\n",
|
||||||
|
dmxGlobalX, dmxGlobalY,
|
||||||
|
dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
|
||||||
|
localX, localY);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/* Send updates down to all core input
|
||||||
|
* drivers */
|
||||||
|
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
|
||||||
|
if (!dmxInput->detached
|
||||||
|
&& dmxInput->devs[j]->sendsCore
|
||||||
|
&& dmxInput->devs[j]->update_position)
|
||||||
|
dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
|
||||||
|
dmxGlobalX, dmxGlobalY);
|
||||||
|
}
|
||||||
|
if (!dmxScreen) ProcessInputEvents();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
|
||||||
|
{
|
||||||
|
DMXScreenInfo *dmxScreen;
|
||||||
|
DMXInputInfo *dmxInput;
|
||||||
|
ScreenPtr pScreen;
|
||||||
|
int localX;
|
||||||
|
int localY;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#if 11/*BP*/
|
||||||
|
dmxCoreMotion2(pDev, x, y, delta, block);
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return;
|
||||||
|
|
||||||
|
DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
|
||||||
|
x, y, delta, dmxGlobalX, dmxGlobalY);
|
||||||
|
|
||||||
|
dmxGlobalInvalid = 0;
|
||||||
|
dmxGlobalX = x;
|
||||||
|
dmxGlobalY = y;
|
||||||
|
|
||||||
|
if (dmxGlobalX < 0) dmxGlobalX = 0;
|
||||||
|
if (dmxGlobalY < 0) dmxGlobalY = 0;
|
||||||
|
if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1;
|
||||||
|
if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1;
|
||||||
|
|
||||||
|
ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY);
|
||||||
|
|
||||||
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
|
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
|
||||||
localX = dmxGlobalX - dmxScreen->rootXOrigin;
|
localX = dmxGlobalX - dmxScreen->rootXOrigin;
|
||||||
localY = dmxGlobalY - dmxScreen->rootYOrigin;
|
localY = dmxGlobalY - dmxScreen->rootYOrigin;
|
||||||
|
@ -285,6 +420,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
|
||||||
if (!dmxScreen) ProcessInputEvents();
|
if (!dmxScreen) ProcessInputEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
|
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
|
||||||
static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
|
static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
|
||||||
|
@ -534,12 +671,18 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (axesCount == 2) switch (type) {
|
if (axesCount == 2) {
|
||||||
case DMX_RELATIVE: dmxCoreMotion(dmxGlobalX - v[0],
|
switch (type) {
|
||||||
dmxGlobalY - v[1],
|
case DMX_RELATIVE:
|
||||||
0, block); break;
|
dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
|
||||||
case DMX_ABSOLUTE: dmxCoreMotion(v[0], v[1], 0, block); break;
|
break;
|
||||||
case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(v[0], v[1], -1, block); break;
|
case DMX_ABSOLUTE:
|
||||||
|
dmxCoreMotion(pDev, v[0], v[1], 0, block);
|
||||||
|
break;
|
||||||
|
case DMX_ABSOLUTE_CONFINED:
|
||||||
|
dmxCoreMotion(pDev, v[0], v[1], -1, block);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +812,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
|
||||||
/*KeyPress*/type,
|
/*KeyPress*/type,
|
||||||
detail,
|
detail,
|
||||||
POINTER_ABSOLUTE,
|
POINTER_ABSOLUTE,
|
||||||
0, 3, valuators);
|
0, 2/*3*/, valuators);
|
||||||
|
|
||||||
ErrorF("BUTTON %d, %d %d n=%d\n",
|
ErrorF("BUTTON %d, %d %d n=%d\n",
|
||||||
valuators[0], valuators[1], valuators[2], nevents);
|
valuators[0], valuators[1], valuators[2], nevents);
|
||||||
|
|
|
@ -507,7 +507,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
for (i = 0; i < info.numRelAxes; i++)
|
for (i = 0; i < info.numRelAxes; i++)
|
||||||
InitValuatorAxisStruct(pDevice, i, info.minval[0],
|
InitValuatorAxisStruct(pDevice, i, info.minval[0],
|
||||||
info.maxval[0], info.res[0],
|
1280/*info.maxval[0]*/, info.res[0],
|
||||||
info.minres[0], info.maxres[0]);
|
info.minres[0], info.maxres[0]);
|
||||||
#endif
|
#endif
|
||||||
} else if (info.numRelAxes) {
|
} else if (info.numRelAxes) {
|
||||||
|
@ -518,7 +518,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
for (i = 0; i < info.numRelAxes; i++)
|
for (i = 0; i < info.numRelAxes; i++)
|
||||||
InitValuatorAxisStruct(pDevice, i, info.minval[0],
|
InitValuatorAxisStruct(pDevice, i, info.minval[0],
|
||||||
info.maxval[0], info.res[0],
|
1280/*info.maxval[0]*/, info.res[0],
|
||||||
info.minres[0], info.maxres[0]);
|
info.minres[0], info.maxres[0]);
|
||||||
#endif
|
#endif
|
||||||
} else if (info.numAbsAxes) {
|
} else if (info.numAbsAxes) {
|
||||||
|
@ -529,7 +529,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
for (i = 0; i < info.numAbsAxes; i++)
|
for (i = 0; i < info.numAbsAxes; i++)
|
||||||
InitValuatorAxisStruct(pDevice, i+info.numRelAxes,
|
InitValuatorAxisStruct(pDevice, i+info.numRelAxes,
|
||||||
info.minval[i+1], info.maxval[i+1],
|
info.minval[i+1], 1280/*info.maxval[i+1]*/,
|
||||||
info.res[i+1], info.minres[i+1],
|
info.res[i+1], info.minres[i+1],
|
||||||
info.maxres[i+1]);
|
info.maxres[i+1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue