[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-unstable'



 Xi/exevents.c                         |   11 
 Xi/extinit.c                          |    2 
 Xi/xipassivegrab.c                    |   16 
 configure.ac                          |    6 
 dbe/dbe.c                             |   25 
 dix/devices.c                         |   47 
 dix/main.c                            |   25 
 dix/ptrveloc.c                        |    2 
 glx/Makefile.am                       |    6 
 glx/glapi.c                           |  558 --
 glx/glapi.h                           |   28 
 glx/glapitemp.h                       | 6655 ----------------------------------
 glx/glxcmds.c                         |  109 
 glx/glxdri2.c                         |    1 
 glx/glxdriswrast.c                    |    8 
 glx/glxext.c                          |   53 
 glx/glxserver.h                       |    7 
 hw/xfree86/Makefile.am                |    2 
 hw/xquartz/GL/indirect.c              |    9 
 hw/xquartz/X11Application.m           |    2 
 hw/xquartz/applewmExt.h               |   13 
 hw/xquartz/bundle/Info.plist.cpp      |    4 
 hw/xquartz/darwinEvents.c             |   28 
 hw/xquartz/mach-startup/bundle-main.c |   47 
 hw/xquartz/pbproxy/app-main.m         |    6 
 hw/xquartz/pbproxy/main.m             |   16 
 hw/xquartz/pbproxy/x-selection.m      |   11 
 hw/xquartz/quartz.c                   |   15 
 hw/xquartz/quartzRandR.c              |  219 -
 hw/xquartz/xpr/xprAppleWM.c           |    4 
 hw/xquartz/xpr/xprScreen.c            |    1 
 include/input.h                       |    5 
 include/inputstr.h                    |    2 
 mi/mieq.c                             |   16 
 miext/rootless/rootlessScreen.c       |    2 
 os/access.c                           |    2 
 os/log.c                              |    4 
 os/xstrans.c                          |    5 
 record/record.c                       |    2 
 test/input.c                          |   24 
 40 files changed, 439 insertions(+), 7559 deletions(-)

New commits:
commit d784fd09dc277610d5f4e98d577c4fdcd9215f9c
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat May 28 16:59:05 2011 -0700

    configure.ac: Bump version to 1.10.2
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/configure.ac b/configure.ac
index 3a2120c..398d16f 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.10.1.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-05-20"
+AC_INIT([xorg-server], 1.10.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-05-28"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit 398114c1489fbfc9fe487de38ff4a4176755eee6
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sun May 22 10:18:36 2011 -0700

    XQuartz: Don't crash if CG increases our display resolution
    
    miPaintWindow would cause fbFill() to overwrite pScreen's pixmap which was
    sized for the old resolution.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 1fb501ad1521cfedaa5cf3052d45a924ef1866cf)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 7de7138..226cb2f 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -239,8 +239,6 @@ void QuartzUpdateScreens(void) {
     AppleWMSetScreenOrigin(pRoot);
     pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL);
 
-    miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
-
     /* <rdar://problem/7770779> pointer events are clipped to old display region after display reconfiguration
      * http://xquartz.macosforge.org/trac/ticket/346
      */
@@ -268,6 +266,9 @@ void QuartzUpdateScreens(void) {
 
     quartzProcs->UpdateScreen(pScreen);
 
+    /* miPaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
+    miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
+
     /* Tell RandR about the new size, so new connections get the correct info */
     RRScreenSizeNotify(pScreen);
 }

commit dc6efd99887c90bb14e066e46b69ca5ba19b6a09
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sun May 22 09:32:57 2011 -0700

    XQuartz: RandR: Don't crash if X11 is launched while there are no attached displays
    
    If CG reports no displays when launching, we could crash in RandR.  Instead, just
    provide a fake 800x600 display until we are notified about displays being attached.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 60af79e35ee8546a99d15a1358aac3deabfa22be)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 11e5a74..7de7138 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -464,11 +464,15 @@ void QuartzSpaceChanged(uint32_t space_id) {
 void QuartzCopyDisplayIDs(ScreenPtr pScreen,
                           int displayCount, CGDirectDisplayID *displayIDs) {
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-    int size = displayCount * sizeof(CGDirectDisplayID);
 
     free(pQuartzScreen->displayIDs);
-    pQuartzScreen->displayIDs = malloc(size);
-    memcpy(pQuartzScreen->displayIDs, displayIDs, size);
+    if(displayCount) {
+        size_t size = displayCount * sizeof(CGDirectDisplayID);
+        pQuartzScreen->displayIDs = malloc(size);
+        memcpy(pQuartzScreen->displayIDs, displayIDs, size);
+    } else {
+       pQuartzScreen->displayIDs = NULL;
+    }
     pQuartzScreen->displayCount = displayCount;
 }
 
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index d452b02..98b382d 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
  *               2010      Jan Hauffa.
- *               2010      Apple Inc.
+ *               2010-2011 Apple Inc.
  *                 All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -124,44 +124,48 @@ static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
 static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
                                        QuartzModeCallback callback,
                                        void *data) {
-    CFDictionaryRef curModeRef, modeRef;
-    long curBpp;
-    CFArrayRef modes;
-    QuartzModeInfo modeInfo;
-    int i;
-    BOOL retval = FALSE;
+    Bool retval = FALSE;
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-    CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
 
-    curModeRef = CGDisplayCurrentMode(screenId);
-    if (!curModeRef)
-        return FALSE;
-    curBpp = getDictLong(curModeRef, kCGDisplayBitsPerPixel);
+    /* Just an 800x600 fallback if we have no attached heads */
+    if(pQuartzScreen->displayIDs) {
+        CFDictionaryRef curModeRef, modeRef;
+        long curBpp;
+        CFArrayRef modes;
+        QuartzModeInfo modeInfo;
+        int i;
+        CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
+
+        curModeRef = CGDisplayCurrentMode(screenId);
+        if (!curModeRef)
+            return FALSE;
+        curBpp = getDictLong(curModeRef, kCGDisplayBitsPerPixel);
 
-    modes = CGDisplayAvailableModes(screenId);
-    if (!modes)
-        return FALSE;
-    for (i = 0; i < CFArrayGetCount(modes); i++) {
-        int cb;
-        modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
-
-        /* Skip modes that are not usable on the current display or have a
-           different pixel encoding than the current mode. */
-        if (((unsigned long) getDictLong(modeRef, kCGDisplayIOFlags) &
-             kDisplayModeUsableFlags) != kDisplayModeUsableFlags)
-            continue;
-        if (getDictLong(modeRef, kCGDisplayBitsPerPixel) != curBpp)
-            continue;
-
-        QuartzRandRGetModeInfo(modeRef, &modeInfo);
-        modeInfo.ref = (void *)modeRef;
-        cb = callback(pScreen, &modeInfo, data);
-        if (cb == CALLBACK_CONTINUE)
-            retval = TRUE;
-        else if (cb == CALLBACK_SUCCESS)
-            return TRUE;
-        else if (cb == CALLBACK_ERROR)
+        modes = CGDisplayAvailableModes(screenId);
+        if (!modes)
             return FALSE;
+        for (i = 0; i < CFArrayGetCount(modes); i++) {
+            int cb;
+            modeRef = (CFDictionaryRef) CFArrayGetValueAtIndex(modes, i);
+
+            /* Skip modes that are not usable on the current display or have a
+               different pixel encoding than the current mode. */
+            if (((unsigned long) getDictLong(modeRef, kCGDisplayIOFlags) &
+                 kDisplayModeUsableFlags) != kDisplayModeUsableFlags)
+                continue;
+            if (getDictLong(modeRef, kCGDisplayBitsPerPixel) != curBpp)
+                continue;
+
+            QuartzRandRGetModeInfo(modeRef, &modeInfo);
+            modeInfo.ref = (void *)modeRef;
+            cb = callback(pScreen, &modeInfo, data);
+            if (cb == CALLBACK_CONTINUE)
+                retval = TRUE;
+            else if (cb == CALLBACK_SUCCESS)
+                return TRUE;
+            else if (cb == CALLBACK_ERROR)
+                return FALSE;
+        }
     }
 
     switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
@@ -225,61 +229,64 @@ static Bool QuartzRandRSetCGMode (CGDirectDisplayID screenId,
 static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
                                        QuartzModeCallback callback,
                                        void *data) {
-    CGDisplayModeRef curModeRef, modeRef;
-    CFStringRef curPixelEnc, pixelEnc;
-    CFComparisonResult pixelEncEqual;
-    CFArrayRef modes;
-    QuartzModeInfo modeInfo;
-    int i;
     Bool retval = FALSE;
-
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-    CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
 
-    curModeRef = CGDisplayCopyDisplayMode(screenId);
-    if (!curModeRef)
-        return FALSE;
-    curPixelEnc = CGDisplayModeCopyPixelEncoding(curModeRef);
-    CGDisplayModeRelease(curModeRef);
+    /* Just an 800x600 fallback if we have no attached heads */
+    if(pQuartzScreen->displayIDs) {
+        CGDisplayModeRef curModeRef, modeRef;
+        CFStringRef curPixelEnc, pixelEnc;
+        CFComparisonResult pixelEncEqual;
+        CFArrayRef modes;
+        QuartzModeInfo modeInfo;
+        int i;
+        CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
+
+        curModeRef = CGDisplayCopyDisplayMode(screenId);
+        if (!curModeRef)
+            return FALSE;
+        curPixelEnc = CGDisplayModeCopyPixelEncoding(curModeRef);
+        CGDisplayModeRelease(curModeRef);
 
-    modes = CGDisplayCopyAllDisplayModes(screenId, NULL);
-    if (!modes) {
-        CFRelease(curPixelEnc);
-        return FALSE;
-    }
-    for (i = 0; i < CFArrayGetCount(modes); i++) {
-        int cb;
-        modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
-
-        /* Skip modes that are not usable on the current display or have a
-           different pixel encoding than the current mode. */
-        if ((CGDisplayModeGetIOFlags(modeRef) & kDisplayModeUsableFlags) !=
-            kDisplayModeUsableFlags)
-            continue;
-        pixelEnc = CGDisplayModeCopyPixelEncoding(modeRef);
-        pixelEncEqual = CFStringCompare(pixelEnc, curPixelEnc, 0);
-        CFRelease(pixelEnc);
-        if (pixelEncEqual != kCFCompareEqualTo)
-            continue;
-
-        QuartzRandRGetModeInfo(modeRef, &modeInfo);
-        modeInfo.ref = modeRef;
-        cb = callback(pScreen, &modeInfo, data);
-        if (cb == CALLBACK_CONTINUE) {
-            retval = TRUE;
-        } else if (cb == CALLBACK_SUCCESS) {
-            CFRelease(modes);
-            CFRelease(curPixelEnc);
-            return TRUE;
-        } else if (cb == CALLBACK_ERROR) {
-            CFRelease(modes);
+        modes = CGDisplayCopyAllDisplayModes(screenId, NULL);
+        if (!modes) {
             CFRelease(curPixelEnc);
             return FALSE;
         }
-    }
+        for (i = 0; i < CFArrayGetCount(modes); i++) {
+            int cb;
+            modeRef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i);
+
+            /* Skip modes that are not usable on the current display or have a
+               different pixel encoding than the current mode. */
+            if ((CGDisplayModeGetIOFlags(modeRef) & kDisplayModeUsableFlags) !=
+                kDisplayModeUsableFlags)
+                continue;
+            pixelEnc = CGDisplayModeCopyPixelEncoding(modeRef);
+            pixelEncEqual = CFStringCompare(pixelEnc, curPixelEnc, 0);
+            CFRelease(pixelEnc);
+            if (pixelEncEqual != kCFCompareEqualTo)
+                continue;
+
+            QuartzRandRGetModeInfo(modeRef, &modeInfo);
+            modeInfo.ref = modeRef;
+            cb = callback(pScreen, &modeInfo, data);
+            if (cb == CALLBACK_CONTINUE) {
+                retval = TRUE;
+            } else if (cb == CALLBACK_SUCCESS) {
+                CFRelease(modes);
+                CFRelease(curPixelEnc);
+                return TRUE;
+            } else if (cb == CALLBACK_ERROR) {
+                CFRelease(modes);
+                CFRelease(curPixelEnc);
+                return FALSE;
+            }
+        }
 
-    CFRelease(modes);
-    CFRelease(curPixelEnc);
+        CFRelease(modes);
+        CFRelease(curPixelEnc);
+    }
 
     switch(callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
         case CALLBACK_SUCCESS:
@@ -347,9 +354,13 @@ static int QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
 
 static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL doRegister) {
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-    CGDirectDisplayID screenId = pQuartzScreen->displayIDs[0];
     Bool captureDisplay = (pMode->refresh != FAKE_REFRESH_FULLSCREEN && pMode->refresh != FAKE_REFRESH_ROOTLESS);
+    CGDirectDisplayID screenId;
 
+    if(pQuartzScreen->displayIDs == NULL)
+        return FALSE;
+
+    screenId = pQuartzScreen->displayIDs[0];
     if(XQuartzShieldingWindowLevel == 0 && captureDisplay) {
         if(!X11ApplicationCanEnterRandR())
             return FALSE;
@@ -379,7 +390,8 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
     if(pQuartzScreen->currentMode.ref)
         CFRelease(pQuartzScreen->currentMode.ref);
     pQuartzScreen->currentMode = *pMode;
-    CFRetain(pQuartzScreen->currentMode.ref);
+    if(pQuartzScreen->currentMode.ref)
+        CFRetain(pQuartzScreen->currentMode.ref);
     
     if(XQuartzShieldingWindowLevel != 0 && !captureDisplay) {
         CGReleaseAllDisplays();
@@ -406,13 +418,8 @@ static int QuartzRandRSetModeCallback (ScreenPtr pScreen,
 }
 
 static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
-    QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-
     *rotations = RR_Rotate_0;  /* TODO: support rotation */
 
-    if (pQuartzScreen->displayCount == 0)
-        return FALSE;
-
     return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback, NULL);
 }
 
@@ -427,9 +434,6 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
     reqMode.height = pSize->height;
     reqMode.refresh = rate;
 
-    if (pQuartzScreen->displayCount == 0)
-        return FALSE;
-
     /* Do not switch modes if requested mode is equal to current mode. */
     if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
         return TRUE;
@@ -446,9 +450,16 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
     QuartzModeInfo activeMode;
 
-    if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0], &activeMode)) {
-        ErrorF("Unable to determine current display mode.\n");
-        return FALSE;
+    if(pQuartzScreen->displayCount > 0) {
+        if(!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0], &activeMode)) {
+            ErrorF("Unable to determine current display mode.\n");
+            return FALSE;
+        }
+    } else {
+        memset(&activeMode, 0, sizeof(activeMode));
+        activeMode.width = 800;
+        activeMode.height = 600;
+        activeMode.refresh = 60;
     }
 
     if(pQuartzScreen->fullscreenMode.ref)
