xserver: Branch 'master' - 4 commits

Brian Paul brianp at kemper.freedesktop.org
Fri Mar 30 22:19:52 EEST 2007


 hw/dmx/Makefile.am          |   10 +--
 hw/dmx/dmxcursor.c          |  131 ++++++++++++++++++++++++++++++--------------
 hw/dmx/dmxinput.c           |    3 +
 hw/dmx/input/dmxbackend.c   |   19 ++++++
 hw/dmx/input/dmxevents.c    |  106 +++++++++++++++++++++++++++++++++++
 hw/dmx/input/dmxinputinit.c |   88 ++++++++++++++++++++++++++++-
 hw/dmx/input/dmxxinput.c    |    6 +-
 hw/dmx/input/lnx-keyboard.c |   12 ++++
 8 files changed, 328 insertions(+), 47 deletions(-)

New commits:
diff-tree 92e8cdbd32b0d86cabd4ad88e3240bf90c018b9a (from d92da3d5f309392ac398c0975ef17bb04312d5e2)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 13:19:33 2007 -0600

    Checkpoint fixes to DMX for X input changes.
    
    Xdmx builds and runs now.
    Keyboard seems OK, and mouse pointer moves, but everything else is flakey.
    Something is still seriously wrong.

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 09b50b8..11c89d8 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -182,7 +182,12 @@ static void dmxCrossScreen(ScreenPtr pSc
 static void dmxWarpCursor(ScreenPtr pScreen, int x, int y)
 {
     DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+#if 11 /*BP*/
+    /* This call is depracated.  Replace with???? */
     miPointerWarpCursor(pScreen, x, y);
+#else
+    pScreen->SetCursorPosition(pScreen, x, y, FALSE);
+#endif
 }
 
 miPointerScreenFuncRec dmxPointerCursorFuncs =
@@ -190,7 +195,7 @@ miPointerScreenFuncRec dmxPointerCursorF
     dmxCursorOffScreen,
     dmxCrossScreen,
     dmxWarpCursor,
-    dmxeqEnqueue,
+    dmxeqEnqueue,        /*XXX incompatible type/function! */
     dmxeqSwitchScreen
 };
 
@@ -939,8 +944,13 @@ void dmxCheckCursor(void)
         pScreen                  = screenInfo.screens[dmxScreen->index];
 
         if (!dmxOnScreen(x, y, dmxScreen)) {
+#if 00
             if (firstScreen && i == miPointerCurrentScreen()->myNum)
                 miPointerSetNewScreen(firstScreen->index, x, y);
+#else
+            if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum)
+                miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y);
+#endif
             _dmxSetCursor(pScreen, NULL,
                           x - dmxScreen->rootXOrigin,
                           y - dmxScreen->rootYOrigin);
diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c
index 37f4583..f47899c 100644
--- a/hw/dmx/dmxinput.c
+++ b/hw/dmx/dmxinput.c
@@ -49,6 +49,7 @@
 
 #include "inputstr.h"
 #include "input.h"
+#include "mi.h"
 
 /** Returns TRUE if the key is a valid modifier.  For PC-class
  * keyboards, all keys can be used as modifiers, so return TRUE
@@ -75,6 +76,8 @@ void InitInput(int argc, char **argv)
         dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n");
         dmxLog(dmxFatal,   "At least one core keyboard/mouse pair required\n");
     }
+
+    mieqInit();
 }
 
 /** Called from dix/dispatch.c in Dispatch() whenever input events
diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c
index 8985a1b..48de4c9 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -242,7 +242,11 @@ static int dmxBackendOffscreen(int scree
 void dmxBackendUpdatePosition(pointer private, int x, int y)
 {
     GETPRIVFROMPRIVATE;
+#if 00 /*BP*/
     int           screen      = miPointerCurrentScreen()->myNum;
