summaryrefslogtreecommitdiff
path: root/hw/dmx
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-30 16:05:46 -0600
committerBrian <brian@yutani.localnet.net>2007-03-30 16:05:46 -0600
commitebdc8ce5c108dc3b6b0004e7c7939d1a5bef8676 (patch)
treec57b62a810836dd460009e97a3b3a2c724022809 /hw/dmx
parent3c7413e0c2f87e154aa8aa4a83bd585a6d1091e8 (diff)
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).
Diffstat (limited to 'hw/dmx')
-rw-r--r--hw/dmx/dmxcursor.c2
-rw-r--r--hw/dmx/dmxinput.h2
-rw-r--r--hw/dmx/input/dmxbackend.c2
-rw-r--r--hw/dmx/input/dmxevents.c159
-rw-r--r--hw/dmx/input/dmxinputinit.c6
5 files changed, 157 insertions, 14 deletions
diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 11c89d822..a7d9378b0 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -889,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
gx = start->rootXOrigin + x;
gy = start->rootYOrigin + y;
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) {
_dmxSetCursor(pScreen, pCursor, x, y);
diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h
index 59fa823d3..3fb587086 100644
--- a/hw/dmx/dmxinput.h
+++ b/hw/dmx/dmxinput.h
@@ -154,7 +154,7 @@ typedef enum {
extern void dmxGetGlobalPosition(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);
/* Support for dynamic addition of inputs. This functions is defined in
diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c
index 61d1bfe3e..7efb2eebe 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -395,7 +395,7 @@ void dmxBackendCollectEvents(DevicePtr pDev,
}
break;
case MotionNotify:
-#if 00 /*BP*/
+#if 001 /*BP*/
DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
" newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
dmxScreen->index, priv->myScreen,
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 0cc3054ac..fae2049b3 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -191,7 +191,42 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y)
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;
DMXInputInfo *dmxInput;
@@ -214,6 +249,106 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
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))) {
+ 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))) {
localX = dmxGlobalX - dmxScreen->rootXOrigin;
localY = dmxGlobalY - dmxScreen->rootYOrigin;
@@ -285,6 +420,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
if (!dmxScreen) ProcessInputEvents();
}
+
+
#ifdef XINPUT
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
@@ -534,12 +671,18 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
return;
}
#endif
- if (axesCount == 2) switch (type) {
- case DMX_RELATIVE: dmxCoreMotion(dmxGlobalX - v[0],
- dmxGlobalY - v[1],
- 0, block); break;
- case DMX_ABSOLUTE: dmxCoreMotion(v[0], v[1], 0, block); break;
- case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(v[0], v[1], -1, block); break;
+ if (axesCount == 2) {
+ switch (type) {
+ case DMX_RELATIVE:
+ dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, 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,
detail,
POINTER_ABSOLUTE,
- 0, 3, valuators);
+ 0, 2/*3*/, valuators);
ErrorF("BUTTON %d, %d %d n=%d\n",
valuators[0], valuators[1], valuators[2], nevents);
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 1465ade27..d76dd9bc5 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -507,7 +507,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
#ifdef XINPUT
for (i = 0; i < info.numRelAxes; i++)
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]);
#endif
} else if (info.numRelAxes) {
@@ -518,7 +518,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
#ifdef XINPUT
for (i = 0; i < info.numRelAxes; i++)
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]);
#endif
} else if (info.numAbsAxes) {
@@ -529,7 +529,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
#ifdef XINPUT
for (i = 0; i < info.numAbsAxes; i++)
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.maxres[i+1]);
#endif