@@ -456,7 +467,7 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
     if(pQuartzScreen->currentMode.ref)
         CFRelease(pQuartzScreen->currentMode.ref);
 
-    if (pQuartzScreen->displayCount > 1) {
+    if(pQuartzScreen->displayCount > 1) {
         activeMode.width = pScreen->width;
         activeMode.height = pScreen->height;
         if(XQuartzIsRootless)
@@ -479,7 +490,8 @@ static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
     /* This extra retain is for currentMode's copy.
      * fullscreen and rootless share a retain.
      */
-    CFRetain(pQuartzScreen->currentMode.ref);
+    if(pQuartzScreen->currentMode.ref)
+        CFRetain(pQuartzScreen->currentMode.ref);
     
     DEBUG_LOG("rootlessMode: %d x %d\n", (int)pQuartzScreen->rootlessMode.width, (int)pQuartzScreen->rootlessMode.height);
     DEBUG_LOG("fullscreenMode: %d x %d\n", (int)pQuartzScreen->fullscreenMode.width, (int)pQuartzScreen->fullscreenMode.height);
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 972278b..3684ad5 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -193,6 +193,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
         *width = 800;
         *height = 600;
         PseudoramiXAddScreen(*x, *y, *width, *height);
+        QuartzCopyDisplayIDs(pScreen, 0, NULL);
         return;
     }
 

commit 1a665a8abd0ce1dbc50a1d889f11d5b74c78539e
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Fri May 20 22:59:27 2011 -0700

    configure.ac: Bump version to 1.10.1.902 (1.10.2 RC2)
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/configure.ac b/configure.ac
index 5f85383..3a2120c 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.10.1.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-05-06"
+AC_INIT([xorg-server], 1.10.1.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-05-20"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE

commit 52e27b446a69b4b196d7e59d4e92aaa073c83dae
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Mon May 16 21:07:13 2011 -0700

    XQuartz: Bump bundle version to 2.6.3
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 4ecf8e4..8873118 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 		<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-		<string>2.6.2</string>
+		<string>2.6.3</string>
 	<key>CFBundleVersion</key>
-		<string>2.6.2</string>
+		<string>2.6.3</string>
 	<key>CFBundleSignature</key>
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>

commit b4cb37d7255746f2ddf0ceb3334fc698cd818410
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat May 14 18:33:57 2011 -0700

    XQuartz: RandR: Avoid over-releasing if we are unable to determine the current display mode.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 384eb45b944a4386eae74a5503423c13b5f2a659)

diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 05641a6..d452b02 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -444,26 +444,29 @@ static Bool QuartzRandRSetConfig (ScreenPtr           pScreen,
 
 static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
     QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
+    QuartzModeInfo activeMode;
+
+    if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0], &activeMode)) {
+        ErrorF("Unable to determine current display mode.\n");
+        return FALSE;
+    }
 
     if(pQuartzScreen->fullscreenMode.ref)
         CFRelease(pQuartzScreen->fullscreenMode.ref);
     if(pQuartzScreen->currentMode.ref)
         CFRelease(pQuartzScreen->currentMode.ref);
