xserver: Branch 'input-hotplug' - 13 commits

Daniel Stone daniels at kemper.freedesktop.org
Fri Oct 20 00:43:36 EEST 2006


 GL/glx/glxdri.c                      |    7 +
 Xi/chgdctl.c                         |   23 +++++
 Xi/getdctl.c                         |   24 +++++
 Xi/getdctl.h                         |    5 +
 cfb/cfbteblt8.c                      |    2 
 config/config.c                      |   14 +--
 configure.ac                         |   14 +--
 dix/devices.c                        |    4 
 dix/getevents.c                      |   54 ++++++++++--
 fb/fbpict.c                          |   25 +++++
 hw/kdrive/src/kinput.c               |   10 +-
 hw/xfree86/Makefile.am               |   18 ++++
 hw/xfree86/common/xf86Cursor.c       |    5 -
 hw/xfree86/common/xf86DGA.c          |   46 ----------
 hw/xfree86/common/xf86Events.c       |   13 ---
 hw/xfree86/common/xf86Init.c         |    4 
 hw/xfree86/common/xf86Module.h       |    2 
 hw/xfree86/common/xf86Xinput.c       |   21 ----
 hw/xfree86/common/xf86xv.c           |   66 ++++++++++++++-
 hw/xfree86/common/xf86xv.h           |    3 
 hw/xfree86/common/xf86xvpriv.h       |    1 
 hw/xfree86/loader/xf86sym.c          |    1 
 hw/xfree86/utils/xorgcfg/Makefile.am |   20 +++-
 hw/xfree86/xorgconf.cpp              |    5 -
 include/dix-config.h.in              |    3 
 include/input.h                      |    3 
 include/inputstr.h                   |    1 
 mi/mi.h                              |    1 
 mi/mieq.c                            |  150 ++++++++++++++++-------------------
 29 files changed, 336 insertions(+), 209 deletions(-)

New commits:
diff-tree aeba855b07832354f59678e20cc29a085e42bd99 (from a8d3dad9d9f2b9053843e655abe463a68ba8dcb7)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Oct 20 00:30:28 2006 +0300

    move keymap copy to event processing, from enqueuing
    
    Move the keymap copying to event processing time (in
    ProcessInputEvents), instead of being at event enqueuing time.
    Break SetCore{Pointer,Keyboard} out into separate functions.
    Change mieqEnqueue to take a device pointer, that asks for the
    _original_ device associated with this event.

diff --git a/dix/getevents.c b/dix/getevents.c
index 4f96080..42b9df9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -481,19 +481,19 @@ GetPointerEvents(xEvent *events, DeviceI
             xv->deviceid = kbp->deviceid;
             switch (final_valuator - i) {
             case 6:
-                xv->valuator5 = valuators[i+5];
+                xv->valuator5 = valuators[i + 5];
             case 5:
-                xv->valuator4 = valuators[i+4];
+                xv->valuator4 = valuators[i + 4];
             case 4:
-                xv->valuator3 = valuators[i+3];
+                xv->valuator3 = valuators[i + 3];
             case 3:
-                xv->valuator2 = valuators[i+2];
+                xv->valuator2 = valuators[i + 2];
             case 2:
                 /* x and y may have been accelerated. */
                 if (i == 0)
                     xv->valuator1 = kbp->root_y;
                 else
-                    xv->valuator1 = valuators[i+1];
+                    xv->valuator1 = valuators[i + 1];
             case 1:
                 /* x and y may have been accelerated. */
                 if (i == 0)
@@ -520,11 +520,47 @@ GetPointerEvents(xEvent *events, DeviceI
         else {
             events->u.u.detail = 0;
         }
-
-        if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
-            pDev)
-            inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
     }
 
     return num_events;
 }
+
+void SwitchCoreKeyboard(DeviceIntPtr pDev)
+{
+    KeyClassPtr ckeyc = inputInfo.keyboard->key;
+
+    if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
+        memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
+        if (ckeyc->modifierKeyMap)
+            xfree(ckeyc->modifierKeyMap);
+        ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
+        memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
+                (8 * pDev->key->maxKeysPerModifier));
+
+        ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
+        ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
+        ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
+        SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
+
+#ifdef XKB
+        if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
+            if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
+                               True))
+                FatalError("Couldn't pivot keymap from device to core!\n");
+        }
+#endif
+
+        SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
+                          (ckeyc->curKeySyms.maxKeyCode -
+                           ckeyc->curKeySyms.minKeyCode),
+                          serverClient);
+        inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+    }
+}
+
+/* Currently a no-op. */
+void SwitchCorePointer(DeviceIntPtr pDev)
+{
+    if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
+        inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 8dd3728..449be9e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1656,10 +1656,10 @@ char *kdActionNames[] = {
 #endif
 
 static void
-KdQueueEvent (xEvent *ev)
+KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
 {
     KdAssertSigioBlocked ("KdQueueEvent");
-    mieqEnqueue (ev);
+    mieqEnqueue (pDev, ev);
 }
 
 /* We return true if we're stealing the event. */
@@ -1862,7 +1862,7 @@ KdReleaseAllKeys (void)
                 KdHandleKeyboardEvent(ki, KeyRelease, key);
                 nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
                 for (i = 0; i < nEvents; i++)
-                    KdQueueEvent (kdEvents + i);
+                    KdQueueEvent (ki->dixdev, kdEvents + i);
             }
         }
     }
@@ -1934,7 +1934,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo   
         ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
 #endif
         for (i = 0; i < nEvents; i++)
