[Xquartz-changes] xserver: Branch 'server-1.9-apple' - 2 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Feb 8 12:29:25 PST 2011


Rebased ref, commits from common ancestor:
commit 600e240ef385fdd5a93c16fe0e8cdf4fa3217688
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Feb 8 11:38:35 2011 -0800

    XQuartz: RandR: Add RandR modes for the primary display in multi-monitor configs
    
    We now support using RandR to set the resolution of the primary display (and
    place a shielding window on other displays) in multi-monitor configurations.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 76a9b72..c552f16 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -413,16 +413,6 @@ static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
     if (pQuartzScreen->displayCount == 0)
         return FALSE;
 
-    if (pQuartzScreen->displayCount > 1) {
-        /* RandR operations are not well-defined for an X11 screen spanning
-           multiple CG displays. Create two entries for the current virtual
-           resolution including/excluding the menu bar. */
-
-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
-        QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullscreenMode);
-        return TRUE;
-    }
-
     return QuartzRandREnumerateModes(pScreen, QuartzRandRRegisterModeCallback, NULL);
 }
 
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 599ef6f..cfc79dd 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -196,6 +196,13 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height, ScreenPtr pScr
         return;
     }
 
+    /* If the displays are captured, we are in a RandR game mode
+     * on the primary display, so we only want to include the first
+     * display.  The others are covered by the shield window.
+     */
+    if (CGDisplayIsCaptured(kCGDirectMainDisplay))
+        displayCount = 1;
+
     displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
     if(!displayList)
         FatalError("Unable to allocate memory for list of displays.\n");
commit 2402290e689bc6ef48a0a7989fc57cbed3d6faea
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Feb 8 12:26:35 2011 -0800

    XQuartz: RandR: Provide an alert box when entering a RandR mode for the first time.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index b3ad19b..0f3e0ba 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -73,6 +73,8 @@ void X11ApplicationServerReady (void);
 void X11ApplicationShowHideMenubar (int state);
 void X11ApplicationLaunchClient (const char *cmd);
 
+Bool X11ApplicationEnterRandR (void);
+
 void X11ApplicationMain(int argc, char **argv, char **envp);
 
 #define PREFS_APPSMENU              "apps_menu"
@@ -86,6 +88,7 @@ void X11ApplicationMain(int argc, char **argv, char **envp);
 #define PREFS_NO_TCP                "nolisten_tcp"
 #define PREFS_DONE_XINIT_CHECK      "done_xinit_check"
 #define PREFS_NO_QUIT_ALERT         "no_quit_alert"
+#define PREFS_NO_RANDR_ALERT        "no_randr_alert"
 #define PREFS_OPTION_SENDS_ALT      "option_sends_alt"
 #define PREFS_FAKE_BUTTON2          "fake_button2"
 #define PREFS_FAKE_BUTTON3          "fake_button3"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 4a52a12..a77ca26 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -883,6 +883,28 @@ void X11ApplicationLaunchClient (const char *cmd) {
     [string release];
 }
 
+Bool X11ApplicationEnterRandR(void) {
+    NSString *title, *msg;
+    
+    if([X11App prefs_get_boolean:@PREFS_NO_RANDR_ALERT default:NO])
+        return TRUE;
+    
+    title = NSLocalizedString(@"Enter RandR mode?", @"Dialog title when switching to RandR");
+    msg = NSLocalizedString(@"An application has requested X11 to change the resolution of your display.  X11 will restore the display to its previous state when the requesting application requests to return to the previous state.  Alternatively, you can use the ⌥⌘A key sequence to force X11 to return to the previous state.",
+                            @"Dialog when switching to RandR");
+
+    switch(NSRunAlertPanel(title, msg, NSLocalizedString(@"Allow", @""), NSLocalizedString (@"Cancel", @""), NSLocalizedString (@"Always Allow", @""))) {
+        case NSAlertOtherReturn:
+            [X11App prefs_set_boolean:@PREFS_NO_RANDR_ALERT value:YES];
+            [X11App prefs_synchronize];
+        case NSAlertDefaultReturn:
+            return YES;
+
+        default:
+            return NO;
+    }
+}
+
 static void check_xinitrc (void) {
     char *tem, buf[1024];
     NSString *msg;
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index 0341502..bf2089c 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 57e9755..76a9b72 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -40,6 +40,8 @@
 #include "quartz.h"
 #include "darwin.h"
 
+#include "X11Application.h"
+
 #include <AvailabilityMacros.h>
 
 #include <X11/extensions/randr.h>
@@ -349,6 +351,8 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
     Bool captureDisplay = (pMode->refresh != FAKE_REFRESH_FULLSCREEN && pMode->refresh != FAKE_REFRESH_ROOTLESS);
 
     if(XQuartzShieldingWindowLevel == 0 && captureDisplay) {
+        if(!X11ApplicationEnterRandR())
+            return FALSE;
         CGCaptureAllDisplays();
         XQuartzShieldingWindowLevel = CGShieldingWindowLevel(); // 2147483630
         DEBUG_LOG("Display captured.  ShieldWindowID: %u, Shield level: %d\n",


More information about the Xquartz-changes mailing list