-        
-    if (!QuartzRandRCopyCurrentModeInfo(pQuartzScreen->displayIDs[0],
-                                        &pQuartzScreen->fullscreenMode))
-        return FALSE;
 
     if (pQuartzScreen->displayCount > 1) {
-        pQuartzScreen->fullscreenMode.width = pScreen->width;
-        pQuartzScreen->fullscreenMode.height = pScreen->height;
+        activeMode.width = pScreen->width;
+        activeMode.height = pScreen->height;
         if(XQuartzIsRootless)
-            pQuartzScreen->fullscreenMode.height += aquaMenuBarHeight;
+            activeMode.height += aquaMenuBarHeight;
     }
 
+    pQuartzScreen->fullscreenMode = activeMode; 
     pQuartzScreen->fullscreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
 
-    pQuartzScreen->rootlessMode = pQuartzScreen->fullscreenMode;
+    pQuartzScreen->rootlessMode = activeMode;
     pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
     pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
 

commit 69e3527e257af2aae82449bf0e0e7846ccd1ce0c
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat May 14 16:11:32 2011 -0700

    XQuartz: Don't call mieqEnqueue during server shutdown
    
    Found-by: GuardMalloc
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 25191648b8db87735a99243697f73036255c1eb6)

diff --git a/dix/main.c b/dix/main.c
index 692bec1..e20ffd6 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -120,9 +120,9 @@ extern void Dispatch(void);
 #ifdef XQUARTZ
 #include <pthread.h>
 