-            KdQueueEvent(kdEvents + i);
+            KdQueueEvent(ki->dixdev, kdEvents + i);
     }
     else {
         ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
@@ -2052,7 +2052,7 @@ _KdEnqueuePointerEvent (KdPointerInfo *p
     nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
                                valuators);
     for (i = 0; i < nEvents; i++)
-        KdQueueEvent(kdEvents + i);
+        KdQueueEvent(pi->dixdev, kdEvents + i);
 }
 
 void
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index cb77839..204457f 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -909,22 +909,6 @@ DGAVTSwitch(void)
 Bool
 DGAStealKeyEvent(int index, xEvent *e)
 {
-   DGAScreenPtr pScreenPriv;
-    dgaEvent	de;
-
-   if(DGAScreenIndex < 0) /* no DGA */
-	return FALSE;
-
-   pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
-   if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
-	return FALSE;
-
-    de.u.u.type = e->u.u.type + *XDGAEventBase;
-    de.u.u.detail = e->u.u.detail;
-    de.u.event.time = e->u.keyButtonPointer.time;
-    mieqEnqueue ((xEvent *) &de);
-   return TRUE;
 }
 
 static int  DGAMouseX, DGAMouseY;
@@ -932,36 +916,6 @@ static int  DGAMouseX, DGAMouseY;
 Bool
 DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
 {
-   DGAScreenPtr pScreenPriv;
-    dgaEvent	de;
-
-   if(DGAScreenIndex < 0) /* no DGA */
-	return FALSE;
-
-   pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
-   if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
-	return FALSE;
-    
-    DGAMouseX += dx;
-    if (DGAMouseX < 0)
-	DGAMouseX = 0;
-    else if (DGAMouseX > screenInfo.screens[index]->width)
-	DGAMouseX = screenInfo.screens[index]->width;
-    DGAMouseY += dy;
-    if (DGAMouseY < 0)
-	DGAMouseY = 0;
-    else if (DGAMouseY > screenInfo.screens[index]->height)
-	DGAMouseY = screenInfo.screens[index]->height;
-    de.u.u.type = e->u.u.type + *XDGAEventBase;
-    de.u.u.detail = e->u.u.detail;
-    de.u.event.time = e->u.keyButtonPointer.time;
-    de.u.event.dx = dx;
-    de.u.event.dy = dy;
-    de.u.event.pad1 = DGAMouseX;
-    de.u.event.pad2 = DGAMouseY;
-    mieqEnqueue ((xEvent *) &de);
-    return TRUE;
 }
 
 Bool
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index db259b3..3df201a 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -104,19 +104,12 @@ extern Bool noXkbExtension;
 #define XE_POINTER  1
 #define XE_KEYBOARD 2
 
-#define __EqEnqueue(ev) mieqEnqueue(ev)
-
-#define EqEnqueue(ev) { \
+#define EqEnqueue(pDev, ev) { \
     int __sigstate = xf86BlockSIGIO (); \
-    __EqEnqueue (ev); \
+    mieqEnqueue (pDev, ev); \
     xf86UnblockSIGIO(__sigstate); \
 }
 
-#define ENQUEUE(ev, code, direction, dev_type) \
-  (ev)->u.u.detail = (code); \
-  (ev)->u.u.type   = (direction); \
-  EqEnqueue((ev))
-
 /*
  * The first of many hacks to get VT switching to work under
  * Solaris 2.1 for x86. The basic problem is that Solaris is supposed
@@ -839,7 +832,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
                 else {
                     nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
                     for (j = 0; j < nevents; j++)
-                        mieqEnqueue(xf86Events + i);
+                        EqEnqueue(pDev, xf86Events + i);
                 }
                 break;
             }
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 411dedd..97c038f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -656,20 +656,7 @@ xf86PostMotionEvent(DeviceIntPtr	device,
                                valuators);
 
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(xf86Events + i);
-    
-#if 0
-    if (HAS_MOTION_HISTORY(local)) {
-      buff = ((char *)local->motion_history +
-              (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
-    }
-
-    if (HAS_MOTION_HISTORY(local)) {
-        local->last = (local->last + 1) % device->valuator->numMotionEvents;
-        if (local->last == local->first)
-            local->first = (local->first + 1) % device->valuator->numMotionEvents;
-    }
-#endif
+        mieqEnqueue(device, xf86Events + i);
 }
 
 _X_EXPORT void
@@ -795,7 +782,7 @@ xf86PostButtonEvent(DeviceIntPtr	device,
                                first_valuator, num_valuators, valuators);
 
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(xf86Events + i);
+        mieqEnqueue(device, xf86Events + i);
 }
 
 _X_EXPORT void
@@ -839,7 +826,7 @@ xf86PostKeyEvent(DeviceIntPtr	device,
     }
 
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(xf86Events + i);
+        mieqEnqueue(device, xf86Events + i);
 }
 
 _X_EXPORT void
@@ -858,7 +845,7 @@ xf86PostKeyboardEvent(DeviceIntPtr      
                                 is_down ? KeyPress : KeyRelease, key_code);
 
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(xf86Events + i);
+        mieqEnqueue(device, xf86Events + i);
 }
 
 /* 
diff --git a/include/input.h b/include/input.h
index 3e3d16d..a9eeb3f 100644
--- a/include/input.h
+++ b/include/input.h
@@ -406,6 +406,9 @@ extern int GetKeyboardValuatorEvents(
     int num_valuator,
     int *valuators);
 
+extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
+extern void SwitchCorePointer(DeviceIntPtr pDev);
+
 extern DeviceIntPtr LookupDeviceIntRec(
     CARD8 deviceid);
 
diff --git a/mi/mi.h b/mi/mi.h
index 89d460f..8d9d120 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -173,6 +173,7 @@ extern Bool mieqInit(
 );
 
 extern void mieqEnqueue(
+    DeviceIntPtr /*pDev*/,
     xEventPtr /*e*/
 );
 
