[Xquartz-changes] xserver: Branch 'server-1.13-branch' - 28 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sat Nov 17 08:47:54 PST 2012


Rebased ref, commits from common ancestor:
commit 5a23b9eed3ad15812e63516d3faf6a1e399b3a79
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Sep 20 21:11:21 2012 -0700

    XQuartz: Add some verbose logging to debug xp_lock_window being unbalanced
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit f54987de97720200ee94eba1c7a737d4ad8c55c8)

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 01f1def..aad375b 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -49,6 +49,10 @@
 #include <pthread.h>
 #endif
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+#include <execinfo.h>
+#endif
+
 #define DEFINE_ATOM_HELPER(func, atom_name)                      \
     static Atom func(void) {                                       \
         static int generation;                                      \
@@ -376,6 +380,18 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
     unsigned int rowbytes[2];
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_lock_window(x_cvt_vptr_to_uint(
                              wid), NULL, NULL, data, rowbytes, NULL);
     if (err != Success)
@@ -395,6 +411,18 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
     xp_error err;
 
+#ifdef DEBUG_XP_LOCK_WINDOW
+    void* callstack[128];
+    int i, frames = backtrace(callstack, 128);
+    char** strs = backtrace_symbols(callstack, frames);
+
+    ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid));
+    for (i = 0; i < frames; ++i) {
+        ErrorF("    %s\n", strs[i]);
+    }
+    free(strs);
+#endif
+
     err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
     /* This should be a FatalError, but we started tripping over it.  Make it a
      * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed.
commit 5d4b80de75f81fdad25db85b5c9a4f9ebba8eff5
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Sep 20 21:49:40 2012 -0700

    XQuartz: Avoid a possible deadlock with DRI on OS X 10.7.5 and OS X 10.8.2
    
    <rdar://problem/12338921>
    http://bugs.winehq.org/show_bug.cgi?id=31751
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit 25d26875bc9bd6fd23ae1b5280f015abf1b033b7)

diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 03af163..adba69c 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -64,6 +64,7 @@
 #include "mi.h"
 #include "mipointer.h"
 #include "rootless.h"
+#include "rootlessCommon.h"
 #include "x-hash.h"
 #include "x-hook.h"
 #include "driWrap.h"
@@ -380,6 +381,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
     DRIDrawablePrivPtr pDRIDrawablePriv;
 
     if (pDrawable->type == DRAWABLE_WINDOW) {
+        /* <rdar://problem/12338921>
+         * http://bugs.winehq.org/show_bug.cgi?id=31751
+         */
+        RootlessStopDrawing((WindowPtr)pDrawable, FALSE);
+
         pDRIDrawablePriv = CreateSurfaceForWindow(pScreen,
                                                   (WindowPtr)pDrawable, &wid);
 
commit 395c9e17089a7e4ed46a747904b36b1fec94fab3
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Oct 29 12:57:54 2012 +0100

    EXA: Track source/mask pixmaps more explicitly for Composite fallback regions.
    
    In particular, make sure pExaScr->src/maskPix are cleared when the
    corresponding pictures aren't associated with drawables, i.e. solid or gradient
    pictures. Without this, we would in some cases associate the source/mask region
    with unrelated pixmaps from previous Composite fallbacks, resulting in random
    corruption.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47266
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 1ca096d5e07221025c4c4110528772b7d94f15ee)

diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index ea7e7fa..2e4759d 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -209,6 +209,7 @@ typedef struct {
     RegionRec srcReg;
     RegionRec maskReg;
     PixmapPtr srcPix;
+    PixmapPtr maskPix;
 
     DevPrivateKeyRec pixmapPrivateKeyRec;
     DevPrivateKeyRec gcPrivateKeyRec;
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 5716138..b0a0011 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -442,6 +442,13 @@ ExaSrcValidate(DrawablePtr pDrawable,
     RegionPtr dst;
     int xoff, yoff;
 
+    if (pExaScr->srcPix == pPix)
+        dst = &pExaScr->srcReg;
+    else if (pExaScr->maskPix == pPix)
+        dst = &pExaScr->maskReg;
+    else
+        return;
+
     exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
 
     box.x1 = x + xoff;
@@ -449,8 +456,6 @@ ExaSrcValidate(DrawablePtr pDrawable,
     box.x2 = box.x1 + width;
     box.y2 = box.y1 + height;
 
-    dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : &pExaScr->maskReg;
-
     RegionInit(&reg, &box, 1);
     RegionUnion(dst, dst, &reg);
     RegionUninit(&reg);
@@ -495,16 +500,19 @@ ExaPrepareCompositeReg(ScreenPtr pScreen,
         if (pSrc != pDst)
             RegionTranslate(pSrc->pCompositeClip,
                             -pSrc->pDrawable->x, -pSrc->pDrawable->y);
-    }
+    } else
+        pExaScr->srcPix = NULL;
 
     if (pMask && pMask->pDrawable) {
         pMaskPix = exaGetDrawablePixmap(pMask->pDrawable);
         RegionNull(&pExaScr->maskReg);
         maskReg = &pExaScr->maskReg;
+        pExaScr->maskPix = pMaskPix;
         if (pMask != pDst && pMask != pSrc)
             RegionTranslate(pMask->pCompositeClip,
                             -pMask->pDrawable->x, -pMask->pDrawable->y);
-    }
+    } else
+        pExaScr->maskPix = NULL;
 
     RegionTranslate(pDst->pCompositeClip,
                     -pDst->pDrawable->x, -pDst->pDrawable->y);
commit 7914986fb801f6ea98582db21c0d86b9b200b9ac
Merge: b3d25d8 1a4ec49
Author: Matt Dew <marcoz at osource.org>
Date:   Wed Nov 7 23:24:53 2012 -0700

    Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~whot/xserver into server-1.13-branch

commit 1a4ec493bf3d3d14799340c03533cdcd44b841e8
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Oct 31 19:29:45 2012 +0100

    Xi: Set modifier mask on touch events
    
    Button mask should be out-of-band with the emulated
    pointer events as touch devices don't truly have
    "buttons". Even though, it's handy to have the modifier
    mask from the paired keyboard on touch events.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b4e44b285ed0eee1d06514215a4b01d54f40094b)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 5cf873c..106da3a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1559,6 +1559,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     uint32_t touchid;
     int type = ev->any.type;
     int emulate_pointer = ! !(ev->device_event.flags & TOUCH_POINTER_EMULATED);
+    DeviceIntPtr kbd;
 
     if (!t)
         return;
@@ -1618,6 +1619,10 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
+    kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
+    event_set_state(NULL, kbd, &ev->device_event);
+    ev->device_event.corestate = event_get_corestate(NULL, kbd);
+
     /* Make sure we have a valid window trace for event delivery; must be
      * called after event type mutation. Touch end events are always processed
      * in order to end touch records. */
commit 2f99b38747e1a74cade10a7a45cee5eaec8ddea7
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Wed Oct 31 19:32:57 2012 +0100

    Xi: Update the device after delivering the emulated pointer event(#56558)
    
    Ensure emulated pointer events contain the state that applies before the
    event was processed, so the device state must be updated after delivering
    such emulated events.
    
    Co-authored-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 863f32c930d71073ee5f78452b78bd459d024867)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 4cbeb37..5cf873c 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1568,9 +1568,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     else
         touchid = ev->device_event.touchid;
 
-    if (emulate_pointer)
-        UpdateDeviceState(dev, &ev->device_event);
-
     if (type == ET_TouchBegin) {
         ti = TouchBeginTouch(dev, ev->device_event.sourceid, touchid,
                              emulate_pointer);
@@ -1617,6 +1614,7 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
      * events which _only_ emulate motion just work normally */
     if (emulate_pointer && ev->any.type != ET_TouchUpdate)
         DeliverEmulatedMotionEvent(dev, ti, ev);
+
     if (emulate_pointer && IsMaster(dev))
         CheckMotion(&ev->device_event, dev);
 
@@ -1641,6 +1639,9 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
         if (ev->any.type == ET_TouchEnd)
             TouchEndTouch(dev, ti);
     }