+#else
+    int           screen      = miPointerGetScreen(inputInfo.pointer)->myNum;
+#endif
     DMXScreenInfo *dmxScreen  = &dmxScreens[priv->myScreen];
     int           oldRelative = priv->relative;
     int           topscreen   = dmxBackendFindOverlapping(priv, screen, x, y);
@@ -391,6 +395,7 @@ void dmxBackendCollectEvents(DevicePtr p
             }
             break;
 	case MotionNotify:
+#if 00 /*BP*/
             DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
                     " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
                     dmxScreen->index, priv->myScreen,
@@ -443,12 +448,26 @@ void dmxBackendCollectEvents(DevicePtr p
                         (dmxScreen->rootYOrigin + X.xmotion.y
                          - dmxScreen->rootY));
             }
+#else
+            /*
+            ErrorF("motion %d, %d, %d\n",
+                   X.xmotion.x, X.xmotion.y, X.xmotion.state);
+            */
+            enqueue(priv->mou, X.type, 0/*X.xbutton.button*/, 0, &X, block);
+#endif
 	    break;
 
         case KeyPress:
         case KeyRelease:
             enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
             break;
+#if 11/*BP*/
+        case ButtonPress:
+        case ButtonRelease:
+           /*
+           ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y);
+           */
+#endif
 	default:
                                 /* Pass the whole event here, because
                                  * this may be an extension event. */
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 5316f0f..90b45a9 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -56,6 +56,7 @@
 #include "opaque.h"
 #include "inputstr.h"
 #include "mipointer.h"
+#include "mi.h"
 
 #ifdef XINPUT
 #include "XIstubs.h"