diff --git a/mi/mieq.c b/mi/mieq.c
index 16e638c..0ac68d6 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -73,14 +73,14 @@ typedef struct _EventQueue {
 static EventQueueRec miEventQueue;
 
 Bool
-mieqInit ()
+mieqInit()
 {
     miEventQueue.head = miEventQueue.tail = 0;
     miEventQueue.lastEventTime = GetTimeInMillis ();
     miEventQueue.lastMotion = FALSE;
     miEventQueue.pEnqueueScreen = screenInfo.screens[0];
     miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
-    SetInputCheck (&miEventQueue.head, &miEventQueue.tail);
+    SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
     return TRUE;
 }
 
@@ -92,57 +92,39 @@ mieqInit ()
  */
 
 void
-mieqEnqueue (xEvent *e)
+mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
 {
     HWEventQueueType       oldtail = miEventQueue.tail, newtail;
     int                    isMotion = 0;
-    DeviceIntPtr           pDev = NULL;
-    deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) e;
     deviceValuator         *v = (deviceValuator *) e;
     EventPtr               laste = &miEventQueue.events[oldtail - 1];
     deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
                                       &laste->event[0];
 
-    if (e->u.u.type == MotionNotify) {
-        pDev = inputInfo.pointer;
-        isMotion = inputInfo.pointer->id & DEVICE_BITS;
-    }
-    else if (e->u.u.type == KeyPress || e->u.u.type == KeyRelease) {
-        pDev = inputInfo.keyboard;
-    }
-    else if (e->u.u.type == ButtonPress || e->u.u.type == ButtonRelease) {
-        pDev = inputInfo.pointer;
-    }
-    else {
-        pDev = LookupDeviceIntRec(kbp->deviceid & DEVICE_BITS);
-
-        /* We silently steal valuator events: just tack them on to the last
-         * motion event they need to be attached to.  Sigh. */
-        if (e->u.u.type == DeviceValuator) {
-            if (laste->nevents > 6) {
-                ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
-                return;
-            }
-            if (oldtail == miEventQueue.head || 
-                !(lastkbp->type == DeviceMotionNotify ||
-                  lastkbp->type == DeviceButtonPress ||
-                  lastkbp->type == DeviceButtonRelease) ||
-                ((lastkbp->deviceid & DEVICE_BITS) !=
-                 (v->deviceid & DEVICE_BITS))) {
-                ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
-                return;
-            }
-            memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+    if (e->u.u.type == MotionNotify)
+        isMotion = inputInfo.pointer->id;
+    else if (e->u.u.type == DeviceMotionNotify)
+        isMotion = pDev->id;
+
+    /* We silently steal valuator events: just tack them on to the last
+     * motion event they need to be attached to.  Sigh. */
+    if (e->u.u.type == DeviceValuator) {
+        if (laste->nevents > 6) {
+            ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
             return;
         }
-        else if (e->u.u.type == DeviceMotionNotify) {
-            isMotion = pDev->id & DEVICE_BITS;
+        if (oldtail == miEventQueue.head || 
+            !(lastkbp->type == DeviceMotionNotify ||
+              lastkbp->type == DeviceButtonPress ||
+              lastkbp->type == DeviceButtonRelease) ||
+            (lastkbp->deviceid != v->deviceid)) {
+            ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
+            return;
         }
+        memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+        return;
     }
 
-    if (!pDev)
-        FatalError("Couldn't find device for event!\n");
-
     if (isMotion && isMotion == miEventQueue.lastMotion &&
         oldtail != miEventQueue.head) {
 	if (oldtail == 0)
@@ -164,10 +146,8 @@ mieqEnqueue (xEvent *e)
     memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent));
     miEventQueue.events[oldtail].nevents = 1;
 
-    /*
-     * Make sure that event times don't go backwards - this
-     * is "unnecessary", but very useful
-     */
+    /* Make sure that event times don't go backwards - this
+     * is "unnecessary", but very useful. */
     if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
 	miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
 	miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time =
@@ -182,49 +162,59 @@ mieqEnqueue (xEvent *e)
 }
 
 void
-mieqSwitchScreen (ScreenPtr pScreen, Bool fromDIX)
+mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
 {
     miEventQueue.pEnqueueScreen = pScreen;
     if (fromDIX)
 	miEventQueue.pDequeueScreen = pScreen;
 }
 
-/*
- * Call this from ProcessInputEvents()
- */
-
-void mieqProcessInputEvents ()
+/* Call this from ProcessInputEvents(). */
+void
+mieqProcessInputEvents()
 {
-    EventRec	*e;
-    int		x, y;
+    EventRec *e = NULL;
+    int x = 0, y = 0;
+    DeviceIntPtr dev = NULL;
+
+    while (miEventQueue.head != miEventQueue.tail) {
+        if (screenIsSaved == SCREEN_SAVER_ON)
+            SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+
+        e = &miEventQueue.events[miEventQueue.head];
+        /* Assumption - screen switching can only occur on motion events. */
+        if (e->pScreen != miEventQueue.pDequeueScreen) {
+            miEventQueue.pDequeueScreen = e->pScreen;
+            x = e->event[0].u.keyButtonPointer.rootX;
+            y = e->event[0].u.keyButtonPointer.rootY;
+            if (miEventQueue.head == QUEUE_SIZE - 1)
+                miEventQueue.head = 0;
+            else
+                ++miEventQueue.head;
+            NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
+        }
+        else {
+            if (miEventQueue.head == QUEUE_SIZE - 1)
+                miEventQueue.head = 0;
+            else
+                ++miEventQueue.head;
+
+            if (e->event[0].u.u.type == KeyPress ||
+                e->event[0].u.u.type == KeyRelease) {
+                SwitchCoreKeyboard(e->pDev);
+                dev = inputInfo.keyboard;
+            }
+            else if (e->event[0].u.u.type == MotionNotify ||
+                     e->event[0].u.u.type == ButtonPress ||
+                     e->event[0].u.u.type == ButtonRelease) {
+                SwitchCorePointer(e->pDev);
+                dev = inputInfo.pointer;
+            }
+            else {
+                dev = e->pDev;
+            }
 
-    while (miEventQueue.head != miEventQueue.tail)
-    {
-	if (screenIsSaved == SCREEN_SAVER_ON)
-	    SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-
-	e = &miEventQueue.events[miEventQueue.head];
-	/*
-	 * Assumption - screen switching can only occur on motion events
-	 */
-	if (e->pScreen != miEventQueue.pDequeueScreen)
-	{
-	    miEventQueue.pDequeueScreen = e->pScreen;
-	    x = e->event[0].u.keyButtonPointer.rootX;
-	    y = e->event[0].u.keyButtonPointer.rootY;
-	    if (miEventQueue.head == QUEUE_SIZE - 1)
-	    	miEventQueue.head = 0;
-	    else
-	    	++miEventQueue.head;
-	    NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
-	}
-	else
-	{
-	    if (miEventQueue.head == QUEUE_SIZE - 1)
-	    	miEventQueue.head = 0;
-	    else
-	    	++miEventQueue.head;
-            (*e->pDev->public.processInputProc)(e->event, e->pDev, e->nevents);
-	}
+            dev->public.processInputProc(e->event, dev, e->nevents);
+        }
     }
 }
diff-tree a8d3dad9d9f2b9053843e655abe463a68ba8dcb7 (from b0780312d80ea4af0136227f90fdd7ada3db71c5)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Oct 20 00:28:40 2006 +0300

    xi: add DEVICE_ENABLE control
    
    Add DEVICE_ENABLE control, which allows runtime enabling and disabling
    of specific devices.

diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index ebe0865..4b9c2b6 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -106,6 +106,7 @@ ProcXChangeDeviceControl(ClientPtr clien
     CARD32 *resolution;
     xDeviceTSCtl *ts;
     xDeviceCoreCtl *c;
+    xDeviceEnableCtl *e;
 
     REQUEST(xChangeDeviceControlReq);
     REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -218,6 +219,28 @@ ProcXChangeDeviceControl(ClientPtr clien
         }
 
         break;
+    case DEVICE_ENABLE:
+        e = (xDeviceEnableCtl *)&stuff[1];
+
+        status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+
+        if (status == Success) {
+            if (e->enable)
+                EnableDevice(dev);
+            else
+                DisableDevice(dev);
+        } else if (status == DeviceBusy) {
+            rep.status = DeviceBusy;
+            WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
+                               &rep);
+            return Success;
+        } else {
+            SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
+                              BadMatch);
+            return Success;
+        }
+
+        break;
     default:
 	SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
 	return Success;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 66342b3..2ae6ef3 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -136,6 +136,9 @@ ProcXGetDeviceControl(ClientPtr client)
     case DEVICE_CORE:
         total_length = sizeof(xDeviceCoreCtl);
         break;
+    case DEVICE_ENABLE:
+        total_length = sizeof(xDeviceEnableCtl);
+        break;
     default:
 	SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
 	return Success;
@@ -157,6 +160,10 @@ ProcXGetDeviceControl(ClientPtr client)
         break;
     case DEVICE_CORE:
         CopySwapDeviceCore(client, dev, buf);
+        break;
+    case DEVICE_ENABLE:
+        CopySwapDeviceEnable(client, dev, buf);
+        break;
     default:
 	break;
     }
@@ -239,6 +246,7 @@ void CopySwapDeviceCore (ClientPtr clien
     c->control = DEVICE_CORE;
     c->length = sizeof(c);
     c->status = dev->coreEvents;
+    c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
 
     if (client->swapped) {
         swaps(&c->control, n);
@@ -247,6 +255,22 @@ void CopySwapDeviceCore (ClientPtr clien
     }
 }
 
+void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+{
+    register char n;
+    xDeviceEnableState *e = (xDeviceEnableState *) buf;
+
+    e->control = DEVICE_ENABLE;
+    e->length = sizeof(e);
+    e->enable = dev->enabled;
+
+    if (client->swapped) {
+        swaps(&e->control, n);
+        swaps(&e->length, n);
+        swaps(&e->enable, n);
+    }
+}
+
 
 /***********************************************************************
  *
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index 1417d1b..1331a32 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -52,6 +52,11 @@ void CopySwapDeviceCore(ClientPtr /* cli
                         char * /* buf */
     );
 
+void CopySwapDeviceEnable(ClientPtr /* client */ ,
+                          DeviceIntPtr /* dev */ ,
+                          char * /* buf */
+    );
+
 void SRepXGetDeviceControl(ClientPtr /* client */ ,
 			   int /* size */ ,
 			   xGetDeviceControlReply *	/* rep */
diff --git a/dix/devices.c b/dix/devices.c
index 0121eea..7b4be0e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -130,6 +130,8 @@ AddInputDevice(DeviceProc deviceProc, Bo
     dev->devPrivates = NULL;
     dev->unwrapProc = NULL;
     dev->coreEvents = TRUE;
+    dev->inited = FALSE;
+    dev->enabled = FALSE;
 
     for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
         ;
@@ -154,6 +156,7 @@ EnableDevice(register DeviceIntPtr dev)
         ErrorF("couldn't enable device %d\n", dev->id);
 	return FALSE;
     }
+    dev->enabled = TRUE;
     *prev = dev->next;
 
     for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
@@ -176,6 +179,7 @@ DisableDevice(register DeviceIntPtr dev)
     if (*prev != dev)
 	return FALSE;
     (void)(*dev->deviceProc)(dev, DEVICE_OFF);
+    dev->enabled = FALSE;
     *prev = dev->next;
     dev->next = inputInfo.off_devices;
     inputInfo.off_devices = dev;
diff --git a/include/inputstr.h b/include/inputstr.h
index e12b641..6476321 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -265,6 +265,7 @@ typedef struct _DeviceIntRec {
 					  used to initialize, turn on, or
 					  turn off the device */
     Bool	inited;			/* TRUE if INIT returns Success */
+    Bool        enabled;                /* TRUE if ON returns Success */
     Bool        coreEvents;             /* TRUE if device also sends core */
     GrabPtr	grab;			/* the grabber - used by DIX */
     struct {
diff-tree b0780312d80ea4af0136227f90fdd7ada3db71c5 (from c5dc997baf57ffa08025efadbbaf761296ce4bc4)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Thu Oct 19 13:51:53 2006 -0700

    Pre-release message should tell users to check git, not CVS, for updates

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a49bd54..33351f2 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1651,8 +1651,8 @@ xf86PrintBanner()
     "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
     "Select the \"xorg\" product for bugs you find in this release.\n"
     "Before reporting bugs in pre-release versions please check the\n"
-    "latest version in the X.Org Foundation CVS repository.\n"
-    "See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n");
+    "latest version in the X.Org Foundation git repository.\n"
+    "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
 #endif
   ErrorF("\nX Window System Version %d.%d.%d",
 	 XORG_VERSION_MAJOR,
diff-tree c5dc997baf57ffa08025efadbbaf761296ce4bc4 (from d029c8f1b72019446a5c873f55ffa43504b03dfb)
Author: Joshua Baergen <joshuabaergen at gentoo.org>
Date:   Thu Oct 19 11:14:26 2006 -0700

    Create xorg.conf.example (Gentoo bug #138623).

diff --git a/configure.ac b/configure.ac
index 2467e79..9700d61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,6 +836,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VER
 
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
 AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
+AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
 AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
 AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
 AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name])
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 5cce11d..79d2ec5 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/cpprules.in
+
 if DRI
 DRI_SUBDIR = dri
 endif
@@ -82,7 +84,23 @@ endif
 optionsdir = $(libdir)/X11
 dist_options_DATA = Options
 
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
 EXTRA_DIST = xorgconf.cpp
 
+CPP_FILES_FLAGS = \
+	-DRGBPATH=\"$(RGB_DB)\" \
+	-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
+	-DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
+	-DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
+	-DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
+	-DCIDFONTPATH="\"$(BASE_FONT_PATH)/CID\"" \
+	-DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
+	-DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
+	-DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
+
 relink:
 	rm -f Xorg && $(MAKE) Xorg
+
+xorg.conf.example.pre: xorgconf.cpp
+	cp $< $@
diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp
index df6704f..71abe13 100644
--- a/hw/xfree86/xorgconf.cpp
+++ b/hw/xfree86/xorgconf.cpp
@@ -54,12 +54,9 @@ XCOMM command (or a combination of both 
 
     FontPath	LOCALFONTPATH
     FontPath	MISCFONTPATH
-    FontPath	DPI75USFONTPATH
-    FontPath	DPI100USFONTPATH
     FontPath	T1FONTPATH
-    FontPath    TRUETYPEFONTPATH
+    FontPath	TRUETYPEFONTPATH
     FontPath	CIDFONTPATH
-    FontPath	SPFONTPATH
     FontPath	DPI75FONTPATH
     FontPath	DPI100FONTPATH
 
diff-tree d029c8f1b72019446a5c873f55ffa43504b03dfb (from a8a0abdbea0573c861a5af9d58f3ce66790455ca)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Oct 18 18:11:06 2006 -0700

    Use getisax() instead of asm code to determine available x86 ISA extensions on Solaris

diff --git a/configure.ac b/configure.ac
index 0d7fb6c..2467e79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,8 @@ AC_TYPE_PID_T
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
-		strtol getopt getopt_long vsnprintf walkcontext backtrace])
+		strtol getopt getopt_long vsnprintf walkcontext backtrace \
+		getisax])
 AC_FUNC_ALLOCA
 dnl Old HAS_* names used in os/*.c.
 AC_CHECK_FUNC([getdtablesize],
diff --git a/fb/fbpict.c b/fb/fbpict.c
index eb305b9..d839994 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFo
  */
 #if !defined(__amd64__) && !defined(__x86_64__)
 
