xserver: Branch 'master' - 2 commits

Brian Paul brianp at kemper.freedesktop.org
Sat Mar 31 01:07:30 EEST 2007


 hw/dmx/dmxcursor.c          |    2 
 hw/dmx/dmxinput.h           |    2 
 hw/dmx/input/dmxbackend.c   |    2 
 hw/dmx/input/dmxevents.c    |  159 +++++++++++++++++++++++++++++++++++++++++---
 hw/dmx/input/dmxinputinit.c |   24 ++++--
 5 files changed, 169 insertions(+), 20 deletions(-)

New commits:
diff-tree 73fdc16bc4f4e21ff604b3f9ded23b40398fb1b6 (from ebdc8ce5c108dc3b6b0004e7c7939d1a5bef8676)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 16:07:26 2007 -0600

    formatting fixes

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index d76dd9b..cf68051 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -472,8 +472,10 @@ static int dmxDeviceOnOff(DeviceIntPtr p
     memset(&info, 0, sizeof(info));
     switch (what) {
     case DEVICE_INIT:
-        if (dmxLocal->init) dmxLocal->init(pDev);
-        if (dmxLocal->get_info) dmxLocal->get_info(pDev, &info);
+        if (dmxLocal->init)
+            dmxLocal->init(pDev);
+        if (dmxLocal->get_info)
+            dmxLocal->get_info(pDev, &info);
         if (info.keyboard) {    /* XKEYBOARD makes this a special case */
             dmxKeyboardOn(pDevice, &info);
             break;
@@ -594,7 +596,8 @@ static void dmxProcessInputEvents(DMXInp
 #if 00 /*BP*/
     miPointerUpdate();
 #endif
-    if (dmxInput->detached) return;
+    if (dmxInput->detached)
+        return;
     for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
         if (dmxInput->devs[i]->process_input) {
 #if 11 /*BP*/
@@ -633,7 +636,8 @@ static void dmxUpdateWindowInformation(D
     }
 #endif
 
-    if (dmxInput->detached) return;
+    if (dmxInput->detached)
+        return;
     for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
         if (dmxInput->devs[i]->update_info)
             dmxInput->devs[i]->update_info(dmxInput->devs[i]->private,
@@ -644,7 +648,8 @@ static void dmxCollectAll(DMXInputInfo *
 {
     int i;
 
-    if (dmxInput->detached) return;
+    if (dmxInput->detached)
+        return;
     for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
         if (dmxInput->devs[i]->collect_events)
             dmxInput->devs[i]->collect_events(&dmxInput->devs[i]
@@ -741,7 +746,8 @@ static DeviceIntPtr dmxAddDevice(DMXLoca
     char         *devname;
     DMXInputInfo *dmxInput;
 
-    if (!dmxLocal) return NULL;
+    if (!dmxLocal)
+        return NULL;
     dmxInput = &dmxInputs[dmxLocal->inputIdx];
 
     if (dmxLocal->sendsCore) {
diff-tree ebdc8ce5c108dc3b6b0004e7c7939d1a5bef8676 (from 3c7413e0c2f87e154aa8aa4a83bd585a6d1091e8)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 16:05:46 2007 -0600

    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).

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 11c89d8..a7d9378 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -889,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScre
     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 59fa823..3fb5870 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 61d1bfe..7efb2ee 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -395,7 +395,7 @@ void dmxBackendCollectEvents(DevicePtr p
             }
             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 0cc3054..fae2049 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -191,7 +191,42 @@ DMXScreenInfo *dmxFindFirstScreen(int x,
     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 del
     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 del
     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, i
         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
                                       /*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 1465ade..d76dd9b 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -507,7 +507,7 @@ static int dmxDeviceOnOff(DeviceIntPtr p
 #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 p
 #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 p
 #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



More information about the xorg-commit mailing list