@@ -216,11 +217,20 @@ void dmxCoreMotion(int x, int y, int del
     if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
         localX = dmxGlobalX - dmxScreen->rootXOrigin;
         localY = dmxGlobalY - dmxScreen->rootYOrigin;
+#if 00 /*BP*/
         if ((pScreen = miPointerCurrentScreen())
+#else
+        if ((pScreen = miPointerGetScreen(inputInfo.pointer))
+#endif
             && pScreen->myNum == dmxScreen->index) {
                                 /* Screen is old screen */
             if (block) dmxSigioBlock();
+#if 00 /*BP*/
             miPointerAbsoluteCursor(localX, localY, GetTimeInMillis());
+#else
+            miPointerSetPosition(inputInfo.pointer, &localX, &localY,
+                                 GetTimeInMillis());
+#endif
             if (block) dmxSigioUnblock();
         } else {
                                 /* Screen is new */
@@ -228,13 +238,28 @@ void dmxCoreMotion(int x, int y, int del
                     pScreen->myNum, dmxScreen->index, localX, localY);
             if (block) dmxSigioBlock();
             dmxeqProcessInputEvents();
+#if 00 /*BP*/
             miPointerSetNewScreen(dmxScreen->index, localX, localY);
             miPointerAbsoluteCursor(localX, localY, GetTimeInMillis());
+#else
+            miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
+                               localX, localY);
+            miPointerSetPosition(inputInfo.pointer, &localX, &localY,
+                                 GetTimeInMillis());
+#endif
             if (block) dmxSigioUnblock();
         }
+#if 00 /*BP*/
         miPointerPosition(&localX, &localY);
+#else
+        miPointerGetPosition(inputInfo.pointer, &localX, &localY);
+#endif
 
+#if 00 /*BP*/
         if ((pScreen = miPointerCurrentScreen())) {
+#else
+        if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
+#endif
             dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
             dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
             DMXDBG6("   Moved to dmxGlobalX=%d dmxGlobalY=%d"
@@ -604,16 +629,87 @@ void dmxEnqueue(DevicePtr pDev, int type
             return;
         if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
             xE.u.u.detail = dmxFixup(pDev, detail, keySym);
+#if 11/*BP*/
+        {
+           DeviceIntPtr p = dmxLocal->pDevice;
+           int i, nevents;
+           xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+           nevents = GetKeyboardEvents(events,
+                                       /*pDev*/p,
+                                       /*KeyPress*/type,
+                                       /*n*/detail);
+           /*
+           ErrorF("NEW KEY EVENT %d  n=%d\n", detail, nevents);
+           */
+           for (i = 0; i < nevents; i++)
+              mieqEnqueue(p, events + i);
+           xfree(events);
+           return;
+        }
+#endif
         break;
     case ButtonPress:
     case ButtonRelease:
+#if 00 /*BP*/
         detail = dmxGetButtonMapping(dmxLocal, detail);
+#else
+        {
+           DeviceIntPtr p = dmxLocal->pDevice;
+           int i, nevents, valuators[3];
+           xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+           valuators[0] = e->xbutton.x;
+           valuators[1] = e->xbutton.y;
+           valuators[2] = e->xbutton.button;
+           nevents = GetPointerEvents(events,
+                                      /*pDev*/p,
+                                      /*KeyPress*/type,
+                                      detail,
+                                      POINTER_ABSOLUTE,
+                                      0, 0, valuators);
+           /*
+           ErrorF("NEW PTR EVENT %d (%d,%d,%d) n=%d\n",
+                  detail, valuators[0], valuators[1], valuators[2],
+                  nevents);
+           */
+           for (i = 0; i < nevents; i++)
+              mieqEnqueue(p, events + i);
+           xfree(events);
+           return;
+        }
+#endif
         break;
     case MotionNotify:
         /* All MotionNotify events should be sent via dmxCoreMotion and
          * dmxExtMotion -- no input driver should build motion events by
          * hand. */
+#if 00 /*BP*/
         dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n");
+#else
+        {
+           DeviceIntPtr p = dmxLocal->pDevice;
+           int i, nevents, valuators[3];
+           xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+           valuators[0] = e->xmotion.x;
+           valuators[1] = e->xmotion.y;
+           valuators[2] = e->xmotion.state;
+           nevents = GetPointerEvents(events,
+                                      /*pDev*/p,
+                                      /*KeyPress*/type,
+                                      detail,
+                                      POINTER_ABSOLUTE,
+                                      0, 0, valuators);
+           /*
+           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;
+        }
+#endif
         break;
                                 /* Always ignore these events */
     case EnterNotify:
@@ -623,6 +719,7 @@ void dmxEnqueue(DevicePtr pDev, int type
                                  * modifier map on the backend/console
                                  * input device so that we have complete
                                  * control of the input device LEDs. */
+       ErrorF("Enter/Leave/Keymap/Mapping\n");
         return;
     default:
 #ifdef XINPUT
@@ -652,7 +749,16 @@ void dmxEnqueue(DevicePtr pDev, int type
     if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block);
     else
 #endif
+#if 00 /*BP*/
         dmxeqEnqueue(&xE);
+#else
+    /* never get here! */
+    if (0) {
+       DeviceIntPtr p = dmxLocal->pDevice;
+       ErrorF("enque %d\n", type);
+       mieqEnqueue(p, &xE);
+    }
+#endif
 }
 
 /** A pointer to this routine is passed to low-level input drivers so
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 0519d2b..7c0ae58 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -72,6 +72,7 @@
 #include "input.h"
 #include "mipointer.h"
 #include "windowstr.h"
+#include "mi.h"
 
 #ifdef XINPUT
 #include <X11/extensions/XI.h>
@@ -222,6 +223,57 @@ static DMXLocalInputInfoRec DMXLocalDevi
     { NULL }                    /* Must be last */
 };
 
+
+#if 11 /*BP*/
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+   /* NO-OP */
+}
+
+/* taken from kdrive/src/kinput.c: */
+static void
+dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+{
+#if 0
+    KdKeyboardInfo *ki;
+
+    for (ki = kdKeyboards; ki; ki = ki->next) {
+        if (ki->dixdev && ki->dixdev->id == pDevice->id)
+            break;
+    }
+
+    if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver)
+        return;
+
+    KdSetLeds(ki, ctrl->leds);
+    ki->bellPitch = ctrl->bell_pitch;
+    ki->bellDuration = ctrl->bell_duration; 
+#endif
+}
+
+/* taken from kdrive/src/kinput.c: */
+static void
+dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+{
+#if 0
+    KeybdCtrl *ctrl = arg;
+    KdKeyboardInfo *ki = NULL;
+    
+    for (ki = kdKeyboards; ki; ki = ki->next) {
+        if (ki->dixdev && ki->dixdev->id == pDev->id)
+            break;
+    }
+
+    if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
+        return;
+    
+    KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
+#endif
+}
+
+#endif /*BP*/
+
 static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal,
                                      PtrCtrl *ctrl)
 {
@@ -427,7 +479,15 @@ static int dmxDeviceOnOff(DeviceIntPtr p
             break;
         }
         if (info.keyClass) {
+#if 00 /*BP*/
             InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap);
+#else
+            DevicePtr pDev = (DevicePtr) pDevice;
+            InitKeyboardDeviceStruct(pDev,
+                                     &info.keySyms,
+                                     info.modMap,
+                                     dmxBell, dmxKbdCtrl);
+#endif
         }
         if (info.buttonClass) {
             InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map);
@@ -435,8 +495,13 @@ static int dmxDeviceOnOff(DeviceIntPtr p
         if (info.valuatorClass) {
             if (info.numRelAxes && dmxLocal->sendsCore) {
                 InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
+#if 00 /*BP*/
                                               miPointerGetMotionEvents,
                                               miPointerGetMotionBufferSize(),
+#else
+                                              GetMotionHistory,
+                                              GetMaximumEventsNum(),
+#endif
                                               Relative);
 #ifdef XINPUT
                 for (i = 0; i < info.numRelAxes; i++)
@@ -520,12 +585,26 @@ static void dmxProcessInputEvents(DMXInp
 {
     int i;
 
+    /*
+    ErrorF("%s\n", __FUNCTION__);
+    */
+
     dmxeqProcessInputEvents();
+#if 00 /*BP*/
     miPointerUpdate();
+#endif
     if (dmxInput->detached) return;
     for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
-        if (dmxInput->devs[i]->process_input)
+        if (dmxInput->devs[i]->process_input) {
+#if 11 /*BP*/
+            miPointerUpdateSprite(dmxInput->devs[i]->pDevice);
+#endif
             dmxInput->devs[i]->process_input(dmxInput->devs[i]->private);
+        }
+
+#if 11 /*BP*/
+    mieqProcessInputEvents();
+#endif
 }
 
 static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
@@ -710,8 +789,13 @@ static DeviceIntPtr dmxAddDevice(DMXLoca
 
     registerProcPtr(pDevice);
 
-    if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE)
+    if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
+#if 00 /*BP*/
         miRegisterPointerDevice(screenInfo.screens[0], pDevice);
+#else
+        /* Nothing? dmxDeviceOnOff() should get called to init, right? */
+#endif
+    }
 
     if (dmxLocal->create_private)
         dmxLocal->private = dmxLocal->create_private(pDevice);
diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c
index 81d1cfb..ad2a77c 100644
--- a/hw/dmx/input/dmxxinput.c
+++ b/hw/dmx/input/dmxxinput.c
@@ -99,9 +99,13 @@ int ChangePointerDevice(DeviceIntPtr old
     }
     dmxLocalNew->savedMotionProc       = new_dev->valuator->GetMotionProc;
     dmxLocalNew->savedMotionEvents     = new_dev->valuator->numMotionEvents;
+#if 00 /*BP*/
     new_dev->valuator->GetMotionProc   = miPointerGetMotionEvents;
     new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
-
+#else
+    new_dev->valuator->GetMotionProc   = GetMotionHistory;
+    new_dev->valuator->numMotionEvents = GetMaximumEventsNum();
+#endif
                                 /* Switch our notion of core pointer */
     dmxLocalOld->isCore         = 0;
     dmxLocalOld->sendsCore      = dmxLocalOld->savedSendsCore;
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c
index 97cc307..b09492b 100644
--- a/hw/dmx/input/lnx-keyboard.c
+++ b/hw/dmx/input/lnx-keyboard.c
@@ -164,7 +164,9 @@
 #include <sys/kd.h>
 #include <termios.h>
 #include "atKeynames.h"
+#if 00
 #include "xf86Keymap.h"
+#endif
 #include <linux/keyboard.h>
 
 #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
@@ -800,7 +802,12 @@ static void kbdLinuxReadKernelMapping(in
   tbl[2] = 8;	/* alt */
   tbl[3] = tbl[2] | 1;
 
+#if 00/*BP*/
   k = map+GLYPHS_PER_KEY;
+#else
+  ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
+  return;
+#endif
   maxkey = NUM_AT2LNX;
 
   for (i = 0; i < maxkey; ++i) {
@@ -927,8 +934,13 @@ static void kbdLinuxGetMap(DevicePtr pDe
     char          type;
     int           i;
 
+#if 00/*BP*/
     mapCopy = xalloc(sizeof(map));
     memcpy(mapCopy, map, sizeof(map));
+#else
+    ErrorF("kbdLinuxGetMap() is broken/no-op'd\n");
+    return;
+#endif
 
     kbdLinuxReadKernelMapping(priv->fd, pKeySyms);
 
diff-tree d92da3d5f309392ac398c0975ef17bb04312d5e2 (from 44acb2517d9fb07790d9d799aa9cc727d1b7d35c)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 12:56:34 2007 -0600

    more formatting fixes

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index ef49652..09b50b8 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -130,14 +130,16 @@ static Bool dmxCursorOffScreen(ScreenPtr
     int           globalX;
     int           globalY;
     
-    if (screenInfo.numScreens == 1) return FALSE;
+    if (screenInfo.numScreens == 1)
+        return FALSE;
 
                                 /* On current screen? */
     dmxScreen = &dmxScreens[(*ppScreen)->myNum];
     if (localX >= 0
         && localX < dmxScreen->rootWidth
         && localY >= 0
-        && localY < dmxScreen->rootHeight) return FALSE;
+        && localY < dmxScreen->rootHeight)
+        return FALSE;
 
                                 /* Convert to global coordinate space */
     globalX = dmxScreen->rootXOrigin + localX;
@@ -162,7 +164,8 @@ static Bool dmxCursorOffScreen(ScreenPtr
             && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
             && globalY >= dmxScreen->rootYOrigin
             && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
-            if (dmxScreen->index == (*ppScreen)->myNum) return FALSE;
+            if (dmxScreen->index == (*ppScreen)->myNum)
+                return FALSE;
             *ppScreen = screenInfo.screens[dmxScreen->index];
             *x        = globalX - dmxScreen->rootXOrigin;
             *y        = globalY - dmxScreen->rootYOrigin;
diff-tree 44acb2517d9fb07790d9d799aa9cc727d1b7d35c (from 9f24798af50896cc3262c1201f75c10a688f2a83)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 12:54:22 2007 -0600

    Fix some bad formatting.
    
    Doing this:
        if (something) stmt;
    is evil if you're debugging and want to break on stmt!

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index e74a052..ef49652 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -198,7 +198,8 @@ static int *dmxSLCreate(void)
     int *list = malloc(dmxNumScreens * sizeof(*list));
     int i;
     
-    for (i = 0; i < dmxNumScreens; i++) list[i] = 1;
+    for (i = 0; i < dmxNumScreens; i++)
+        list[i] = 1;
     return list;
 }
 
@@ -212,7 +213,9 @@ static void dmxSLFree(int *list)
 static int dmxSLFindNext(int *list)
 {
     int i;
-    for (i = 0; i < dmxNumScreens; i++) if (list[i]) return i;
+    for (i = 0; i < dmxNumScreens; i++)
+        if (list[i])
+            return i;
     return -1;
 }
 
@@ -225,7 +228,8 @@ static int dmxTryComputeScreenOrigins(in
     int             changed = 0;
 
     for (i = 0; i < dmxNumScreens; i++) {
-        if (!screensLeft[i]) continue;
+        if (!screensLeft[i])
+            continue;
         screen  = &dmxScreens[i];
         switch (screen->where) {
         case PosAbsolute:
@@ -235,14 +239,16 @@ static int dmxTryComputeScreenOrigins(in
             break;
         case PosRelative:
             ref = screen->whereRefScreen;
-            if (screensLeft[ref]) break;
+            if (screensLeft[ref])
+                break;
             dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX;
             dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY;
             ++changed, screensLeft[i] = 0;
             break;
         case PosRightOf:
             ref = screen->whereRefScreen;
-            if (screensLeft[ref]) break;
+            if (screensLeft[ref])
+                break;
             pScreen = screenInfo.screens[ref];
             dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width;
             dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
@@ -250,7 +256,8 @@ static int dmxTryComputeScreenOrigins(in
             break;
         case PosLeftOf:
             ref = screen->whereRefScreen;
-            if (screensLeft[ref]) break;
+            if (screensLeft[ref])
+                break;
             pScreen = screenInfo.screens[i];
             dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width;
             dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
@@ -258,7 +265,8 @@ static int dmxTryComputeScreenOrigins(in
             break;
         case PosBelow:
             ref = screen->whereRefScreen;
-            if (screensLeft[ref]) break;
+            if (screensLeft[ref])
+                break;
             pScreen = screenInfo.screens[ref];
             dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
             dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height;
@@ -266,7 +274,8 @@ static int dmxTryComputeScreenOrigins(in
             break;
         case PosAbove:
             ref = screen->whereRefScreen;
-            if (screensLeft[ref]) break;
+            if (screensLeft[ref])
+                break;
             pScreen = screenInfo.screens[i];
             dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
             dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height;
@@ -308,8 +317,10 @@ static void dmxComputeScreenOrigins(void
     minX = dixScreenOrigins[0].x;
     minY = dixScreenOrigins[0].y;
     for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
-	if (dixScreenOrigins[i].x < minX) minX = dixScreenOrigins[i].x;
-	if (dixScreenOrigins[i].y < minY) minY = dixScreenOrigins[i].y;
+	if (dixScreenOrigins[i].x < minX)
+            minX = dixScreenOrigins[i].x;
+	if (dixScreenOrigins[i].y < minY)
+            minY = dixScreenOrigins[i].y;
     }
     if (minX || minY) {
 	for (i = 0; i < dmxNumScreens; i++) {
@@ -411,28 +422,36 @@ int dmxOnScreen(int x, int y, DMXScreenI
 static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
 {
     if (dmxOnScreen(a->rootXOrigin,
-                    a->rootYOrigin,                 b)) return 1;
+                    a->rootYOrigin,                 b))
+        return 1;
 
     if (dmxOnScreen(a->rootXOrigin,
-                    a->rootYOrigin + a->scrnWidth,  b)) return 1;
+                    a->rootYOrigin + a->scrnWidth,  b))
+        return 1;
 
     if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
-                    a->rootYOrigin,                 b)) return 1;
+                    a->rootYOrigin,                 b))
+        return 1;
 
     if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
-                    a->rootYOrigin + a->scrnWidth,  b)) return 1;
+                    a->rootYOrigin + a->scrnWidth,  b))
+        return 1;
 
     if (dmxOnScreen(b->rootXOrigin,
-                    b->rootYOrigin,                 a)) return 1;
+                    b->rootYOrigin,                 a))
+        return 1;
 
     if (dmxOnScreen(b->rootXOrigin,
-                    b->rootYOrigin + b->scrnWidth,  a)) return 1;
+                    b->rootYOrigin + b->scrnWidth,  a))
+        return 1;
 
     if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
-                    b->rootYOrigin,                 a)) return 1;
+                    b->rootYOrigin,                 a))
+        return 1;
 
     if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