-BOOL serverInitComplete = FALSE;
-pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
+BOOL serverRunning = FALSE;
+pthread_mutex_t serverRunningMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
 
 int dix_main(int argc, char *argv[], char *envp[]);
 
@@ -275,18 +275,25 @@ int main(int argc, char *argv[], char *envp[])
 	}
 
 #ifdef XQUARTZ
-    /* Let the other threads know the server is done with its init */
-    pthread_mutex_lock(&serverInitCompleteMutex);
-    serverInitComplete = TRUE;
-    pthread_cond_broadcast(&serverInitCompleteCond);
-    pthread_mutex_unlock(&serverInitCompleteMutex);
+	/* Let the other threads know the server is done with its init */
+	pthread_mutex_lock(&serverRunningMutex);
+	serverRunning = TRUE;
+	pthread_cond_broadcast(&serverRunningCond);
+	pthread_mutex_unlock(&serverRunningMutex);
 #endif
         
 	NotifyParentProcess();
 
 	Dispatch();
 
-        UndisplayDevices();
+#ifdef XQUARTZ
+	/* Let the other threads know the server is no longer running */
+	pthread_mutex_lock(&serverRunningMutex);
+	serverRunning = FALSE;
+	pthread_mutex_unlock(&serverRunningMutex);
+#endif
+
+	UndisplayDevices();
 
 	/* Now free up whatever must be freed */
 	if (screenIsSaved == SCREEN_SAVER_ON)
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index b00e90a..0e85101 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -39,9 +39,9 @@ CFStringRef app_prefs_domain_cfstr;
 
 /* Stubs */
 char *display = NULL;
