[Xquartz-changes] xserver: Branch 'server-1.9-apple' - 2 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Tue Feb 8 12:00:18 PST 2011
Rebased ref, commits from common ancestor:
commit 68ee7afd8698dc14d0390413fb6297fc395a6ca8
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 57e9755..ff64231 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -409,16 +409,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 efcfbde1c6419b129a58bcc5b8dc90105d874cc1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Tue Feb 8 11:37:52 2011 -0800
XQuartz: RandR: Capture the display when switching modes with RandR
This will prevent native windows from resizing as we change resolutions.
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 222a5ea..11e5a74 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -82,6 +82,8 @@ Bool XQuartzIsRootless = TRUE;
Bool XQuartzServerVisible = FALSE;
Bool XQuartzFullscreenMenu = FALSE;
+int32_t XQuartzShieldingWindowLevel = 0;
+
/*
===========================================================================
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index b83391d..67a7919 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -124,6 +124,8 @@ extern Bool XQuartzFullscreenMenu; /* Show the menu bar (autohide) while in FS
extern Bool XQuartzFullscreenDisableHotkeys;
extern Bool XQuartzOptionSendsAlt; /* Alt or Mode_switch? */
+extern int32_t XQuartzShieldingWindowLevel; /* CGShieldingWindowLevel() or 0 */
+
Bool QuartzAddScreen(int index, ScreenPtr pScreen);
Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
void QuartzInitOutput(int argc,char **argv);
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index 296f9b6..57e9755 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -346,6 +346,14 @@ 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);
+
+ if(XQuartzShieldingWindowLevel == 0 && captureDisplay) {
+ CGCaptureAllDisplays();
+ XQuartzShieldingWindowLevel = CGShieldingWindowLevel(); // 2147483630
+ DEBUG_LOG("Display captured. ShieldWindowID: %u, Shield level: %d\n",
+ CGShieldingWindowID(screenId), XQuartzShieldingWindowLevel);
+ }
if (pQuartzScreen->currentMode.ref && CFEqual(pMode->ref, pQuartzScreen->currentMode.ref)) {
DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
@@ -369,6 +377,11 @@ static Bool QuartzRandRSetMode(ScreenPtr pScreen, QuartzModeInfoPtr pMode, BOOL
pQuartzScreen->currentMode = *pMode;
CFRetain(pQuartzScreen->currentMode.ref);
+ if(XQuartzShieldingWindowLevel != 0 && !captureDisplay) {
+ CGReleaseAllDisplays();
+ XQuartzShieldingWindowLevel = 0;
+ }
+
return TRUE;
}
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 1a3d427..21e6f98 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -69,6 +69,8 @@ static int xprSetWindowLevel(
if(XQuartzIsRootless)
wc.window_level = normal_window_levels[level];
+ else if(XQuartzShieldingWindowLevel)
+ wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[level];
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index ede5af5..f5c5b54 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -173,6 +173,8 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
if(XQuartzIsRootless)
wc.window_level = normal_window_levels[pFrame->level];
+ else if(XQuartzShieldingWindowLevel)
+ wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[pFrame->level];
mask |= XP_WINDOW_LEVEL;
@@ -287,6 +289,8 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
if(winRec) {
if(XQuartzIsRootless)
wc.window_level = normal_window_levels[winRec->level];
+ else if(XQuartzShieldingWindowLevel)
+ wc.window_level = XQuartzShieldingWindowLevel + 1;
else
wc.window_level = rooted_window_levels[winRec->level];
mask |= XP_WINDOW_LEVEL;
More information about the Xquartz-changes
mailing list