+
+    if (emulate_pointer)
+        UpdateDeviceState(dev, &ev->device_event);
 }
 
 /**
commit 10d9cd36b4966c8e3ea8e791152e1af166224ee8
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Thu Oct 25 15:03:50 2012 +0200

    Sync TouchListener memory allocation with population in TouchSetupListeners()
    
    The allocated TouchListener array may fall short by 1 if hitting the worst case
    situation where there's an active grab, passive grabs on each window in the
    sprite trace and event selection for touch in one of the windows. This may lead
    to memory corruptions as the array is overflown.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit ced56f322ead10d1bc93fcd1f8e0ec3ae51292a3)

diff --git a/dix/touch.c b/dix/touch.c
index e64a626..5f77be5 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
         return FALSE;
 
     /* Mark which grabs/event selections we're delivering to: max one grab per
-     * window plus the bottom-most event selection. */
-    ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
+     * window plus the bottom-most event selection, plus any active grab. */
+    ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
     if (!ti->listeners) {
         sprite->spriteTraceGood = 0;
         return FALSE;
commit 835737244f84d34b0b9c5a93560710a2275dcc63
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 18 15:11:31 2012 +1000

    dix: fix zaphod screen scrossing (#54654)
    
    POINTER_SCREEN coordinates are screen-relative. For a Zaphod setup, the
    coordinates after a screen crossing are already relative to the new screen's
    origin. Add that offset to the coordinates before re-setting.
    
    regression introduced by
    commit bafbd99080be49a17be97d2cc758fbe623369945
    Author: Peter Hutterer <peter.hutterer at who-t.net>
    Date:   Wed Aug 8 11:34:32 2012 +1000
    
        dix: work around scaling issues during WarpPointer (#53037)
    
    X.Org Bug 54654 <http://bugs.freedesktop.org/show_bug.cgi?id=54654>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit e7cd5cce740e653000fb1192b600268dcf77dde2)

diff --git a/dix/getevents.c b/dix/getevents.c
index 71d83c4..8b4379d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1400,8 +1400,9 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
        coordinates were.
      */
     if (flags & POINTER_SCREEN) {
-        screenx = sx;
-        screeny = sy;
+        scr = miPointerGetScreen(pDev);
+        screenx = sx + scr->x;
+        screeny = sy + scr->y;
     }
 
     scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
commit a3f11d2f6066d2120e84f0c33684943474aa8ae1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 17 14:13:29 2012 +1000

    Xi: don't deliver TouchEnd to a client waiting for TouchBegin (#55738)
    
    If a client is still waiting for the TouchBegin, don't deliver a TouchEnd
    event.
    
    X.Org Bug 55738 <http://bugs.freedesktop.org/show_bug.cgi?id=55738>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Thomas Jaeger <thjaeger at gmail.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 676447190190d8546165e21be242cf16dd69f5ae)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6ed4991..4cbeb37 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1862,6 +1862,11 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         goto out;
     }
 
+    if (listener->state == LISTENER_AWAITING_BEGIN) {
+        listener->state = LISTENER_HAS_END;
+        goto out;
+    }
+
     /* Event in response to reject */
     if (ev->device_event.flags & TOUCH_REJECT) {
         if (listener->state != LISTENER_HAS_END)
commit 11319a922575f1da1d3c5774728c0dee12bab069
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Oct 11 16:03:33 2012 +1000

    xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP
    
    For button release events, the current code picks the VCK. Because that has
    a XKB struct, it thinks this is a PointerKeys event and proceeds to send the
    release event through the XTest pointer. That has no effect in normal
    operation as the button is never down and an attempt is silently discarded
    (normal event processing continues with the VCP).
    
    On server shutdown, the XTest device is already removed, leading to a
    null-pointer derefernce when the device is checked for whether buttons are
    down (XkbFakeDeviceButton → button_is_down(xtest pointer)).
    
    The current state has only worked by accident, the right approach here is to
    handle the VCP's event as such and not switch to the keyboard.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 2decff6393a44b56d80d53570718f95354fde454)

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 082c0db..c1af32e 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -709,7 +709,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
     DeviceEvent *event = &ev->device_event;
 
-    dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
+    dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
 
     if (dev && dev->key) {
         xkbi = dev->key->xkbInfo;
commit 9ddc6ad9d02d886c1dba0496fc9480db64529bf2
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Thu Jun 7 14:12:06 2012 -0700

    End physically active touches when device is disabled
    
    Otherwise:
    
    * We can't end the touches while device is disabled
    * New touches after enabling the device may erroneously be mapped to old
      logical touches
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 3b67cd26149eb991b5f015061a818af65369e668)

diff --git a/dix/devices.c b/dix/devices.c
index 66d4406..fd4916a 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -443,6 +443,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
     if (*prev != dev)
         return FALSE;
 
+    TouchEndPhysicallyActiveTouches(dev);
     ReleaseButtonsAndKeys(dev);
     SyncRemoveDeviceIdleTime(dev->idle_counter);
     dev->idle_counter = NULL;
diff --git a/dix/touch.c b/dix/touch.c
index 497ad7d..e64a626 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -1029,3 +1029,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
 
     return TouchListenerAcceptReject(dev, ti, i, mode);
 }
+
+/**
+ * End physically active touches for a device.
+ */
+void
+TouchEndPhysicallyActiveTouches(DeviceIntPtr dev)
+{
+    InternalEvent *eventlist = InitEventList(GetMaximumEventsNum());
+    int i;
+
+    OsBlockSignals();
+    mieqProcessInputEvents();
+    for (i = 0; i < dev->last.num_touches; i++) {
+        DDXTouchPointInfoPtr ddxti = dev->last.touches + i;
+
+        if (ddxti->active) {
+            int j;
+            int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id,
+                                         XI_TouchEnd, 0, NULL);
+
+            for (j = 0; j < nevents; j++)
+                mieqProcessDeviceEvent(dev, eventlist + j, NULL);
+        }
+    }
+    OsReleaseSignals();
+
+    FreeEventList(eventlist, GetMaximumEventsNum());
+}
diff --git a/include/input.h b/include/input.h
index 5747f3c..f8459b8 100644
--- a/include/input.h
+++ b/include/input.h
@@ -579,6 +579,7 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                      int listener, int mode);
 extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
                              uint32_t touchid, Window grab_window, XID *error);
+extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
 
 /* misc event helpers */
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients);
commit 36f9c2d1ddc8a35c0317db55044d05f07284ab38
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 10 13:33:48 2012 +1000

    dix: fix crash on shutdown if a disabled device is still grabbed (XI1 grab)
    
    A disabled device doesn't have a sprite (less so a sprite->win) and triggers
    a NULL-pointer dereference on shutdown when all active grabs are released as
    part of the cleanup.
    
    Fix this by checking for sprite being non-null and setting the focus window
    to the NullWindow if it is. The rest of the patch just attempts to make
    things more readable.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4b7f00346daed20c96f3e8ea13ae411858a5424b)

diff --git a/dix/events.c b/dix/events.c
index c0e330b..ddb5b34 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1593,13 +1593,10 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
 {
     GrabPtr grab = keybd->deviceGrab.grab;
     DeviceIntPtr dev;
-    WindowPtr focusWin = keybd->focus ? keybd->focus->win
-        : keybd->spriteInfo->sprite->win;
+    WindowPtr focusWin;
     Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
                         keybd->deviceGrab.implicitGrab);
 
-    if (focusWin == FollowKeyboardWin)
-        focusWin = inputInfo.keyboard->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
     keybd->deviceGrab.grab = NullGrab;
@@ -1610,6 +1607,17 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
         if (dev->deviceGrab.sync.other == grab)
             dev->deviceGrab.sync.other = NullGrab;
     }
+
+    if (keybd->focus)
+        focusWin = keybd->focus->win;
+    else if (keybd->spriteInfo->sprite)
+        focusWin = keybd->spriteInfo->sprite->win;
+    else
+        focusWin = NullWindow;
+
+    if (focusWin == FollowKeyboardWin)
+        focusWin = inputInfo.keyboard->focus->win;
+
     DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
 
     if (!wasImplicit && grab->grabtype == XI2)
commit b3d25d8d65e4a4864da232630758f125f8a1bfb4
Merge: 5a612aa b87edf1
Author: Matt Dew <marcoz at osource.org>
Date:   Thu Nov 1 22:17:59 2012 -0600

    Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~airlied/xserver into server-1.13-branch

commit b87edf1acca7e57139cd6bdf5838c2b4179352dc
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Aug 27 15:22:44 2012 +1000

    xf86: fix multi-seat video device support. (v2)
    
    If we are not seat 0 the following apply:
    
    don't probe any bus other than platform
    don't probe any drivers other than platform
    assume the first platform device we match on the bus is the primary GPU.
    
    This just adds checks in the correct places to ensure this, and
    with this X can now start on a secondary seat for an output device.
    
    v2: fix Seat0 macros
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 70e5766874a919039678bb2ed75f2ccea0cb4345)

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 6de8409..4ffbf7e 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -81,6 +81,8 @@ xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
     if (drv->platformProbe != NULL) {
         foundScreen = xf86platformProbeDev(drv);
     }
+    if (ServerIsNotSeat0())
+        return foundScreen;
 #endif
 
 #ifdef XSERVER_LIBPCIACCESS