-                    b->rootYOrigin + b->scrnWidth,  a)) return 1;
+                    b->rootYOrigin + b->scrnWidth,  a))
+        return 1;
 
     return 0;
 }
@@ -476,7 +495,8 @@ static void *dmxTestSameDisplay(DMXScree
 {
     DMXScreenInfo *b = closure;
 
-    if (a == b) return a;
+    if (a == b)
+        return a;
     return NULL;
 }
 
@@ -489,14 +509,16 @@ void dmxInitOverlap(void)
     int           i, j;
     DMXScreenInfo *a, *b, *pt;
 
-    for (i = 0; i < dmxNumScreens; i++) dmxScreens[i].over = NULL;
+    for (i = 0; i < dmxNumScreens; i++)
+        dmxScreens[i].over = NULL;
 
     for (i = 0; i < dmxNumScreens; i++) {
         a = &dmxScreens[i];
         
         for (j = i+1; j < dmxNumScreens; j++) {
             b = &dmxScreens[j];
-            if (b->over) continue;
+            if (b->over)
+                continue;
             
             if (dmxDoesOverlap(a, b)) {
                 DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
@@ -510,7 +532,8 @@ void dmxInitOverlap(void)
     for (i = 0; i < dmxNumScreens; i++) {
         a = &dmxScreens[i];
         
-        if (!a->over) continue;
+        if (!a->over)
+            continue;
         
                                 /* Flag all pairs that are on same display */
         for (pt = a->over; pt != a; pt = pt->over) {
@@ -521,7 +544,8 @@ void dmxInitOverlap(void)
                  * screens that mutually overlap on the backend display,
                  * so we call dmxDoesOverlap, which is stricter than the
                  * ->over set. */
-                if (!dmxDoesOverlap(a, pt)) continue;
+                if (!dmxDoesOverlap(a, pt))
+                    continue;
                 a->cursorNotShared  = 1;
                 pt->cursorNotShared = 1;
                 dmxLog(dmxInfo,
@@ -731,9 +755,11 @@ static Bool dmxRealizeCursor(ScreenPtr p
         return _dmxRealizeCursor(pScreen, pCursor);
 
     for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
-        if (pt->cursorNotShared) continue;
+        if (pt->cursorNotShared)
+            continue;
         _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
-        if (pt == start) break;
+        if (pt == start)
+            break;
     }
     return TRUE;
 }
@@ -747,9 +773,11 @@ static Bool dmxUnrealizeCursor(ScreenPtr
         return _dmxUnrealizeCursor(pScreen, pCursor);
 
     for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
-        if (pt->cursorNotShared) continue;
+        if (pt->cursorNotShared)
+            continue;
         _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
-        if (pt == start) break;
+        if (pt == start)
+            break;
     }
     return TRUE;
 }
@@ -758,10 +786,13 @@ static CursorPtr dmxFindCursor(DMXScreen
 {
     DMXScreenInfo *pt;
 
-    if (!start || !start->over) return GetSpriteCursor();
+    if (!start || !start->over)
+        return GetSpriteCursor();
     for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
-        if (pt->cursor) return pt->cursor;
-        if (pt == start) break;
+        if (pt->cursor)
+            return pt->cursor;
+        if (pt == start)
+            break;
     }
     return GetSpriteCursor();
 }
@@ -769,7 +800,12 @@ static CursorPtr dmxFindCursor(DMXScreen
 /** Move the cursor to coordinates (\a x, \a y)on \a pScreen.  This
  * function is usually called via #dmxPointerSpriteFuncs, except during
  * reconfiguration when the cursor is repositioned to force an update on
- * newley overlapping screens and on screens that no longer overlap. */
+ * newley overlapping screens and on screens that no longer overlap.
+ *
+ * The coords (x,y) are in global coord space.  We'll loop over the
+ * back-end screens and see if they contain the global coord.  If so, call
+ * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
+ */
 void dmxMoveCursor(ScreenPtr pScreen, int x, int y)
 {
     DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
@@ -783,7 +819,8 @@ void dmxMoveCursor(ScreenPtr pScreen, in
     }
 
     for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
-        if (pt->cursorNotShared) continue;
+        if (pt->cursorNotShared)
+            continue;
         if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
             if (/* pt != start && */ !pt->cursorVisible) {
                 if (!pt->cursor) {
@@ -811,7 +848,8 @@ void dmxMoveCursor(ScreenPtr pScreen, in
                           x + start->rootXOrigin - pt->rootXOrigin,
                           y + start->rootYOrigin - pt->rootYOrigin);
         }
-        if (pt == start) break;
+        if (pt == start)
+            break;
     }
 }
 
@@ -851,7 +889,8 @@ static void dmxSetCursor(ScreenPtr pScre
     }
 
     for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
-        if (pt->cursorNotShared) continue;
+        if (pt->cursorNotShared)
+            continue;
         if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
             _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
                           x + start->rootXOrigin - pt->rootXOrigin,
@@ -861,7 +900,8 @@ static void dmxSetCursor(ScreenPtr pScre
                           x + start->rootXOrigin - pt->rootXOrigin,
                           y + start->rootYOrigin - pt->rootYOrigin);
         }
-        if (pt == start) break;
+        if (pt == start)
+            break;
     }
 }
 
diff-tree 9f24798af50896cc3262c1201f75c10a688f2a83 (from 76756f27561c6386cba0d338441e8ec7b98500ce)
Author: Brian <brian at yutani.localnet.net>
Date:   Fri Mar 30 12:49:34 2007 -0600

    ompile fbcmap.c w/ -DXFree86Server instead of linking libfbcmap.a.
    
    The former works, the later doesn't (DMX blows up on visuals/pixel formats).
    This undos Daniel's patch, which undid my prev patch.  Revisit someday.

diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 17d27ed..41dc5d2 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -2,7 +2,6 @@ DIST_SUBDIRS = input config glxProxy exa
 
 SUBDIRS = input config examples
 bin_PROGRAMS = Xdmx
-noinst_LIBRARIES = libfbcmap.a
 
 if XINERAMA
 PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c
@@ -17,6 +16,9 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/di
 GLX_DEFS = @GL_CFLAGS@ 
 endif
 
+# It's essential that fbcmap.c be compiled with this flag for DMX to work!!
+DMX_CFLAGS = -DXFree86Server=1
+
 if BUILDDOCS
 SUBDIRS += doc
 endif
@@ -26,11 +28,9 @@ AM_CFLAGS = \
       $(DIX_CFLAGS) \
       $(GLX_INCS) \
       $(GLX_DEFS) \
+      $(DMX_CFLAGS) \
       @DMXMODULES_CFLAGS@
 
-libfbcmap_a_SOURCES = libfbcmap.a
-libfbcmap_a_CFLAGS = $(AM_CFLAGS) -DXFree86Server
-
 Xdmx_SOURCES = dmx.c \
                dmxcb.c \
                dmxcb.h \
@@ -76,6 +76,7 @@ Xdmx_SOURCES = dmx.c \
                dmxwindow.c \
                dmxwindow.h \
                $(top_srcdir)/mi/miinitext.c \
+               $(top_srcdir)/fb/fbcmap.c \
                $(GLX_SRCS) 
 
 
@@ -89,7 +90,6 @@ Xdmx_LDADD = $(XORG_CORE_LIBS) \
              $(GLX_LIBS) \
              input/libdmxinput.a \
              config/libdmxconfig.a \
-	     libfbcmap.a \
              @DMXMODULES_LIBS@
 
 # Man page



More information about the xorg-commit mailing list