xserver: Branch 'master' - 9 commits

Brian Paul brianp at kemper.freedesktop.org
Tue Apr 3 01:26:24 EEST 2007


 hw/dmx/input/dmxbackend.c   |   17 --
 hw/dmx/input/dmxcommon.c    |   16 +-
 hw/dmx/input/dmxconsole.c   |    9 -
 hw/dmx/input/dmxdummy.c     |    2 
 hw/dmx/input/dmxevents.c    |  351 ++++++++++++--------------------------------
 hw/dmx/input/dmxinputinit.c |    5 
 6 files changed, 124 insertions(+), 276 deletions(-)

New commits:
diff-tree e44f106ffc796c025abdfb66717c06db8b12b4e4 (from 8d8bc8927760fad631bef83fa2841b455ff6d511)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 16:26:15 2007 -0600

    clean-up, debug code

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 288570d..e4d556b 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -109,11 +109,11 @@ static int dmxCheckFunctionKeys(DMXLocal
     else if (dmxLocal->pDevice->key)
         state = dmxLocal->pDevice->key->state;
     
-    DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
+    ErrorF/*DMXDBG3*/("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
             keySym, type == KeyPress ? "press" : "release", state);
 
     if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
-       return 0;
+        return 0;
 
     switch (keySym) {
     case XK_g:
@@ -679,7 +679,7 @@ void dmxEnqueue(DevicePtr pDev, int type
             xE.u.u.detail = dmxFixup(pDev, detail, keySym);
 
         events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-        ErrorF("KEY %d\n", detail);
+        ErrorF("KEY %d  sym %d\n", detail, (int) keySym);
         nevents = GetKeyboardEvents(events, p, type, detail);
         for (i = 0; i < nevents; i++)
             mieqEnqueue(p, events + i);
@@ -719,12 +719,12 @@ 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
         if (type == ProximityIn || type == ProximityOut) {
-            if (dmxLocal->sendsCore) return; /* Not a core event */
+            if (dmxLocal->sendsCore)
+                return; /* Not a core event */
             break;
         }
 #endif
diff-tree 8d8bc8927760fad631bef83fa2841b455ff6d511 (from 3e482de7b145a5eed79b81c30c359fe43647824a)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 16:21:57 2007 -0600

    fix formatting

diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c
index 278a74e..1dcc1e9 100644
--- a/hw/dmx/input/dmxcommon.c
+++ b/hw/dmx/input/dmxcommon.c
@@ -241,13 +241,15 @@ void dmxCommonKbdGetMap(DevicePtr pDev, 
 
                                 /* Compute pModMap  */
     modifier_mapping     = XGetModifierMapping(priv->display);
-    for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = 0;
+    for (i = 0; i < MAP_LENGTH; i++)
+        pModMap[i] = 0;
     for (j = 0; j < 8; j++) {
         int max_keypermod = modifier_mapping->max_keypermod;
         
         for (i = 0; i < max_keypermod; i++) {
             CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
-            if (keycode) pModMap[keycode] |= 1 << j;
+            if (keycode)
+                pModMap[keycode] |= 1 << j;
         }
     }
     XFreeModifiermap(modifier_mapping);
@@ -611,6 +613,7 @@ void dmxCommonSaveState(pointer private)
                         &priv->dmxLocal->kctrl);
 
     priv->savedModMap                   = XGetModifierMapping(priv->display);
+
     modmap                              = XNewModifiermap(0);
     XSetModifierMapping(priv->display, modmap);
     if (dmxInput->scrnIdx != -1)
@@ -627,8 +630,10 @@ void dmxCommonRestoreState(pointer priva
     int retcode = -1;
     CARD32 start;
 
-    if (dmxInput->console) priv = dmxInput->devs[0]->private;
-    if (!priv->stateSaved) return;
+    if (dmxInput->console)
+        priv = dmxInput->devs[0]->private;
+    if (!priv->stateSaved)
+        return;
     priv->stateSaved = 0;
     
     DMXDBG0("dmxCommonRestoreState\n");
@@ -645,7 +650,8 @@ void dmxCommonRestoreState(pointer priva
         CARD32 tmp;
         
         retcode = XSetModifierMapping(priv->display, priv->savedModMap);
-        if (retcode == MappingSuccess) break;
+        if (retcode == MappingSuccess)
+            break;
         if (retcode == MappingBusy)
             dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
         else
diff-tree 3e482de7b145a5eed79b81c30c359fe43647824a (from 76a7a5ca1f068c27c9b5fbd49d5a1da80ed6f488)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 15:38:15 2007 -0600

    checkpoint: more clean-up

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 17047f7..288570d 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -662,70 +662,56 @@ void dmxEnqueue(DevicePtr pDev, int type
 {
     GETDMXINPUTFROMPDEV;
     xEvent xE;
+    DeviceIntPtr p = dmxLocal->pDevice;
+    int i, nevents, valuators[3];
+    xEvent *events;
 
     DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
 
     switch (type) {
     case KeyPress:
     case KeyRelease:
-        if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+        if (!keySym)
+            keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
         if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
             return;
         if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
             xE.u.u.detail = dmxFixup(pDev, detail, keySym);
-        {
-           DeviceIntPtr p = dmxLocal->pDevice;
-           int i, nevents;
-           xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-           ErrorF("KEY %d\n", detail);
-           nevents = GetKeyboardEvents(events, p, type, detail);
-           for (i = 0; i < nevents; i++)
-              mieqEnqueue(p, events + i);
-           xfree(events);
-           return;
-        }
-        break;
+
+        events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+        ErrorF("KEY %d\n", detail);
+        nevents = GetKeyboardEvents(events, p, type, detail);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, events + i);
+        xfree(events);
+        return;
+
     case ButtonPress:
     case ButtonRelease:
         detail = dmxGetButtonMapping(dmxLocal, detail);
-        {
-           DeviceIntPtr p = dmxLocal->pDevice;
-           int i, nevents, valuators[3];
-           xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-           valuators[2] = e->xbutton.button;
-           nevents = GetPointerEvents(events, p, type, detail,
-                                      POINTER_ABSOLUTE,
-                                      0,   /* first_valuator = 0 */
-                                      0,   /* num_valuators = 0 */
-                                      valuators);
-
-           ErrorF("BUTTON %d, %d %d  n=%d\n",
-                  valuators[0], valuators[1], valuators[2], nevents);
-
-           for (i = 0; i < nevents; i++)
-              mieqEnqueue(p, events + i);
-           xfree(events);
-           return;
-        }
-        break;
+        events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+        nevents = GetPointerEvents(events, p, type, detail,
+                                   POINTER_ABSOLUTE,
+                                   0,   /* first_valuator = 0 */
+                                   0,   /* num_valuators = 0 */
+                                   valuators);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, events + i);
+        xfree(events);
+        return;
+
     case MotionNotify:
-        {
-           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, p, type, detail, 
-                                      POINTER_ABSOLUTE, 0, 3, valuators);
-           ErrorF("MOTION %d, %d  n = %d\n", valuators[0], valuators[1], nevents);
-           for (i = 0; i < nevents; i++)
-              mieqEnqueue(p, events + i);
-           xfree(events);
-           return;
-        }
-        break;
-                                /* Always ignore these events */
+        events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+        valuators[0] = e->xmotion.x;
+        valuators[1] = e->xmotion.y;
+        valuators[2] = e->xmotion.state;
+        nevents = GetPointerEvents(events, p, type, detail, 
+                                   POINTER_ABSOLUTE, 0, 3, valuators);
+        for (i = 0; i < nevents; i++)
+            mieqEnqueue(p, events + i);
+        xfree(events);
+        return;
+
     case EnterNotify:
     case LeaveNotify:
     case KeymapNotify:
@@ -754,25 +740,19 @@ void dmxEnqueue(DevicePtr pDev, int type
         return;
     }
 
+#if 00 /* dead code? */
     memset(&xE, 0, sizeof(xE));
     xE.u.u.type                = type;
     xE.u.u.detail              = detail;
     xE.u.keyButtonPointer.time = GetTimeInMillis();
 
 #ifdef XINPUT
-    if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block);
+    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
+#endif /*00*/
 }
 
 /** A pointer to this routine is passed to low-level input drivers so
diff-tree 76a7a5ca1f068c27c9b5fbd49d5a1da80ed6f488 (from 69baad321d35dae0bfa535be0c6ed2131fed1e60)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 15:24:05 2007 -0600

    formatting fixes

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index bca1a10..17047f7 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -112,7 +112,8 @@ static int dmxCheckFunctionKeys(DMXLocal
     DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
             keySym, type == KeyPress ? "press" : "release", state);
 
-    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
+    if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+       return 0;
 
     switch (keySym) {
     case XK_g:
@@ -147,16 +148,25 @@ static void dmxEnqueueExtEvent(DMXLocalI
     int                    type      = e->u.u.type;
 
     switch (e->u.u.type) {
-    case KeyPress:      type = DeviceKeyPress;      break;
-    case KeyRelease:    type = DeviceKeyRelease;    break;
-    case ButtonPress:   type = DeviceButtonPress;   break;
-    case ButtonRelease: type = DeviceButtonRelease; break;
+    case KeyPress:
+        type = DeviceKeyPress;
+        break;
+    case KeyRelease:
+        type = DeviceKeyRelease;
+        break;
+    case ButtonPress:
+        type = DeviceButtonPress;
+        break;
+    case ButtonRelease:
+        type = DeviceButtonRelease;
+        break;
     case MotionNotify:
         dmxLog(dmxError,
                "dmxEnqueueExtEvent: MotionNotify not allowed here\n");
         return;
     default:
-        if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) break;
+        if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut)
+            break;
         dmxLogInput(dmxInput,
                     "dmxEnqueueExtEvent: Unhandled %s event (%d)\n",
                     e->u.u.type >= LASTEvent ? "extension" : "non-extension",
@@ -174,9 +184,11 @@ static void dmxEnqueueExtEvent(DMXLocalI
     xv->num_valuators  = 0;
     xv->first_valuator = 0;
 
-    if (block) dmxSigioBlock();
+    if (block)
+        dmxSigioBlock();
     dmxeqEnqueue(xE);
-    if (block) dmxSigioUnblock();
+    if (block)
+        dmxSigioUnblock();
 }
 #endif
 
@@ -186,7 +198,8 @@ DMXScreenInfo *dmxFindFirstScreen(int x,
 
     for (i = 0; i < dmxNumScreens; i++) {
         DMXScreenInfo *dmxScreen = &dmxScreens[i];
-        if (dmxOnScreen(x, y, dmxScreen)) return dmxScreen;
+        if (dmxOnScreen(x, y, dmxScreen))
+            return dmxScreen;
     }
     return NULL;
 }
@@ -223,7 +236,8 @@ dmxCoreMotion(DevicePtr pDev, int x, int
     int           localY;
     int           i;
 
-    if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return;
+    if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
+        return;
     
     DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
             x, y, delta, dmxGlobalX, dmxGlobalY);
@@ -232,10 +246,14 @@ dmxCoreMotion(DevicePtr pDev, int x, int
     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;
+    if (dmxGlobalX < 0)
+        dmxGlobalX = 0;
+    if (dmxGlobalY < 0)
+        dmxGlobalY = 0;
+    if (dmxGlobalX >= dmxGlobalWidth)
+        dmxGlobalX = dmxGlobalWidth  + delta -1;
+    if (dmxGlobalY >= dmxGlobalHeight)
+        dmxGlobalY = dmxGlobalHeight + delta -1;
     
     if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
         localX = dmxGlobalX - dmxScreen->rootXOrigin;
@@ -283,7 +301,6 @@ dmxCoreMotion(DevicePtr pDev, int x, int
                                  * 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
@@ -386,10 +403,12 @@ static void dmxExtMotion(DMXLocalInputIn
         }
     }
 
-    if (block) dmxSigioBlock();
+    if (block)
+        dmxSigioBlock();
     dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time);
     dmxeqEnqueue(xE);
-    if (block) dmxSigioUnblock();
+    if (block)
+        dmxSigioUnblock();
 }
 
 static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
@@ -403,7 +422,8 @@ static int dmxTranslateAndEnqueueExtEven
     XDeviceKeyEvent        *ke     = (XDeviceKeyEvent *)e;
     XDeviceMotionEvent     *me     = (XDeviceMotionEvent *)e;
 
-    if (!e) return -1;          /* No extended event passed, cannot handle */
+    if (!e)
+        return -1;          /* No extended event passed, cannot handle */
     
     if ((XID)dmxLocal->deviceId != ke->deviceid) {
                                 /* Search for the correct dmxLocal,
@@ -414,7 +434,8 @@ static int dmxTranslateAndEnqueueExtEven
         DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
         for (i = 0; i < dmxInput->numDevs; i++) {
             dmxLocal = dmxInput->devs[i];
-            if ((XID)dmxLocal->deviceId == ke->deviceid) break;
+            if ((XID)dmxLocal->deviceId == ke->deviceid)
+                break;
         }
     }
 
@@ -463,9 +484,11 @@ static int dmxTranslateAndEnqueueExtEven
         xv->valuator4      = ke->axis_data[4];
         xv->valuator5      = ke->axis_data[5];
 
-        if (block) dmxSigioBlock();
+        if (block)
+            dmxSigioBlock();
         dmxeqEnqueue(xE);
-        if (block) dmxSigioUnblock();
+        if (block)
+            dmxSigioUnblock();
         break;
 
     case XI_DeviceMotionNotify:
@@ -568,7 +591,8 @@ static KeySym dmxKeyCodeToKeySym(DMXLoca
     if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
         return NoSymbol;
     pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
-    if (!pKeySyms) return NoSymbol;
+    if (!pKeySyms)
+        return NoSymbol;
     
     if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
         DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
@@ -617,8 +641,10 @@ static int dmxFixup(DevicePtr pDev, int 
                dmxLocal->pDevice->name);
         return NoSymbol;
     }
-    if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
-    if (keySym == NoSymbol) return detail;
+    if (!keySym)
+        keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+    if (keySym == NoSymbol)
+        return detail;
     keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
 
     return keyCode ? keyCode : detail;
diff-tree 69baad321d35dae0bfa535be0c6ed2131fed1e60 (from 44eb15adeee3b299677070f39625daa53679bd13)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 15:21:22 2007 -0600

    clean-up dmxCoreMotion() dmxCoreMotion2()

diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c
index 3634324..bca1a10 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -192,8 +192,6 @@ DMXScreenInfo *dmxFindFirstScreen(int x,
 }
 
 
-#if 11/*BP*/
-
 /**
  * Enqueue a motion event.
  */
@@ -215,8 +213,8 @@ static void enqueueMotion(DevicePtr pDev
 }
 
 
-static void
-dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
+void
+dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
 {
     DMXScreenInfo *dmxScreen;
     DMXInputInfo  *dmxInput;
@@ -239,8 +237,6 @@ dmxCoreMotion2(DevicePtr pDev, int x, in
     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;
@@ -249,13 +245,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, in
                                 /* 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 {
@@ -267,13 +258,8 @@ dmxCoreMotion2(DevicePtr pDev, int x, in
             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();
         }
@@ -307,105 +293,6 @@ dmxCoreMotion2(DevicePtr pDev, int x, in
     }
     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;
-    
-    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 */
-            DMXDBG4("   New screen: old=%d new=%d localX=%d localY=%d\n",
-                    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"
-                    " on screen index=%d/%d localX=%d localY=%d\n",
-                    dmxGlobalX, dmxGlobalY,
-                    dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
-                    localX, localY);
-        }
-    }
-                                /* 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();
-}
 
 
 
@@ -760,25 +647,20 @@ 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());
+           ErrorF("KEY %d\n", detail);
            nevents = GetKeyboardEvents(events, p, type, detail);
-           ErrorF("KEY %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
         detail = dmxGetButtonMapping(dmxLocal, detail);
         {
            DeviceIntPtr p = dmxLocal->pDevice;
@@ -799,15 +681,8 @@ void dmxEnqueue(DevicePtr pDev, int type
            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];
@@ -815,25 +690,14 @@ void dmxEnqueue(DevicePtr pDev, int type
            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, 3, valuators);
+           nevents = GetPointerEvents(events, p, type, detail, 
+                                      POINTER_ABSOLUTE, 0, 3, valuators);
            ErrorF("MOTION %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;
         }
-#endif
         break;
                                 /* Always ignore these events */
     case EnterNotify:
diff-tree 44eb15adeee3b299677070f39625daa53679bd13 (from 0f873a9d4f02b399c37b4058c6a9a2e21aa205e8)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 15:12:04 2007 -0600

    checkpoint clean-up

diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c
index 315979e..7aa8510 100644
--- a/hw/dmx/input/dmxbackend.c
+++ b/hw/dmx/input/dmxbackend.c
@@ -242,11 +242,7 @@ 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);
@@ -397,7 +393,6 @@ void dmxBackendCollectEvents(DevicePtr p
             }
             break;
 	case MotionNotify:
-#if 001 /*BP*/
             DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
                     " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
                     dmxScreen->index, priv->myScreen,
@@ -451,25 +446,15 @@ 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);
-           /* fall-through */
-#endif
+            /* fall-through */
 	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 d174a59..3634324 100644
--- a/hw/dmx/input/dmxevents.c
+++ b/hw/dmx/input/dmxevents.c
@@ -194,30 +194,20 @@ DMXScreenInfo *dmxFindFirstScreen(int x,
 
 #if 11/*BP*/
 
+/**
+ * Enqueue a motion event.
+ */
 static void enqueueMotion(DevicePtr pDev, int x, int y)
 {
-    GETDMXINPUTFROMPDEV;
+    GETDMXLOCALFROMPDEV;
     DeviceIntPtr p = dmxLocal->pDevice;
     int i, nevents, valuators[3];
     xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-    int detail = 0;
-
+    int detail = 0;  /* XXX should this be mask of pressed buttons? */
     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);
-    */
+    nevents = GetPointerEvents(events, p, MotionNotify, detail,
+                               POINTER_ABSOLUTE, 0, 2, valuators);
     for (i = 0; i < nevents; i++)
        mieqEnqueue(p, events + i);
     xfree(events);
@@ -347,8 +337,6 @@ void dmxCoreMotion(DevicePtr pDev, int x
     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;
@@ -397,7 +385,6 @@ void dmxCoreMotion(DevicePtr pDev, int x
 #endif
             dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
             dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
-           ErrorF("Global is now %d, %d\n", dmxGlobalX, dmxGlobalY);
             DMXDBG6("   Moved to dmxGlobalX=%d dmxGlobalY=%d"
                     " on screen index=%d/%d localX=%d localY=%d\n",
                     dmxGlobalX, dmxGlobalY,
@@ -750,7 +737,7 @@ static int dmxFixup(DevicePtr pDev, int 
     return keyCode ? keyCode : detail;
 }
 
-/** Enqueue a non-motion event from the \a pDev device with the
+/** Enqueue an event from the \a pDev device with the
  * specified \a type and \a detail.  If the event is a KeyPress or
  * KeyRelease event, then the \a keySym is also specified.
  *
@@ -778,10 +765,7 @@ void dmxEnqueue(DevicePtr pDev, int type
            DeviceIntPtr p = dmxLocal->pDevice;
            int i, nevents;
            xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
-           nevents = GetKeyboardEvents(events,
-                                       /*pDev*/p,
-                                       /*KeyPress*/type,
-                                       /*n*/detail);
+           nevents = GetKeyboardEvents(events, p, type, detail);
            ErrorF("KEY %d  n=%d\n", detail, nevents);
            for (i = 0; i < nevents; i++)
               mieqEnqueue(p, events + i);
@@ -795,6 +779,7 @@ void dmxEnqueue(DevicePtr pDev, int type
 #if 00 /*BP*/
         detail = dmxGetButtonMapping(dmxLocal, detail);
 #else
+        detail = dmxGetButtonMapping(dmxLocal, detail);
         {
            DeviceIntPtr p = dmxLocal->pDevice;
            int i, nevents, valuators[3];
diff-tree 0f873a9d4f02b399c37b4058c6a9a2e21aa205e8 (from 3a0ce1084a18e17a3c8a009d99c228652b8763a9)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 14:51:38 2007 -0600

    remove some debug code

diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index d14aeb7..a9d902e 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -505,7 +505,6 @@ static int dmxDeviceOnOff(DeviceIntPtr p
                                               GetMaximumEventsNum(),
 #endif
                                               Relative);
-                ErrorF("MOTION BUFFER SIZE %d\n", GetMaximumEventsNum());
 #ifdef XINPUT
                 for (i = 0; i < info.numRelAxes; i++)
                     InitValuatorAxisStruct(pDevice, i, info.minval[0],
@@ -588,10 +587,6 @@ static void dmxProcessInputEvents(DMXInp
 {
     int i;
 
-    /*
-    ErrorF("%s\n", __FUNCTION__);
-    */
-
     dmxeqProcessInputEvents();
 #if 00 /*BP*/
     miPointerUpdate();
diff-tree 3a0ce1084a18e17a3c8a009d99c228652b8763a9 (from 12016f20f7f5365f30cfbeb05568b3fb89759e5a)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 14:51:21 2007 -0600

    for completeness, init dummy's min/maxval[1] values (vertical axis)

diff --git a/hw/dmx/input/dmxdummy.c b/hw/dmx/input/dmxdummy.c
index d6e614e..b9c72b0 100644
--- a/hw/dmx/input/dmxdummy.c
+++ b/hw/dmx/input/dmxdummy.c
@@ -79,7 +79,9 @@ void dmxDummyMouGetInfo(DevicePtr pDev, 
     info->valuatorClass    = 1;
     info->numRelAxes       = 2;
     info->minval[0]        = 0;
+    info->minval[1]        = 0;
     info->maxval[0]        = 0;
+    info->maxval[1]        = 0;
     info->res[0]           = 1;
     info->minres[0]        = 0;
     info->maxres[0]        = 1;
diff-tree 12016f20f7f5365f30cfbeb05568b3fb89759e5a (from 0aaf28e5633a59563b89a2e42d19fabc84adc3ed)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Apr 2 14:50:48 2007 -0600

    As for normal mouse device, init valuator maxval[] to real values, not zero.

diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c
index 835909e..aac5e08 100644
--- a/hw/dmx/input/dmxconsole.c
+++ b/hw/dmx/input/dmxconsole.c
@@ -860,12 +860,17 @@ void dmxConsoleInit(DevicePtr pDev)
  * for pointers. */
 void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
 {
+    GETPRIVFROMPDEV;
+
     info->buttonClass      = 1;
     dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
     info->valuatorClass    = 1;
     info->numRelAxes       = 2;
-    info->minval[0]        = 0;
-    info->maxval[0]        = 0;
+    info->minval[0] = 0;
+    info->minval[1] = 0;
+    /* max possible console window size: */
+    info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
+    info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
     info->res[0]           = 1;
     info->minres[0]        = 0;
     info->maxres[0]        = 1;



More information about the xorg-commit mailing list