-BOOL serverInitComplete = YES;
-pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
+BOOL serverRunning = YES;
+pthread_mutex_t serverRunningMutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
 
 static void signal_handler (int sig) {
     switch(sig) {
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index bb06465..f300c37 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -47,17 +47,17 @@ BOOL xpbproxy_is_standalone = NO;
 
 x_selection *_selection_object;
 
-extern BOOL serverInitComplete;
-extern pthread_mutex_t serverInitCompleteMutex;
-extern pthread_cond_t serverInitCompleteCond;
+extern BOOL serverRunning;
+extern pthread_mutex_t serverRunningMutex;
+extern pthread_cond_t serverRunningCond;
 
 static inline void wait_for_server_init(void) {
     /* If the server hasn't finished initializing, wait for it... */
-    if(!serverInitComplete) {
-        pthread_mutex_lock(&serverInitCompleteMutex);
-        while(!serverInitComplete)
-            pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex);
-        pthread_mutex_unlock(&serverInitCompleteMutex);
+    if(!serverRunning) {
+        pthread_mutex_lock(&serverRunningMutex);
+        while(!serverRunning)
+            pthread_cond_wait(&serverRunningCond, &serverRunningMutex);
+        pthread_mutex_unlock(&serverRunningMutex);
     }
 }
 
diff --git a/mi/mieq.c b/mi/mieq.c
index 01da52a..cd1e47f 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -83,17 +83,17 @@ static EventQueueRec miEventQueue;
 #include  <pthread.h>
 static pthread_mutex_t miEventQueueMutex = PTHREAD_MUTEX_INITIALIZER;
 
-extern BOOL serverInitComplete;
-extern pthread_mutex_t serverInitCompleteMutex;
-extern pthread_cond_t serverInitCompleteCond;
+extern BOOL serverRunning;
+extern pthread_mutex_t serverRunningMutex;
+extern pthread_cond_t serverRunningCond;
 
 static inline void wait_for_server_init(void) {
     /* If the server hasn't finished initializing, wait for it... */
-    if(!serverInitComplete) {
-        pthread_mutex_lock(&serverInitCompleteMutex);
-        while(!serverInitComplete)
-            pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex);
-        pthread_mutex_unlock(&serverInitCompleteMutex);
+    if(!serverRunning) {
+        pthread_mutex_lock(&serverRunningMutex);
+        while(!serverRunning)
+            pthread_cond_wait(&serverRunningCond, &serverRunningMutex);
+        pthread_mutex_unlock(&serverRunningMutex);
     }
 }
 #endif

commit 0a61aca1ed036b17cab48725eb6ab4d860c9aad8
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Tue Apr 19 19:02:54 2011 -0700

    Clean up memory better when GetVisualInfo fails in ProcDbeGetVisualInfo
    
    Use calloc to initialize pScrVisInfo array so we don't have to check
    which ones were already initialized when freeing them all.
    
    On failure, set rc if necessary, and jump to code at end that already
    frees all the necessary allocations and return rc.
    
    Fixes parfait reported error:
    Error: Memory leak (CWE 401)
       Memory leak of pointer 'pScrVisInfo' allocated with malloc((count * 16))
            at line 724 of dbe/dbe.c in function 'ProcDbeGetVisualInfo'.
              'pScrVisInfo' allocated at line 693 with malloc((count * 16)).
              pScrVisInfo leaks when rc != 0 at line 710
                  and j >= i at line 716.
    
    [ This bug was found by the Parfait 0.3.7 bug checking tool.
      For more information see http://labs.oracle.com/projects/parfait/ ]
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit 043c1758652259fd12b88ae37720fe6e93eda76b)

diff --git a/dbe/dbe.c b/dbe/dbe.c
index 77b616b..51bbdc6 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -690,8 +690,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
     }
 
     count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
-    if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
-                        sizeof(XdbeScreenVisualInfo))))
+    if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo))))
     {
         free(pDrawables);
 
@@ -707,21 +706,16 @@ ProcDbeGetVisualInfo(ClientPtr client)
         pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
 
 	rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
-	if ((rc != Success) ||
-	    !(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
+        if (rc != Success)
+            goto freeScrVisInfo;
+
+        if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
         {
             /* We failed to alloc pScrVisInfo[i].visinfo. */
+            rc = BadAlloc;
 
             /* Free visinfos that we allocated for previous screen infos.*/
-            for (j = 0; j < i; j++)
-            {
-                free(pScrVisInfo[j].visinfo);
-            }
-
-            /* Free pDrawables if we needed to allocate it above. */
-            free(pDrawables);
-
-            return (rc == Success) ? BadAlloc : rc;
+            goto freeScrVisInfo;
         }
 
         /* Account for n, number of xDbeVisInfo items in list. */
@@ -790,6 +784,9 @@ ProcDbeGetVisualInfo(ClientPtr client)
         }
     }
 
+    rc = Success;
+
+  freeScrVisInfo:
     /* Clean up memory. */
     for (i = 0; i < count; i++)
     {
@@ -799,7 +796,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
 
     free(pDrawables);
 
-    return Success;
+    return rc;
 
 } /* ProcDbeGetVisualInfo() */
 

commit 5be7451367901c13a697ecefcb634920cd156cb7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Tue Apr 19 18:53:22 2011 -0700

    Only free pContext once when AddResource fails in ProcRecordCreateContext
    
    Since RecordDeleteContext frees its argument, don't fall through to free
    it again.
    
    Error: Double free (CWE 415)
       Double free of pointer 'malloc(1072)' defined by malloc
            at line 1964 of record/record.c in function 'ProcRecordCreateContext'.
              Previously freed at line 1960 with RecordDeleteContext.
              'malloc(1072)' was allocated at line 1926 with malloc.
    
    [ This bug was found by the Parfait 0.3.7 bug checking tool.
      For more information see http://labs.oracle.com/projects/parfait/ ]
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit dadb0791ebfd05cd3bb82d4addf0fbc21aad6fbb)

diff --git a/record/record.c b/record/record.c
index facaebb..f466758 100644
--- a/record/record.c
+++ b/record/record.c
@@ -1956,7 +1956,7 @@ ProcRecordCreateContext(ClientPtr client)
     else
     {
 	RecordDeleteContext((pointer)pContext, pContext->id);
-	err = BadAlloc;
+	return BadAlloc;
     }
 bailout:
     free(pContext);

commit ee69c1aa7c1066b2019bf916230332c60a837ecb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Fri Mar 11 15:43:14 2011 -0800

    Make xorg.conf.example rule compatible with Solaris make
    
    Solaris make won't substitute $< in explicit rules, only implicit ones
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
    (cherry picked from commit 8d229c4cf9e5bde78373ef3dd32708817ac97152)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index c23b1fd..93995c6 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -114,7 +114,7 @@ CONF_SUBSTS =	-e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \
 		-e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g'
 
 xorg.conf.example: xorgconf.cpp
-	$(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $< > $@
+	$(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $(srcdir)/xorgconf.cpp > $@
 
 relink:
 	$(AM_V_at)rm -f Xorg && $(MAKE) Xorg

commit 189d44e7d216cc7b13f3e5a22689f2841a08b421
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Tue May 10 23:42:46 2011 -0700

    XQuartz: Don't call into CoreFoundation after fork() and before exec()
    
    After fork()ing, we should just limit ourselves to setting up
    the environment, file descriptors, and exec()ing.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    (cherry picked from commit  c89a6f824eaf647d2b182f79fbd78f5bd1c3a27f)

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d55d1ed..1ddaa2c 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -36,6 +36,7 @@
 #endif
 
 #include <X11/Xlib.h>
+#include <assert.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
@@ -94,6 +95,10 @@ int server_main(int argc, char **argv, char **envp);
 static int execute(const char *command);
 static char *command_from_prefs(const char *key, const char *default_value);
 
+static char *pref_app_to_run;
+static char *pref_login_shell;
+static char *pref_startx_script;
+
 /*** Pthread Magics ***/
 static pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
@@ -415,7 +420,7 @@ static int startup_trigger(int argc, char **argv, char **envp) {
             /* Could open the display, start the launcher */
             XCloseDisplay(display);
 
-            return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT));
+            return execute(pref_app_to_run);
         }
     }
 
