[Xquartz-changes] xserver: Branch 'master' - 12 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Jul 1 10:17:42 PDT 2010


Rebased ref, commits from common ancestor:
commit 3375972c90591db889db7fd1bba1caa75f128528
Author: Jan Hauffa <hauffa at in.tum.de>
Date:   Wed Jun 16 09:25:41 2010 -0700

    XQuartz: Remove some dead code.
    
    Signed-off-by: Jan Hauffa <hauffa at in.tum.de>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 2828c57..bdaa262 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -67,12 +67,8 @@
 #define FAKE_RANDR 1
 
 // Shared global variables for Quartz modes
-int                     quartzEventWriteFD = -1;
 int                     quartzUseSysBeep = 0;
-int                     quartzUseAGL = 1;
-int                     quartzEnableKeyEquivalents = 1;
 int                     quartzServerVisible = FALSE;
-int                     quartzServerQuitting = FALSE;
 DevPrivateKeyRec        quartzScreenKeyRec;
 int                     aquaMenuBarHeight = 0;
 QuartzModeProcsPtr      quartzProcs = NULL;
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 4501472..54c900d 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -44,17 +44,6 @@
 #include "darwin.h"
 
 /*
- * QuartzFSUseQDCursor
- *  Return whether the screen should use a QuickDraw cursor.
- */
-int QuartzFSUseQDCursor(
-    int depth)  // screen depth
-{
-    return TRUE;
-}
-
-
-/*
  * QuartzBlockHandler
  *  Clean out any autoreleased objects.
  */
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index c038ed0..eb761ed 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -51,20 +51,13 @@ typedef struct {
 #define QUARTZ_PRIV(pScreen) \
     ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
 
-// Data stored at startup for Cocoa front end
-extern int              quartzEventWriteFD;
-
 // User preferences used by Quartz modes
 extern int              quartzUseSysBeep;
-extern int              focusOnNewWindow;
-extern int              quartzUseAGL;
-extern int              quartzEnableKeyEquivalents;
 extern int              quartzFullscreenDisableHotkeys;
 extern int              quartzOptionSendsAlt;
 
 // Other shared data
 extern int              quartzServerVisible;
-extern int              quartzServerQuitting;
 extern DevPrivateKeyRec quartzScreenKeyRec;
 #define quartzScreenKey (&quartzScreenKeyRec)
 extern int              aquaMenuBarHeight;
@@ -72,14 +65,6 @@ extern int              aquaMenuBarHeight;
 // Name of GLX bundle for native OpenGL
 extern const char      *quartzOpenGLBundle;
 
-void QuartzReadPreferences(void);
-void QuartzMessageMainThread(unsigned msg, void *data, unsigned length);
-void QuartzMessageServerThread(int type, int argc, ...);
-void QuartzSetWindowMenu(int nitems, const char **items,
-                         const char *shortcuts);
-void QuartzFSCapture(void);
-void QuartzFSRelease(void);
-int  QuartzFSUseQDCursor(int depth);
 void QuartzBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask);
 void QuartzWakeupHandler(pointer blockData, int result, pointer pReadmask);
 
commit a71dbc03e65cf7b0654a6eca93ce0bf6a1711ffa
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jul 1 08:27:05 2010 -0400

    Bump to version 1.8.99.904 (1.9 RC4)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 5c18a12..b3b752c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.8.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2010-06-22"
+AC_INIT([xorg-server], 1.8.99.904, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2010-07-01"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 5ea497fc32202ff19c2b7d8ef4eba08889108a87
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Jun 29 16:08:02 2010 +0300

    xfree86: configure: remove vendor and card name matching rules
    
    Although vendor and board naming are used to create the configure file, the
    server doesn't actually use it when fetching such file and probing devices.
    
    Reported-by: Richard Barnette <jrbarnette at chromium.org>
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Tested-by: Richard Barnette <jrbarnette at chromium.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 822d767..da654f0 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -107,8 +107,6 @@ bus_sbus_configure(void *busData)
 static void
 bus_pci_newdev_configure(void *busData, int i, int *chipset)
 {
-	const char *VendorName;
-	const char *CardName;
 	char busnum[8];
     struct pci_device * pVideo = NULL;
 
@@ -116,26 +114,6 @@ bus_pci_newdev_configure(void *busData, int i, int *chipset)
 
 	DevToConfig[i].pVideo = pVideo;
 
-	VendorName = pci_device_get_vendor_name( pVideo );
-	CardName = pci_device_get_device_name( pVideo );
-
-	if (!VendorName) {
-	    VendorName = xnfalloc(15);
-	    sprintf((char*)VendorName, "Unknown Vendor");
-	}
-
-	if (!CardName) {
-	    CardName = xnfalloc(14);
-	    sprintf((char*)CardName, "Unknown Board");
-	}
-
-	DevToConfig[i].GDev.identifier =
-	    xnfalloc(strlen(VendorName) + strlen(CardName) + 2);
-	sprintf(DevToConfig[i].GDev.identifier, "%s %s", VendorName, CardName);
-
-	DevToConfig[i].GDev.vendor = (char *)VendorName;
-	DevToConfig[i].GDev.board = (char *)CardName;
-
 	DevToConfig[i].GDev.busID = xnfalloc(16);
 	xf86FormatPciBusNumber(pVideo->bus, busnum);
 	sprintf(DevToConfig[i].GDev.busID, "PCI:%s:%d:%d",
@@ -357,9 +335,6 @@ configureDeviceSection (int screennum)
     /* Move device info to parser structure */
     sprintf(identifier, "Card%d", screennum);
     ptr->dev_identifier = strdup(identifier);
-/*    ptr->dev_identifier = DevToConfig[screennum].GDev.identifier;*/
-    ptr->dev_vendor = DevToConfig[screennum].GDev.vendor;
-    ptr->dev_board = DevToConfig[screennum].GDev.board;
     ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
     ptr->dev_busid = DevToConfig[screennum].GDev.busID;
     ptr->dev_driver = DevToConfig[screennum].GDev.driver;
commit 90fd9e40b59e69333d250a795998f44dc3a5dc0c
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Jun 29 16:08:01 2010 +0300

    xfree86: pci: remove superfluous vendor and card name logging
    
    X server suffers in startup time when relying on the pciaccess's linear search
    to fetch vendor and video device name from PCI ID file (when existent). Such
    names are only used to write the log, which may be superfluous. This
    information often is provided by the drivers or likewise users can get the it
    using external tools like lspci or scanpci.
    
    This patch remove the references of those functions from X start up.
    
    Reported-by: Richard Barnette <jrbarnette at chromium.org>
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Tested-by: Richard Barnette <jrbarnette at chromium.org>
    Reviewed-by: James Cloos <cloos at jhcloos.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Alex Deucher <alexdeucher at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 1517951..74016af 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -151,18 +151,13 @@ xf86PciProbe(void)
     
     /* Print a summary of the video devices found */
     for (k = 0; k < num; k++) {
-	const char *vendorname = NULL, *chipname = NULL;
 	const char *prim = " ";
 	Bool memdone = FALSE, iodone = FALSE;
 
 
 	info = xf86PciVideoInfo[k];
 
-	vendorname = pci_device_get_vendor_name( info );
-	chipname = pci_device_get_device_name( info );
-
-	if ((!vendorname || !chipname) &&
-	    !PCIALWAYSPRINTCLASSES(info->device_class))
+	if (!PCIALWAYSPRINTCLASSES(info->device_class))
 	    continue;
 
 	if (xf86IsPrimaryPci(info))
@@ -173,12 +168,6 @@ xf86PciProbe(void)
 		info->vendor_id, info->device_id,
 		info->subvendor_id, info->subdevice_id);
 
-	if (vendorname)
-	    xf86ErrorF("%s ", vendorname);
-
-	if (chipname)
-	    xf86ErrorF("%s ", chipname);
-
 	xf86ErrorF("rev %d", info->revision);
 
 	for (i = 0; i < 6; i++) {
commit f028e70ca714f6956e41754f132cb9b8a1e8db63
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jun 30 08:33:55 2010 -0700

    Initialize dev privates before using any
    
    Initializing the dev privates code after allocating the server client
    dev privates would cause the memory leak check to fire at server
    startup or reset.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Acked-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/dix/main.c b/dix/main.c
index 5c46dc1..47a932f 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -184,6 +184,9 @@ int main(int argc, char *argv[], char *envp[])
 	clients[0] = serverClient;
 	currentMaxClients = 1;
 
+	/* Initialize privates before first allocation */
+	dixResetPrivates();
+
 	/* Initialize server client devPrivates, to be reallocated as
 	 * more client privates are registered
 	 */
@@ -200,7 +203,6 @@ int main(int argc, char *argv[], char *envp[])
 	InitEvents();
 	InitSelections();
 	InitGlyphCaching();
-	dixResetPrivates();
 	dixResetRegistry();
 	ResetFontPrivateIndex();
 	InitCallbackManager();
commit 433d0851cd3e61d841ff374ee0a0f052d5907029
Author: Julien Cristau <jcristau at debian.org>
Date:   Fri Jun 25 11:34:44 2010 +0100

    Xephyr: fix Xv adaptor capability tests
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index 9dde768..600b50f 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -380,7 +380,8 @@ ephyrHostXVAdaptorHasPutVideo (const EphyrHostXVAdaptor *a_this,
 {
     EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
 
-    if (((XvAdaptorInfo*)a_this)->type & XvVideoMask & XvInputMask)
+    if ((((XvAdaptorInfo*)a_this)->type & (XvVideoMask | XvInputMask)) ==
+		    (XvVideoMask | XvInputMask))
         *a_result = TRUE ;
     else
         *a_result = FALSE ;
@@ -391,7 +392,8 @@ Bool
 ephyrHostXVAdaptorHasGetVideo (const EphyrHostXVAdaptor *a_this,
                                Bool *a_result)
 {
-    if (((XvAdaptorInfo*)a_this)->type & XvVideoMask & XvOutputMask)
+    if ((((XvAdaptorInfo*)a_this)->type & (XvVideoMask | XvOutputMask)) ==
+		    (XvVideoMask | XvOutputMask))
         *a_result = TRUE ;
     else
         *a_result = FALSE ;
@@ -404,7 +406,8 @@ ephyrHostXVAdaptorHasPutStill (const EphyrHostXVAdaptor *a_this,
 {
     EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
 
-    if (((XvAdaptorInfo*)a_this)->type & XvStillMask && XvInputMask)
+    if ((((XvAdaptorInfo*)a_this)->type & (XvStillMask | XvInputMask)) ==
+		    (XvStillMask | XvInputMask))
         *a_result = TRUE ;
     else
         *a_result = FALSE ;
@@ -417,7 +420,8 @@ ephyrHostXVAdaptorHasGetStill (const EphyrHostXVAdaptor *a_this,
 {
     EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
 
-    if (((XvAdaptorInfo*)a_this)->type & XvStillMask && XvOutputMask)
+    if ((((XvAdaptorInfo*)a_this)->type & (XvStillMask | XvOutputMask)) ==
+		    (XvStillMask | XvOutputMask))
         *a_result = TRUE ;
     else
         *a_result = FALSE ;
@@ -430,7 +434,8 @@ ephyrHostXVAdaptorHasPutImage (const EphyrHostXVAdaptor *a_this,
 {
     EPHYR_RETURN_VAL_IF_FAIL (a_this && a_result, FALSE) ;
 
-    if (((XvAdaptorInfo*)a_this)->type & XvImageMask && XvInputMask)
+    if ((((XvAdaptorInfo*)a_this)->type & (XvImageMask | XvInputMask)) ==
+		    (XvImageMask | XvInputMask))
         *a_result = TRUE ;
     else
         *a_result = FALSE ;
commit 9626eedebf620559652ffb1fefa82b5d659e57be
Author: Julien Cristau <jcristau at debian.org>
Date:   Thu Jun 24 18:45:11 2010 +0100

    configure: bail if Xephyr was requested but its dependencies are missing
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 4491e90..5c18a12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2073,6 +2073,9 @@ if test "$KDRIVE" = yes; then
     if test "x$XEPHYR" = xauto; then
         XEPHYR=$xephyr
     fi
+    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
+        AC_MSG_ERROR([Xephyr dependencies missing])
+    fi
 
     # Xephyr needs nanosleep() which is in librt on Solaris
     AC_CHECK_FUNC([nanosleep], [],
commit e6531ae9d5bdd37775e921268366fb76056e22d5
Author: Julien Cristau <jcristau at debian.org>
Date:   Thu Jun 24 18:45:10 2010 +0100

    Xephyr: fix memory leak in XF86DRIOpenConnection
    
    The allocated bus id string was not being freed.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 4041bf5..ce584b0 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -682,7 +682,7 @@ ProcXF86DRIOpenConnection (register ClientPtr client)
 {
     xXF86DRIOpenConnectionReply rep;
     drm_handle_t			hSAREA;
-    char*			busIdString;
+    char*			busIdString = NULL;
     REQUEST(xXF86DRIOpenConnectionReq);
     REQUEST_SIZE_MATCH(xXF86DRIOpenConnectionReq);
 
@@ -716,6 +716,7 @@ ProcXF86DRIOpenConnection (register ClientPtr client)
     WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), (char *)&rep);
     if (rep.busIdStringLength)
         WriteToClient(client, rep.busIdStringLength, busIdString);
+    free(busIdString);
     EPHYR_LOG ("leave\n") ;
     return Success;
 }
commit 390a8466dd1914f4786b811ff8454f6e0c4b6b04
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Mon Jun 28 23:26:48 2010 +0300

    xfree86/modes: Allow the driver to specify initial rotation
    
    When the "Rotate" option isn't specified allow the driver to specify
    the initial rotation mode. This way the driver can choose to retain
    the same settings that were used by software that was used prior to
    starting X.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7f6fad3..b2daec7 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -572,8 +572,11 @@ xf86OutputInitialRotation (xf86OutputPtr output)
 						OPTION_ROTATE);
     int	    i;
 
-    if (!rotate_name)
+    if (!rotate_name) {
+	if (output->initial_rotation)
+	    return output->initial_rotation;
 	return RR_Rotate_0;
+    }
     
     for (i = 0; i < 4; i++)
 	if (xf86nameCompare (direction[i], rotate_name) == 0)
commit 6052710670953b43b4fff5d101b727163fcb1187
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jun 30 08:21:04 2010 -0700

    xkb: merge lockedPtrButtons state from all attached SDs.
    
    Problem:
    lockedPtrButtons keeps the state of the buttons locked by a PointerKeys button
    press. Unconditionally clearing the bits may cause stuck buttons in this
    sequence of events:
    
    1. type Shift + NumLock to enable PointerKeys
    2. type 0/Ins on keypad to emulate Button 1 press
            → button1 press event to client
    3. press and release button 1 on physical mouse
            → button1 release event to client
    
    Button 1 on the MD is now stuck and cannot be released.
    
    Cause:
    XKB PointerKeys button events are posted through the XTEST pointer device.
    Once a press is generated, the XTEST device's button is down. The DIX merges
    the button state of all attached SDs, hence the MD will have a button down
    while the XTEST device has a button down.
    
    PointerKey button events are only generated on the master device to avoid
    duplicate events (see XkbFakeDeviceButton()). If the MD has the
    lockedPtrButtons bit cleared by a release event on a physical device, no
    such event is generated when a keyboard device triggers the PointerKey
    ButtonRelease trigger. Since the event - if generated - is posted through
    the XTEST pointer device, lack of a generated ButtonRelease event on the
    XTEST pointer device means the button is never released, resulting in the
    stuck button observed above.
    
    Solution:
    This patch merges the MD's lockedPtrButtons with the one of all attached
    slave devices on release events. Thus, as long as one attached keyboard has
    a lockedPtrButtons bit set, this bit is kept in the MD. Once a PointerKey
    button is released on all keyboards, the matching release event is emulated
    from the MD through the XTEST pointer device, thus also releasing the button
    in the DIX.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 5847e63..956b224 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -924,6 +924,9 @@ extern int XkbGetEffectiveGroup(
         XkbStatePtr             /* xkbstate */,
         CARD8                   /* keycode */);
 
+extern void XkbMergeLockedPtrBtns(
+        DeviceIntPtr            /* master */);
+
 #include "xkbfile.h"
 #include "xkbrules.h"
 
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index b5486b7..451c797 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -707,8 +707,24 @@ DeviceEvent     *event = &ev->device_event;
 	    changed |= XkbPointerButtonMask;
     }
     else if (event->type == ET_ButtonRelease) {
-	if (xkbi)
+	if (xkbi) {
 	    xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
+
+            /* Merge this MD's lockedPtrButtons with the one of all
+             * attached slave devices.
+             * The DIX uses a merged button state for MDs, not
+             * releasing buttons until the last SD has released
+             * thenm. If we unconditionally clear the
+             * lockedPtrButtons bit on the MD, a PointerKeys button
+             * release on the SD keyboard won't generate the required fake button
+             * event on the XTEST pointer, thus never processing the
+             * button event in the DIX and the XTEST pointer's
+             * buttons stay down - result is a stuck button.
+             */
+	    if (IsMaster(dev))
+                XkbMergeLockedPtrBtns(dev);
+	}
+
 	changed |= XkbPointerButtonMask;
     }
 
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index c5030d0..b4b8395 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -633,6 +633,16 @@ _XkbFilterPointerBtn(	XkbSrvInfoPtr	xkbi,
 		    break;
 		}
 		xkbi->lockedPtrButtons&= ~(1<<button);
+
+		if (IsMaster(xkbi->device))
+		{
+		    XkbMergeLockedPtrBtns(xkbi->device);
+                    /* One SD still has lock set, don't post event */
+		    if ((xkbi->lockedPtrButtons & (1 << button)) != 0)
+			break;
+		}
+
+		/* fallthrough */
 	    case XkbSA_PtrBtn:
 		XkbFakeDeviceButton(xkbi->device, 0, button);
 		break;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 3344e50..14dc784 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -2094,3 +2094,29 @@ XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode)
 
     return effectiveGroup;
 }
+
+/* Merge the lockedPtrButtons from all attached SDs for the given master
+ * device into the MD's state.
+ */
+void
+XkbMergeLockedPtrBtns(DeviceIntPtr master)
+{
+    DeviceIntPtr d = inputInfo.devices;
+    XkbSrvInfoPtr xkbi = NULL;
+
+    if (!IsMaster(master))
+        return;
+
+    if (!master->key)
+        return;
+
+    xkbi = master->key->xkbInfo;
+    xkbi->lockedPtrButtons = 0;
+
+    for (; d; d = d->next) {
+        if (IsMaster(d) || GetMaster(d, MASTER_KEYBOARD) != master || !d->key)
+            continue;
+
+        xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
+    }
+}
commit 28e33ae6f69f716ece5d68e63fc52557236c5f6e
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Wed Jun 30 07:59:04 2010 -0700

    OS support: fix writeable client vs IgnoreClient behavior
    
    When ResetCurrentRequest is called, or IgnoreClient is called when a
    client has input pending, IgnoredClientsWithInput will be set.  However,
    a subsequent IgnoreClient request will clear the client fd from that fd
    set, potentially causing the client to hang.
    
    So add an Ignore/Attend count, and only apply the ignore logic on the
    first ignore and the attend logic on the last attend.  This is
    consistent with the comments for these functions; callers must pair
    them.
    
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=27035.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/dixstruct.h b/include/dixstruct.h
index 9610427..efa2577 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -98,6 +98,7 @@ typedef struct _Client {
     int         clientGone;
     int         noClientException;	/* this client died or needs to be
 					 * killed */
+    int         ignoreCount;		/* count for Attend/IgnoreClient */
     SaveSetElt	*saveSet;
     int         numSaved;
     int         (**requestVector) (
diff --git a/os/connection.c b/os/connection.c
index cd0ca5e..c143fb6 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -1147,6 +1147,10 @@ IgnoreClient (ClientPtr client)
     OsCommPtr oc = (OsCommPtr)client->osPrivate;
     int connection = oc->fd;
 
+    client->ignoreCount++;
+    if (client->ignoreCount > 1)
+	return;
+
     isItTimeToYield = TRUE;
     if (!GrabInProgress || FD_ISSET(connection, &AllClients))
     {
@@ -1181,6 +1185,11 @@ AttendClient (ClientPtr client)
 {
     OsCommPtr oc = (OsCommPtr)client->osPrivate;
     int connection = oc->fd;
+
+    client->ignoreCount--;
+    if (client->ignoreCount)
+	return;
+
     if (!GrabInProgress || GrabInProgress == client->index ||
 	FD_ISSET(connection, &GrabImperviousClients))
     {
commit 018c878e9495b21146c8f38617fdd1bf6d8cc73b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jun 25 09:48:10 2010 +1000

    Revert "dix: use the event mask of the grab for TryClientEvents."
    
    Behaviour of earlier X servers was to deliver the ButtonPress event
    unconditionally, regardless of the actual event mask being set. Thus, a
    GrabButton event will always deliver the button press event, a GrabKey
    always the key press event, etc. Same goes for XI and XI2.
    
    Reproducible with a simple client requesting a button grab in the form of:
        XGrabButton(dpy, AnyButton, AnyModifier, win, True, ButtonReleaseMask,
                    GrabModeAsync, GrabModeAsync, None, None);
    
    On servers before MPX/XI2, the client will receive a button press and
    release event. On current servers, the client receives only the release.
    Clients that expect the press event to be delivered unconditionally may
    leave the user with a stuck grab.
    
    XTS test results for XGrabButton are identical with and without this patch.
    
    This reverts commit 48585bd1e3e98db0f3df1ecc68022510216e00cc.
    
    Conflicts:
    
    	dix/events.c
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/events.c b/dix/events.c
index ae9847c..e1c3d0a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3420,7 +3420,6 @@ CheckPassiveGrabsOnWindow(
     {
 	DeviceIntPtr	gdev;
 	XkbSrvInfoPtr	xkbi = NULL;
-	Mask		mask = 0;
 
 	gdev= grab->modifierDevice;
         if (grab->grabtype == GRABTYPE_CORE)
@@ -3535,9 +3534,6 @@ CheckPassiveGrabsOnWindow(
                 }
                 xE = &core;
                 count = 1;
-                mask = grab->eventMask;
-                if (grab->ownerEvents)
-                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3549,34 +3545,6 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 count = 1;
-
-                /* FIXME: EventToXI2 returns NULL for enter events, so
-                 * dereferencing the event is bad. Internal event types are
-                 * aligned with core events, so the else clause is valid.
-                 * long-term we should use internal events for enter/focus
-                 * as well */
-                if (xE)
-                    mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
-                else if (event->type == XI_Enter || event->type == XI_FocusIn)
-                    mask = grab->xi2mask[device->id][event->type/8];
-
-                if (grab->ownerEvents && wOtherInputMasks(grab->window))
-                {
-                    InputClientsPtr icp =
-                        wOtherInputMasks(grab->window)->inputClients;
-
-                    while(icp)
-                    {
-                        if (rClient(icp) == rClient(grab))
-                        {
-                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
-                            mask |= icp->xi2mask[device->id][evtype/8];
-                            break;
-                        }
-
-                        icp = icp->next;
-                    }
-                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3587,23 +3555,6 @@ CheckPassiveGrabsOnWindow(
                                 "(%d, %d).\n", device->name, event->type, rc);
                     continue;
                 }
-                mask = grab->eventMask;
-                if (grab->ownerEvents && wOtherInputMasks(grab->window))
-                {
-                    InputClientsPtr icp =
-                        wOtherInputMasks(grab->window)->inputClients;
-
-                    while(icp)
-                    {
-                        if (rClient(icp) == rClient(grab))
-                        {
-                            mask |= icp->mask[device->id];
-                            break;
-                        }
-
-                        icp = icp->next;
-                    }
-                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
@@ -3612,7 +3563,8 @@ CheckPassiveGrabsOnWindow(
             {
                 FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
 
-                TryClientEvents(rClient(grab), device, xE, count, mask,
+                TryClientEvents(rClient(grab), device, xE, count,
+                                       GetEventFilter(device, xE),
                                        GetEventFilter(device, xE), grab);
             }
 


More information about the Xquartz-changes mailing list