@@ -214,6 +216,8 @@ xf86BusProbe(void)
 {
 #ifdef XSERVER_PLATFORM_BUS
     xf86platformProbe();
+    if (ServerIsNotSeat0())
+        return;
 #endif
 #ifdef XSERVER_LIBPCIACCESS
     xf86PciProbe();
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 6a8fb90..0525e39 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -359,6 +359,9 @@ xf86platformProbeDev(DriverPtr drvp)
                     break;
             }
             else {
+                /* for non-seat0 servers assume first device is the master */
+                if (ServerIsNotSeat0())
+                    break;
                 if (xf86_platform_devices[j].pdev) {
                     if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
                         break;
commit 1e8c960f8777a889fbc17c8711b3e68fd094427b
Author: Dave Airlie <airlied at gmail.com>
Date:   Thu Sep 13 18:44:06 2012 +1000

    config/udev: ignore change on drm devices
    
    for input devices we handle change like remove/add, but for
    drm devices we get change events when we hotplug outputs,
    so lets just ignore change at this level, and let the drivers
    handle it. We may in the future want to route driver udev
    from here instead.
    
    Reported-by: Timo Aaltonen <timo.aaltonen at canonical.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit e0b92f5f86f8ce71ab4c80e9902e51e2525f9705)

diff --git a/config/udev.c b/config/udev.c
index c2d00bb..454838f 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -300,9 +300,15 @@ wakeup_handler(pointer data, int err, pointer read_mask)
             return;
         action = udev_device_get_action(udev_device);
         if (action) {
-            if (!strcmp(action, "add") || !strcmp(action, "change")) {
+            if (!strcmp(action, "add")) {
                 device_removed(udev_device);
                 device_added(udev_device);
+            } else if (!strcmp(action, "change")) {
+                /* ignore change for the drm devices */
+                if (strcmp(udev_device_get_subsystem(udev_device), "drm")) {
+                    device_removed(udev_device);
+                    device_added(udev_device);
+                }
             }
             else if (!strcmp(action, "remove"))
                 device_removed(udev_device);
commit c7c07558919102f06aeb3fad5f856f04e6757a76
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Sep 10 14:48:37 2012 +1000

    xf86/platform: scan pci after probing devices
    
    This solves a race if we are trying to dynamically power off
    secondary GPUs. Its not the greatest fix ever but it probably
    as good as we can do for now.
    
    The GPU probing causes the devices to be powered up, then when
    we scan the PCI bus we get the correct information from the kernel,
    rather than a bunch of 0xff due to the device being powered off.
    
    drop gratuitous '&'.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 10672a5abe7d4e924844d7e41c86c24d6367a52b)

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 24b9473..6a8fb90 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -213,11 +213,12 @@ xf86platformProbe(void)
     int i;
     Bool pci = TRUE;
 
+    config_odev_probe(xf86PlatformDeviceProbe);
+
     if (!xf86scanpci()) {
         pci = FALSE;
     }
 
-    config_odev_probe(&xf86PlatformDeviceProbe);
     for (i = 0; i < xf86_num_platform_devices; i++) {
         char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
 
commit 39ebf87be749c59a06cb1763e11f14c722f77fbd
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Sep 6 16:33:54 2012 +1000

    dri2: invalidate drawable after sharing pixmap
    
    After we share the pixmap, the backing storage may have changed,
    and we need to invalidate and buffers pointing at it.
    
    This fixes GL compositors and prime windows lacking contents initially.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 22746df15b5f75dc85f5cf5b73932eb8a44cb89b)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 23f589c..40963c3 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -766,6 +766,44 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable)
     }
 }
 
+/*
+ * A TraverseTree callback to invalidate all windows using the same
+ * pixmap
+ */
+static int
+DRI2InvalidateWalk(WindowPtr pWin, pointer data)
+{
+    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
+        return WT_DONTWALKCHILDREN;
+    DRI2InvalidateDrawable(&pWin->drawable);
+    return WT_WALKCHILDREN;
+}
+
+static void
+DRI2InvalidateDrawableAll(DrawablePtr pDraw)
+{
+    if (pDraw->type == DRAWABLE_WINDOW) {
+        WindowPtr pWin = (WindowPtr) pDraw;
+        PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin);
+
+        /*
+         * Find the top-most window using this pixmap
+         */
+        while (pWin->parent &&
+               pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
+            pWin = pWin->parent;
+
+        /*
+         * Walk the sub-tree to invalidate all of the
+         * windows using the same pixmap
+         */
+        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+        DRI2InvalidateDrawable(&pPixmap->drawable);
+    }
+    else
+        DRI2InvalidateDrawable(pDraw);
+}
+
 DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
 {
     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
@@ -831,6 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
     spix->screen_x = mpix->screen_x;
     spix->screen_y = mpix->screen_y;
 #endif
+
+    DRI2InvalidateDrawableAll(pDraw);
     return &spix->drawable;
 }
 
@@ -1048,18 +1088,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
     return FALSE;
 }
 
-/*
- * A TraverseTree callback to invalidate all windows using the same
- * pixmap
- */
-static int
-DRI2InvalidateWalk(WindowPtr pWin, pointer data)
-{
-    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
-        return WT_DONTWALKCHILDREN;
-    DRI2InvalidateDrawable(&pWin->drawable);
-    return WT_WALKCHILDREN;
-}
+
 
 int
 DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
@@ -1162,26 +1191,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
      */
     *swap_target = pPriv->swap_count + pPriv->swapsPending;
 
-    if (pDraw->type == DRAWABLE_WINDOW) {
-        WindowPtr pWin = (WindowPtr) pDraw;
-        PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
-
-        /*
-         * Find the top-most window using this pixmap
-         */
-        while (pWin->parent &&
-               pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
-            pWin = pWin->parent;
-
-        /*
-         * Walk the sub-tree to invalidate all of the
-         * windows using the same pixmap
-         */
-        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
-        DRI2InvalidateDrawable(&pPixmap->drawable);
-    }
-    else
-        DRI2InvalidateDrawable(pDraw);
+    DRI2InvalidateDrawableAll(pDraw);
 
     return Success;
 }
commit 5a612aa44d2fda44317a242c2d8a5fb2afde76c6
Merge: 8f39a6b 0456d56
Author: Matt Dew <marcoz at osource.org>
Date:   Tue Oct 30 22:12:56 2012 -0600

    Merge branch 'server-1.13-branch' of git://people.freedesktop.org/~jturney/xserver into server-1.13-branch

commit 0456d56092e7617131c77b50a7e7f501e6d9d275
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Sep 7 14:58:06 2012 +0100

    Fix 'make distcheck' for hw/xwin
    
    Add some missing header files to _SOURCES so they get distributed properly
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    (cherry picked from commit a69429a17bf4630f6e26f61630a1c2b287202627)

diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index 4c2f04e..33729a9 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -109,13 +109,16 @@ SRCS =	InitInput.c \
 	winclipboard.h \
 	winconfig.h \
 	win.h \
+	winglobals.h \
 	winkeybd.h \
 	winkeynames.h \
 	winlayouts.h \
 	winmessages.h \
+	winmonitors.h \
 	winmsg.h \
 	winms.h \
 	winmultiwindowclass.h \
+	winmultiwindowicons.h \
 	winprefs.h \
 	winresource.h \
 	winwindow.h \
diff --git a/hw/xwin/glx/Makefile.am b/hw/xwin/glx/Makefile.am
index 7222a9f..59f6879 100644
--- a/hw/xwin/glx/Makefile.am
+++ b/hw/xwin/glx/Makefile.am
@@ -6,7 +6,8 @@ libXwinGLX_la_SOURCES = \
 	glwindows.h \
 	glwrap.c \
 	indirect.c \
-	wgl_ext_api.c
+	wgl_ext_api.c \
+	wgl_ext_api.h
 
 if XWIN_MULTIWINDOW
 DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
commit 018248136aae19887f10860f33f085f6211a4ceb
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Sep 6 13:51:38 2012 +0100

    Fix compilation of Xorg DDX without XF86VIDMODE
    
    Fix compilation of Xorg DDX without XF86VIDMODE since 6e74fdda, by putting
    xf86vmode.c back under the XF86VIDMODE automake conditional it was accidentally
    taken out of.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Tested-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 1d9fd7ffb03ff6e44f3a8736a94e4558203ce607)

diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index f8fcde9..532d87b 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -15,6 +15,7 @@ XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
 endif
 
 if XF86VIDMODE
+XF86VMODESOURCES = xf86vmode.c
 XF86VMODE_SDK = vidmodeproc.h
 endif
 
@@ -47,7 +48,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
                       xf86VidMode.c xf86fbman.c xf86cmap.c \
                       xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
                       xf86Mode.c xorgHelper.c xf86Extensions.h \
-		      xf86Extensions.c xf86vmode.c \
+		      xf86Extensions.c $(XF86VMODESOURCES) \
                       $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
 nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
 libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
commit d46af347327bd60a4b2a8066b8b7af11f530590d
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Sep 2 15:17:05 2012 +0100

    hw/xwin: Only add GLX extension once.
    
    Using of LoadExtension() to add GLX onto to the end of the list of extensions on
    every server regeneration leads to hilarious consequences (i.e. crashing) after
    the first regeneration :-)
    
    Possibly xf86ExtensionInit() and QuartzExtensionInit() need a similar fix.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
    Tested-by: Colin Harrison <colin.harrison at virgin.net>
    (cherry picked from commit 25741b1aa3a0fb39cb842a43ab52935673cfdefa)

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 37cd8b3..1cf0f02 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -164,7 +164,7 @@ void XwinExtensionInit(void)
     int i;
 
 #ifdef XWIN_GLX_WINDOWS
-    if ((g_fNativeGl) && (serverGeneration == 1)) {
+    if (g_fNativeGl) {
         /* install the native GL provider */
         glxWinPushNativeProvider();
     }
@@ -901,7 +901,8 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
 {
     int i;
 
-    XwinExtensionInit();
+    if (serverGeneration == 1)
+        XwinExtensionInit();
 
     /* Log the command line */
     winLogCommandLine(argc, argv);
commit cdd7413bbe1d8b9b64f5315ecd5ba5cdcba38a2c
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun Sep 2 14:55:25 2012 +0100

    Correct description of -displayfd option in man page.
    
    A display number, not a port number, is written to the specified fd.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 7ceb85481280fecbf033f147f0f7834cad3890c6)

diff --git a/man/Xserver.man b/man/Xserver.man
index 8d243d6..b103551 100644
--- a/man/Xserver.man
+++ b/man/Xserver.man
@@ -130,7 +130,7 @@ causes the server to generate a core dump on fatal errors.
 .B \-displayfd \fIfd\fP
 specifies a file descriptor in the launching process.  Rather than specify
 a display number, the X server will attempt to listen on successively higher
-display numbers, and upon finding a free one, will write the port number back
+display numbers, and upon finding a free one, will write the display number back
 on this file descriptor as a newline-terminated string.  The \-pn option is
 ignored when using \-displayfd.
 .TP 8
commit 8f39a6b0b35764c8d5cac4c7bf66d5902c0ae9a5
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Oct 3 13:12:27 2012 +1000

    xfree86: add xf86UpdateDesktopDimensions()
    
    This call is required for external drivers (specifically NVIDIA) that do
    not share the xfree86 infrastructure to update the desktop dimensions.
    Without it, the driver would update the ScreenRecs but not update the total
    dimensions the input code relies on for transformation.
    
    This call is a thin wrapper around the already-existing internal call and
    should be backported to all stable series servers, with the minor ABI bump.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    CC: Andy Ritger <aritger at nvidia.com>
    Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
    (cherry picked from commit 0a75bd640b3dc26b89d9e342999a7f4b7e98edbf)
    
    Conflicts:
    	hw/xfree86/common/xf86Module.h

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index bb2903d..74da438 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -468,4 +468,8 @@ extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
 /* flags passed to xf86 allocate screen */
 #define XF86_ALLOCATE_GPU_SCREEN 1
 
+/* Update the internal total dimensions of all ScreenRecs together */
+extern _X_EXPORT void
+xf86UpdateDesktopDimensions(void);
+
 #endif                          /* _XF86_H */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index f681a85..721159d 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1898,3 +1898,9 @@ xf86ScrnToScreen(ScrnInfoPtr pScrn)
         return screenInfo.screens[pScrn->scrnIndex];
     }
 }
+
+void
+xf86UpdateDesktopDimensions(void)
+{
+    update_desktop_dimensions();
+}
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 83f9790..f58b87e 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(13, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(13, 1)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(18, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(7, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
commit bea56fc9c460309c676e2ead2080be923d1061dc
Author: Yufeng Shen <miletus at chromium.org>
Date:   Mon Sep 24 14:03:31 2012 -0400

    dix: fix scale_to_desktop for edge ABS events
    
    Scale_to_desktop() converts ABS events from device coordinates
    to screen coordinates:
    [dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max]
    [dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max]
    
    An edge ABS event with X = dev_X_max (e.g., generated from the
    edge of a touchscreen) will be converted to have screen X value
    = screen_X_max, which, however, will be filterd out when xserver
    tries to find proper Window to receive the event, because the
    range check for a Window to receive events is
           window_X_min <= event_screen_X < window_X_max
    Events with event_screen_X = screen_X_max will fail the test get
    and rejected by the Window.
    
    To fix this, we change the device to screen coordinates mapping to
    [dev_X_min, dev_X_max]  -> [screen_X_min, screen_X_max-1]
    [dev_Y_min, dev_Y_max]  -> [screen_Y_min, screen_Y_max-1]
    
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    Signed-off-by: Yufeng Shen <miletus at chromium.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 0b02150c27e98f996e10d7489f9f67a30e4e3497)

diff --git a/dix/getevents.c b/dix/getevents.c
index 4e62507..71d83c4 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -896,9 +896,9 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
 
     /* scale x&y to desktop coordinates */
     *screenx = rescaleValuatorAxis(x, dev->valuator->axes + 0, NULL,
-                                   screenInfo.x, screenInfo.width);
+                                   screenInfo.x, screenInfo.width - 1);
     *screeny = rescaleValuatorAxis(y, dev->valuator->axes + 1, NULL,
-                                   screenInfo.y, screenInfo.height);
+                                   screenInfo.y, screenInfo.height - 1);
 
     *devx = x;
     *devy = y;
commit f9709b8a63c70fd772286000757c8348a6ad5e1d
Author: Daniel Drake <dsd at laptop.org>
Date:   Fri Sep 7 21:48:35 2012 -0400

    Xi: Don't check for TOUCH_END, it's never set
    
    This flag is never set, so checking for it here means that we'll
    never release the simulated mouse button press after the user touches
    (and releases) the touchscreen for the first time.
    
    Fixes a problem where the XO laptop touchpad became totally
    unusable after touching the screen for the first time (since X then
    behaved as if the mouse button was held down all the time).
    
    Signed-off-by: Daniel Drake <dsd at laptop.org>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 3e6358ee6c33979329b78fe2097a1fdf76fb69cd)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 494d07e..6ed4991 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -949,8 +949,6 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent *event)
 
         if (!(event->flags & TOUCH_POINTER_EMULATED))
             return DONT_PROCESS;
-        if (!(event->flags & TOUCH_END))
-            return DONT_PROCESS;
 
         DecreaseButtonCount(device, key, &t->buttonsDown, &t->motionMask,
                             &t->state);
commit f5fad30822ecd4d9767fd8078221910fbf038811
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Sep 28 11:49:29 2012 +1000

    dix: fix crash on XI 1.x grabs on disabled devices.  (#54934)
    
    If the device is disabled, the sprite window is NULL and dereferencing
    crashes the server.
    
    This is only triggered for XI 1.x grabs (ProcXGrabDevice) as XI2 grabs would
    trigger another code path, creating a sprite for the disabled device as if
    detaching it (which is wrong and fixed with this patch too).
    
    Grabbing a disabled device doesn't make sense as it won't send events
    anyway. However, the protocol specs do not prohibit it, so we need to keep
    it working.
    Luckily, oldWin is only used for focus out events, which aren't necessary
    given that the device is disabled.
    
    X.Org Bug 54934 <http://bugs.freedesktop.org/show_bug.cgi?id=54934>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
    (cherry picked from commit 9d6b8365702e4648e793fea21ad22f7174558680)

diff --git a/dix/events.c b/dix/events.c
index 3b40446..c0e330b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1555,11 +1555,13 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
     WindowPtr oldWin;
 
     /* slave devices need to float for the duration of the grab. */
-    if (grab->grabtype == XI2 &&
+    if (grab->grabtype == XI2 && keybd->enabled &&
         !(passive & ImplicitGrabMask) && !IsMaster(keybd))
         DetachFromMaster(keybd);
 
-    if (grabinfo->grab)
+    if (!keybd->enabled)
+        oldWin = NULL;
+    else if (grabinfo->grab)
         oldWin = grabinfo->grab->window;
     else if (keybd->focus)
         oldWin = keybd->focus->win;
@@ -1569,7 +1571,8 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
         oldWin = keybd->focus->win;
     if (keybd->valuator)
         keybd->valuator->motionHintWindow = NullWindow;
-    DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
+    if (oldWin)
+        DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
     if (syncEvents.playingEvents)
         grabinfo->grabTime = syncEvents.time;
     else
commit aacfc321b44eae15020875a2b2c9b6ff0e14dd8c
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Sep 7 18:17:46 2012 +0100

    Touch: Fix duplicate TouchBegin selection with virtual devices
    
    Given the following scenario:
      1) client A selects for TouchBegin on window W for device D
      2) client B selects for TouchBegin on window W for XIAllDevices
      3) client C selects for TouchBegin on window W with device E
    
    Step 3 will fail with BadImplementation, because attempting to look up
    XIAllDevices or XIAllMasterDevices with dixLookupDevices doesn't work.
    This should succeed (or, if it was selecting for device D, fail with
    BadAccess as it would be a duplicate selection).
    
    Fix this by performing the appropriate lookup for virtual devices.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
    (cherry picked from commit 3d2b768efae9936c6929c2bc13c7a1acc074ecd3)

diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 0e45cb8..ab1b624 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -180,8 +180,13 @@ ProcXISelectEvents(ClientPtr client)
                     if (CLIENT_ID(iclient->resource) == client->index)
                         continue;
 
-                    dixLookupDevice(&tmp, evmask->deviceid, serverClient,
-                                    DixReadAccess);
+                    if (evmask->deviceid == XIAllDevices)
+                        tmp = inputInfo.all_devices;
+                    else if (evmask->deviceid == XIAllMasterDevices)
+                        tmp = inputInfo.all_master_devices;
+                    else
+                        dixLookupDevice(&tmp, evmask->deviceid, serverClient,
+                                        DixReadAccess);
                     if (!tmp)
                         return BadImplementation;       /* this shouldn't happen */
 
commit e31e272f4fc8b2aa8e2101b89bb65bc1d6a5e1be
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Sep 20 05:56:39 2012 +1000

    dix: set the device transformation matrix
    
    The property handler is registered after setting the property, so
    dev->transform remains as all-zeros. That causes pixman_f_transform_invert()
    to fail (in transformAbsolute()) and invert remains as garbage. This
    may then cause a cursor jump to 0,0.
    
    Since the axes are not yet initialized here and we need to allow for drivers
    changing the matrix, we cannot use the property handler for matrix
    initialization, essentially duplicating the code.
    
    Triggered by the fix to (#49347) in 749a593e49adccdf1225be28a521412ec85333f4
    
    https://bugzilla.redhat.com/show_bug.cgi?id=852841
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at ubuntu.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 3d1051aecbb1955084804133cacd12c7f696833a)

diff --git a/dix/devices.c b/dix/devices.c
index 9cf04ed..66d4406 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -306,6 +306,9 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     /* unity matrix */
     memset(transform, 0, sizeof(transform));
     transform[0] = transform[4] = transform[8] = 1.0f;
+    dev->transform.m[0][0] = 1.0;
+    dev->transform.m[1][1] = 1.0;
+    dev->transform.m[2][2] = 1.0;
 
     XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_TRANSFORM),
                            XIGetKnownProperty(XATOM_FLOAT), 32,


More information about the Xquartz-changes mailing list