+#ifdef HAVE_GETISAX
+#include <sys/auxv.h>
+#endif
+
 enum CPUFeatures {
     NoFeatures = 0,
     MMX = 0x1,
@@ -1445,7 +1449,23 @@ enum CPUFeatures {
 };
 
 static unsigned int detectCPUFeatures(void) {
+    unsigned int features = 0;
     unsigned int result;
+
+#ifdef HAVE_GETISAX
+    if (getisax(&result, 1)) {
+        if (result & AV_386_CMOV)
+            features |= CMOV;
+        if (result & AV_386_MMX)
+            features |= MMX;
+        if (result & AV_386_AMD_MMX)
+            features |= MMX_Extensions;
+        if (result & AV_386_SSE)
+            features |= SSE;
+        if (result & AV_386_SSE2)
+            features |= SSE2;
+    }
+#else
     char vendor[13];
     vendor[0] = 0;
     vendor[12] = 0;
@@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(vo
      * %esp here. We can't declare either one as clobbered
      * since they are special registers (%ebx is the "PIC
      * register" holding an offset to global data, %esp the
-     * stack pointer), so we need to make sure they have their+      * original values when we access the output operands.
+     * stack pointer), so we need to make sure they have their
+     * original values when we access the output operands.
      */
     __asm__ ("pushf\n"
              "pop %%eax\n"
@@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(vo
              : "%eax", "%ecx", "%edx"
         );
 
-    unsigned int features = 0;
     if (result) {
         /* result now contains the standard feature bits */
         if (result & (1 << 15))
@@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(vo
                 features |= MMX_Extensions;
         }
     }
+#endif /* HAVE_GETISAX */
     return features;
 }
 
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 53858e9..a920242 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -112,6 +112,9 @@
 /* Define to 1 if you have the `geteuid' function. */
 #undef HAVE_GETEUID
 
+/* Define to 1 if you have the `getisax' function. */
+#undef HAVE_GETISAX
+
 /* Define to 1 if you have the `getopt' function. */
 #undef HAVE_GETOPT
 
diff-tree a8a0abdbea0573c861a5af9d58f3ce66790455ca (from 80642f37d40216035786eaf490952d16f6b5f597)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Oct 18 10:59:07 2006 +0300

    config/dbus: always unref the connection, not close

diff --git a/config/config.c b/config/config.c
index 4d12a07..5b0d90d 100644
--- a/config/config.c
+++ b/config/config.c
@@ -265,7 +265,7 @@ configInitialise()
     }
 
     if (!dbus_connection_get_unix_fd(bus, &configfd)) {
-        dbus_connection_close(bus);
+        dbus_connection_unref(bus);
         configfd = -1;
         FatalError("[dbus] couldn't get fd for bus\n");
         return;
@@ -275,7 +275,7 @@ configInitialise()
     if (!dbus_bus_request_name(bus, busname, 0, &error) ||
         dbus_error_is_set(&error)) {
         dbus_error_free(&error);
-        dbus_connection_close(bus);
+        dbus_connection_unref(bus);
         configfd = -1;
         FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n",
                    error.name, error.message);
@@ -287,7 +287,7 @@ configInitialise()
     if (dbus_error_is_set(&error)) {
         dbus_error_free(&error);
         dbus_bus_release_name(bus, busname, &error);
-        dbus_connection_close(bus);
+        dbus_connection_unref(bus);
         configfd = -1;
         FatalError("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
                    error.message);
@@ -299,7 +299,7 @@ configInitialise()
         configfd = -1;
         dbus_bus_release_name(bus, busname, &error);
         dbus_bus_remove_match(bus, MATCH_RULE, &error);
-        dbus_connection_close(bus);
+        dbus_connection_unref(bus);
         FatalError("[dbus] couldn't register object path\n");
         return;
     }
diff-tree 80642f37d40216035786eaf490952d16f6b5f597 (from 5e17cde27b064174584d478130b0f95dcef78deb)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Tue Oct 17 14:53:28 2006 -0400

    Stop building xorgcfg by default.

diff --git a/configure.ac b/configure.ac
index 7992d77..0d7fb6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1665,13 +1665,9 @@ fi
 
 dnl xorgcfg GUI configuration utility
 AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], 
-	[Build xorgcfg GUI configuration utility (default: auto)]),
-	[XORGCFG=$enableval],[XORGCFG=auto])
-if test "x$XORGCFG" = xauto && test "x$XORG" = xyes; then
-    XORGCFG=yes
-fi
-
-if test "x$XORGCFG" = xyes; then
+	[Build xorgcfg GUI configuration utility (default: no)]),
+	[XORGCFG=$enableval],[XORGCFG=no])
+if test x$XORGCFG = xyes ; then
 	PKG_CHECK_MODULES([XORGCFG_DEP], 
 	    [xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
 	AC_CHECK_LIB([curses],[waddstr],
diff-tree 5e17cde27b064174584d478130b0f95dcef78deb (from 205c6788d7a34704e36b23f1a93d89e9b986266a)
Author: Matthias Hopf <mhopf at suse.de>
Date:   Tue Oct 17 17:06:44 2006 +0200

    StorePixels() macro could create invalid *x++=*x... code - fixed.

diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c
index 1db2996..9d4ce57 100644
--- a/cfb/cfbteblt8.c
+++ b/cfb/cfbteblt8.c
@@ -301,7 +301,7 @@ typedef unsigned int	*glyphPointer;
 #define StorePixels(o,p)    dst[o] = p
 #define Loop		    dst += widthDst;
 #else
-#define StorePixels(o,p)    *dst++ = (p)
+#define StorePixels(o,p)    do { *dst = (p); dst++; } while (0)
 #define Loop		    dst += widthLeft;
 #endif
 
diff-tree 205c6788d7a34704e36b23f1a93d89e9b986266a (from 85ac2f16abe9f6e88b4e71609da334d336a9a600)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Oct 16 23:48:09 2006 +0300

    config/dbus: properly initialise vtable
    
    Properly initialise the vtable, so we don't end up with an unregister_function
    pointing to god knows where.

diff --git a/config/config.c b/config/config.c
index a50302f..4d12a07 100644
--- a/config/config.c
+++ b/config/config.c
@@ -251,7 +251,7 @@ configInitialise()
 {
     DBusConnection *bus = NULL;
     DBusError error;
-    DBusObjectPathVTable vtable;
+    DBusObjectPathVTable vtable = { .message_function = configMessage };
 
     configConnection = NULL;
 
@@ -294,7 +294,6 @@ configInitialise()
         return;
     }
 
-    vtable.message_function = configMessage;
     snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
     if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
         configfd = -1;
@@ -319,10 +318,7 @@ configFini()
 
     if (configConnection) {
         dbus_error_init(&error);
-        /* This causes a segfault inside libdbus.  Sigh. */
-#if 0
         dbus_connection_unregister_object_path(configConnection, busobject);
-#endif
         dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
         dbus_bus_release_name(configConnection, busname, &error);
         dbus_connection_unref(configConnection);
diff-tree 85ac2f16abe9f6e88b4e71609da334d336a9a600 (from 0901eec87ee9f3a2a067695bdbd569ff42149879)
Author: Alan Hourihane <alanh at fairlite.demon.co.uk>
Date:   Mon Oct 16 12:39:05 2006 +0100

    Small modification to blocking signals when switching modes.

diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 20905b0..46d8128 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -208,7 +208,6 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
   ScreenPtr   pCursorScreen;
   Bool        Switched;
   int         px, py;
-  int         sigstate;
 
   if (!pScr->vtSema || !mode || !pScr->SwitchMode)
     return FALSE;
@@ -228,10 +227,8 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
   if (pScreen == pCursorScreen)
     miPointerGetPosition(inputInfo.pointer, &px, &py);
 
-  sigstate = xf86BlockSIGIO ();
   xf86EnterServerState(SETUP);
   Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
-  xf86EnterServerState(OPERATING);
   if (Switched) {
     pScr->currentMode = mode;
 
@@ -266,7 +263,7 @@ xf86SwitchMode(ScreenPtr pScreen, Displa
       pScr->frameY1 = pScr->virtualY - 1;
     }
   }
-  xf86UnblockSIGIO (sigstate);
+  xf86EnterServerState(OPERATING);
 
   if (pScr->AdjustFrame)
     (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
diff-tree 0901eec87ee9f3a2a067695bdbd569ff42149879 (from a232693c8c2a206aac47c07b133c071938204e0b)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Oct 15 16:57:09 2006 +0200

    Fix __glXDRIbindTexImage() for 32 bpp on big endian platforms.

diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index b572304..170662c 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -359,7 +359,12 @@ __glXDRIbindTexImage(__GLXcontext *baseC
     if (pixmap->drawable.depth >= 24) {
 	bpp = 4;
 	format = GL_BGRA;
-	type = GL_UNSIGNED_BYTE;
+	type =
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+	    GL_UNSIGNED_BYTE;
+#else
+	    GL_UNSIGNED_INT_8_8_8_8_REV;
+#endif
     } else {
 	bpp = 2;
 	format = GL_RGB;
diff-tree a232693c8c2a206aac47c07b133c071938204e0b (from 5563861ab7e56ec891cfce6b34af43fec53ccee3)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Sun Oct 15 16:48:59 2006 +0200

    Add per-drawable Xv colour key helper function.
    
    This allows overlay Xv adaptors to work slightly better with compositing
    managers.
    
    Bump the video driver ABI minor so drivers only need to check for this at build
    time.

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index f0cf5eb..3c3247e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -84,7 +84,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 3)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(1, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(1, 1)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(1, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(0, 3)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 5)
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 89cb6ba..3e908b8 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -974,6 +974,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin,
    if(!winPriv) {
 	winPriv = xalloc(sizeof(XF86XVWindowRec));
 	if(!winPriv) return BadAlloc;
+	memset(winPriv, 0, sizeof(XF86XVWindowRec));
 	winPriv->PortRec = portPriv;
 	winPriv->next = PrivRoot;
 	pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
@@ -1026,6 +1027,9 @@ xf86XVDestroyWindow(WindowPtr pWin)
 
      pPriv->pDraw = NULL;
      tmp = WinPriv;
+     if(WinPriv->pGC) {
+       FreeGC(WinPriv->pGC, 0);
+     }
      WinPriv = WinPriv->next;
      xfree(tmp);
   }
@@ -1118,6 +1122,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx,
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
+     if(!pPriv) goto next;
+ 
      if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 	REGION_DESTROY(pScreen, pPriv->pCompositeClip);
 
@@ -1148,6 +1154,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx,
 	}
      }
 
+next:
      pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
@@ -1739,9 +1746,13 @@ xf86XVPutImage(
      REGION_UNINIT(pScreen, &VPReg);
   }
 
-  if(portPriv->pDraw) {
+  /* If we are changing windows, unregister our port in the old window */
+  if(portPriv->pDraw && (portPriv->pDraw != pDraw))
      xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
-  }
+
+  /* Register our port with the new window */
+  ret =  xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
+  if(ret != Success) goto PUT_IMAGE_BAILOUT;
 
   if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
      clippedAway = TRUE;
@@ -1772,7 +1783,6 @@ xf86XVPutImage(
   if((ret == Success) &&
 	(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
 
-     xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
      portPriv->isOn = XV_ON;
      portPriv->pDraw = pDraw;
      portPriv->drw_x = drw_x;  portPriv->drw_y = drw_y;
@@ -1813,6 +1823,56 @@ xf86XVQueryImageAttributes(
 			format->id, width, height, pitches, offsets);
 }
 
+
+_X_EXPORT void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
+{
+   ScreenPtr pScreen = pDraw->pScreen;
+   WindowPtr pWin = (WindowPtr)pDraw;
+   XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
+   GCPtr pGC = NULL;
+   XID pval[2];
+   BoxPtr pbox = REGION_RECTS(clipboxes);
+   int i, nbox = REGION_NUM_RECTS(clipboxes);
+   xRectangle *rects;
+
+   if(!xf86Screens[pScreen->myNum]->vtSema) return;
+
+   if(pPriv)
+      pGC = pPriv->pGC;
+
+   if(!pGC) {
+       int status;
+       pval[0] = key;
+       pval[1] = IncludeInferiors;
+       pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
+       if(!pGC) return;
+       ValidateGC(pDraw, pGC);
+       if (pPriv) pPriv->pGC = pGC;
+   } else if (key != pGC->fgPixel){
+       pval[0] = key;
+       ChangeGC(pGC, GCForeground, pval);
+       ValidateGC(pDraw, pGC);
+   }
+
+   REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
+
+   rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
+
+   for(i = 0; i < nbox; i++, pbox++) {
+      rects[i].x = pbox->x1;
+      rects[i].y = pbox->y1;
+      rects[i].width = pbox->x2 - pbox->x1;
+      rects[i].height = pbox->y2 - pbox->y1;
+   }
+
+   (*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects);
+
+   if (!pPriv) FreeGC(pGC, 0);
+
+   DEALLOCATE_LOCAL(rects);
+}
+
 _X_EXPORT void
 xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
 {
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index e0feb57..817e2b9 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -232,6 +232,9 @@ void xf86XVFreeVideoAdaptorRec(XF86Video
 void
 xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
 
+void
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
+
 Bool
 xf86XVClipVideoHelper(
     BoxPtr dst,
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index ced0536..e716c9c 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -80,6 +80,7 @@ typedef struct {
 typedef struct _XF86XVWindowRec{
    XvPortRecPrivatePtr PortRec;
    struct _XF86XVWindowRec *next;
+   GCPtr pGC;
 } XF86XVWindowRec, *XF86XVWindowPtr;
 
 #endif  /* _XF86XVPRIV_H_ */
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 586d5dc..8e39373 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -621,6 +621,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
     SYMFUNC(xf86XVAllocateVideoAdaptorRec)
     SYMFUNC(xf86XVFreeVideoAdaptorRec)
     SYMFUNC(xf86XVFillKeyHelper)
+    SYMFUNC(xf86XVFillKeyHelperDrawable)
     SYMFUNC(xf86XVClipVideoHelper)
     SYMFUNC(xf86XVCopyYUV12ToPacked)
     SYMFUNC(xf86XVCopyPacked)
diff-tree 5563861ab7e56ec891cfce6b34af43fec53ccee3 (from 1b1698af41b9038d9f9dbf521737d0baab5a2237)
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Oct 13 19:05:28 2006 -0700

    Make sure xorgcfg files are included even when dist made with --disable-xorgcfg

diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am
index 73e4042..309ed5c 100644
--- a/hw/xfree86/utils/xorgcfg/Makefile.am
+++ b/hw/xfree86/utils/xorgcfg/Makefile.am
@@ -56,6 +56,7 @@ endif
 if NEED_STRLCAT
 STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
 endif
+endif BUILD_XORGCFG
 
 xorgcfg_SOURCES =	\
         accessx.c \
@@ -95,10 +96,7 @@ xorgcfg_SOURCES =	\
         xf86config.h \
 	$(STRL_SRCS)
 
-XBMdir = $(includedir)/X11/bitmaps
-XPMdir = $(includedir)/X11/pixmaps
-
-XBM_DATA = \
+BITMAPS = \
         card.xbm \
         keyboard.xbm \
         monitor.xbm \
@@ -112,7 +110,7 @@ XBM_DATA = \
         shorter.xbm \
         taller.xbm
 
-XPM_DATA = \
+PIXMAPS = \
         card.xpm \
         computer.xpm \
         keyboard.xpm \
@@ -122,6 +120,13 @@ XPM_DATA = \
 # Rules needed to cpp man page & app-defaults
 include $(top_srcdir)/cpprules.in
 
+if BUILD_XORGCFG
+XBMdir = $(includedir)/X11/bitmaps
+XPMdir = $(includedir)/X11/pixmaps
+
+XBM_DATA = $(BITMAPS)
+XPM_DATA = $(PIXMAPS)
+
 # App default files  (*.ad)
 
 appdefaultdir = @APPDEFAULTDIR@
@@ -146,7 +151,6 @@ appman_DATA = $(appman_PRE:man=@APP_MAN_
 
 all-local: $(appman_PRE) $(appman_DATA)
 
-EXTRA_DIST = $(XBM_DATA) $(XPM_DATA) XOrgCfg.pre xorgcfg.man.pre
 BUILT_SOURCES = $(appman_PRE)
 CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA)
 
@@ -156,4 +160,6 @@ SUFFIXES += .$(APP_MAN_SUFFIX) .man
 	-rm -f $@
 	$(LN_S) $< $@
 
-endif
+endif BUILD_XORGCFG
+
+EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre



More information about the xorg-commit mailing list