@@ -426,7 +431,7 @@ static int startup_trigger(int argc, char **argv, char **envp) {
     } else {
         fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set).  Starting X server.\n");
     }
-    return execute(command_from_prefs("startx_script", DEFAULT_STARTX));
+    return execute(pref_startx_script);
 }
 
 /** Setup the environment we want our child processes to inherit */
@@ -563,6 +568,15 @@ int main(int argc, char **argv, char **envp) {
         pid_t child1, child2;
         int status;
 
+        pref_app_to_run = command_from_prefs("app_to_run", DEFAULT_CLIENT);
+        assert(pref_app_to_run);
+
+        pref_login_shell = command_from_prefs("login_shell", DEFAULT_SHELL);
+        assert(pref_login_shell);
+
+        pref_startx_script = command_from_prefs("startx_script", DEFAULT_STARTX);
+        assert(pref_startx_script);
+
         /* Do the fork-twice trick to avoid having to reap zombies */
         child1 = fork();
         switch (child1) {
@@ -598,6 +612,10 @@ int main(int argc, char **argv, char **envp) {
             default:                                /* parent */
               waitpid(child1, &status, 0);
         }
+
+        free(pref_app_to_run);
+        free(pref_login_shell);
+        free(pref_startx_script);
     }
     
     /* Main event loop */
@@ -615,7 +633,7 @@ static int execute(const char *command) {
     const char *newargv[4];
     const char **p;
     
-    newargv[0] = command_from_prefs("login_shell", DEFAULT_SHELL);
+    newargv[0] = pref_login_shell;
     newargv[1] = "-c";
     newargv[2] = command;
     newargv[3] = NULL;

commit 277e18894492fdf6e5446bb90e8503c9cbc28b3b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sat Apr 23 20:49:27 2011 -0700

    os: Silence warnings when building with clang
    
    access.c:1492:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses]
            if ((host->family == FamilyServerInterpreted)) {
                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
    access.c:1492:20: note: use '=' to turn this equality comparison into an assignment
            if ((host->family == FamilyServerInterpreted)) {
                              ^~
                              =
    access.c:1492:20: note: remove extraneous parentheses around the comparison to silence this warning
            if ((host->family == FamilyServerInterpreted)) {
                ~             ^                         ~
    
    In file included from xstrans.c:8:
    In file included from /usr/X11/include/X11/Xtrans/transport.c:62:
    /usr/X11/include/X11/Xtrans/Xtranssock.c:262:5: error: implicit declaration of function 'ErrorF' is invalid in C99
          [-Werror,-Wimplicit-function-declaration]
        PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
        ^
    
    log.c:180:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
            if (asprintf(&logFileName, fname, display) == -1)
                                       ^~~~~
    log.c:190:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
                    if ((asprintf(&suffix, backup, display) == -1) ||
                                           ^~~~~~
    log.c:382:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
            LogVWrite(verb, tmpBuf, args);
                            ^~~~~~
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
    Reviewed-by: Jamey Sharp <jamey@minilop.net>
    (cherry picked from commit c524f8bb768f886d413839bc22184098394c2559)

diff --git a/os/access.c b/os/access.c
index eb1a21d..be9c0d5 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1508,7 +1508,7 @@ InvalidHost (
     }
     for (host = validhosts; host; host = host->next)
     {
-	if ((host->family == FamilyServerInterpreted)) {
+	if (host->family == FamilyServerInterpreted) {
 	    if (siAddrMatch (family, addr, len, host, client)) {
 		return 0;
 	    }
diff --git a/os/log.c b/os/log.c
index 65195ba..9579e58 100644
--- a/os/log.c
+++ b/os/log.c
@@ -102,6 +102,10 @@ OR PERFORMANCE OF THIS SOFTWARE.
 #include "xf86bigfontsrv.h"
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+
 #ifdef DDXOSVERRORF
 void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
 #endif
diff --git a/os/xstrans.c b/os/xstrans.c
index c086e22..44ff976 100644
--- a/os/xstrans.c
+++ b/os/xstrans.c
@@ -2,6 +2,11 @@
 #include <dix-config.h>
 #endif
 


Reply to: