2010-07-16 17:18:03 +02:00
|
|
|
/*
|
|
|
|
* Quartz-specific support for the XRandR extension
|
|
|
|
*
|
|
|
|
* Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons,
|
|
|
|
* 2010 Jan Hauffa.
|
2010-07-26 07:25:49 +02:00
|
|
|
* 2010 Apple Inc.
|
2010-07-16 17:18:03 +02:00
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name(s) of the above copyright
|
|
|
|
* holders shall not be used in advertising or otherwise to promote the sale,
|
|
|
|
* use or other dealings in this Software without prior written authorization.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sanitizedCarbon.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "quartzCommon.h"
|
|
|
|
#include "quartzRandR.h"
|
2010-07-16 17:54:55 +02:00
|
|
|
#include "quartz.h"
|
2010-07-26 10:17:12 +02:00
|
|
|
#include "darwin.h"
|
2010-07-16 17:18:03 +02:00
|
|
|
|
2010-07-26 07:25:49 +02:00
|
|
|
#include <AvailabilityMacros.h>
|
|
|
|
|
2010-07-16 17:18:03 +02:00
|
|
|
#include <X11/extensions/randr.h>
|
|
|
|
#include <randrstr.h>
|
|
|
|
#include <IOKit/graphics/IOGraphicsTypes.h>
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
/* TODO: UGLY, find a better way!
|
|
|
|
* We want to ignore kXquartzDisplayChanged which are generated by us
|
|
|
|
*/
|
|
|
|
static Bool ignore_next_fake_mode_update = FALSE;
|
|
|
|
|
|
|
|
#define FAKE_REFRESH_ROOTLESS 1
|
|
|
|
#define FAKE_REFRESH_FULLSCREEN 2
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
#define DEFAULT_REFRESH 60
|
|
|
|
#define kDisplayModeUsableFlags (kDisplayModeValidFlag | kDisplayModeSafeFlag)
|
|
|
|
|
|
|
|
typedef Bool (*QuartzModeCallback)
|
|
|
|
(ScreenPtr, CGDirectDisplayID, QuartzModeInfoPtr, void *);
|
|
|
|
|
|
|
|
|
2010-07-26 07:25:49 +02:00
|
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
static long getDictLong (CFDictionaryRef dictRef, CFStringRef key) {
|
|
|
|
long value;
|
|
|
|
|
|
|
|
CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
|
|
|
|
if (!numRef)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (!CFNumberGetValue(numRef, kCFNumberLongType, &value))
|
|
|
|
return 0;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static double getDictDouble (CFDictionaryRef dictRef, CFStringRef key) {
|
|
|
|
double value;
|
|
|
|
|
|
|
|
CFNumberRef numRef = (CFNumberRef) CFDictionaryGetValue(dictRef, key);
|
|
|
|
if (!numRef)
|
|
|
|
return 0.0;
|
|
|
|
|
|
|
|
if (!CFNumberGetValue(numRef, kCFNumberDoubleType, &value))
|
|
|
|
return 0.0;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void QuartzRandRGetModeInfo (CFDictionaryRef modeRef,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
pMode->width = (size_t) getDictLong(modeRef, kCGDisplayWidth);
|
|
|
|
pMode->height = (size_t) getDictLong(modeRef, kCGDisplayHeight);
|
|
|
|
pMode->refresh = (int)(getDictDouble(modeRef, kCGDisplayRefreshRate) + 0.5);
|
|
|
|
if (pMode->refresh == 0)
|
|
|
|
pMode->refresh = DEFAULT_REFRESH;
|
|
|
|
pMode->ref = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
|
|
|
|
if (!curModeRef)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
QuartzRandRGetModeInfo(curModeRef, pMode);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
CFDictionaryRef modeRef = (CFDictionaryRef) pMode->ref;
|
|
|
|
return (CGDisplaySwitchToMode(screenId, modeRef) != kCGErrorSuccess);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
|
|
|
|
CGDirectDisplayID screenId,
|
|
|
|
QuartzModeCallback callback,
|
|
|
|
void *data) {
|
|
|
|
CFDictionaryRef curModeRef, modeRef;
|
|
|
|
long curBpp;
|
|
|
|
CFArrayRef modes;
|
|
|
|
QuartzModeInfo modeInfo;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
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 = modeRef;
|
|
|
|
if (!callback(pScreen, screenId, &modeInfo, data))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-07-26 07:25:49 +02:00
|
|
|
#else /* we have the new CG APIs from Snow Leopard */
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
static void QuartzRandRGetModeInfo (CGDisplayModeRef modeRef,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
pMode->width = CGDisplayModeGetWidth(modeRef);
|
|
|
|
pMode->height = CGDisplayModeGetHeight(modeRef);
|
|
|
|
pMode->refresh = (int) (CGDisplayModeGetRefreshRate(modeRef) + 0.5);
|
|
|
|
if (pMode->refresh == 0)
|
|
|
|
pMode->refresh = DEFAULT_REFRESH;
|
|
|
|
pMode->ref = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRGetCurrentModeInfo (CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
CGDisplayModeRef curModeRef = CGDisplayCopyDisplayMode(screenId);
|
|
|
|
if (!curModeRef)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
QuartzRandRGetModeInfo(curModeRef, pMode);
|
|
|
|
CGDisplayModeRelease(curModeRef);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRSetMode (CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
CGDisplayModeRef modeRef = (CGDisplayModeRef) pMode->ref;
|
|
|
|
if (!modeRef)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
return (CGDisplaySetDisplayMode(screenId, modeRef, NULL) != kCGErrorSuccess);
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandREnumerateModes (ScreenPtr pScreen,
|
|
|
|
CGDirectDisplayID screenId,
|
|
|
|
QuartzModeCallback callback,
|
|
|
|
void *data) {
|
|
|
|
CGDisplayModeRef curModeRef, modeRef;
|
|
|
|
CFStringRef curPixelEnc, pixelEnc;
|
|
|
|
CFComparisonResult pixelEncEqual;
|
|
|
|
CFArrayRef modes;
|
|
|
|
QuartzModeInfo modeInfo;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
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;
|
|
|
|
if (!callback(pScreen, screenId, &modeInfo, data))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
CFRelease(modes);
|
|
|
|
|
|
|
|
CFRelease(curPixelEnc);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-07-26 07:25:49 +02:00
|
|
|
#endif /* Snow Leopard CoreGraphics APIs */
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
static Bool QuartzRandRModesEqual (QuartzModeInfoPtr pMode1,
|
|
|
|
QuartzModeInfoPtr pMode2) {
|
2010-07-26 10:17:12 +02:00
|
|
|
return (pMode1->width == pMode2->width) &&
|
|
|
|
(pMode1->height == pMode2->height) &&
|
|
|
|
(pMode1->refresh == pMode2->refresh);
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
2010-07-16 17:54:55 +02:00
|
|
|
static Bool QuartzRandRRegisterMode (ScreenPtr pScreen,
|
2010-07-26 10:17:12 +02:00
|
|
|
QuartzModeInfoPtr pMode) {
|
|
|
|
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
|
|
|
|
Bool isCurrentMode = QuartzRandRModesEqual(&pQuartzScreen->currentMode, pMode);
|
2010-07-16 17:18:03 +02:00
|
|
|
RRScreenSizePtr pSize = RRRegisterSize(pScreen,
|
|
|
|
pMode->width, pMode->height, pScreen->mmWidth, pScreen->mmHeight);
|
|
|
|
if (pSize) {
|
|
|
|
RRRegisterRate(pScreen, pSize, pMode->refresh);
|
|
|
|
|
2010-07-16 17:54:55 +02:00
|
|
|
if (isCurrentMode)
|
2010-07-16 17:18:03 +02:00
|
|
|
RRSetCurrentConfig(pScreen, RR_Rotate_0, pMode->refresh, pSize);
|
2010-07-16 17:54:55 +02:00
|
|
|
|
|
|
|
return TRUE;
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
2010-07-16 17:54:55 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
static Bool QuartzRandRRegisterModeCallback (ScreenPtr pScreen,
|
2010-07-16 17:54:55 +02:00
|
|
|
CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode,
|
2010-07-26 10:17:12 +02:00
|
|
|
void *data __unused) {
|
|
|
|
return QuartzRandRRegisterMode(pScreen, pMode);
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRSetModeCallback (ScreenPtr pScreen,
|
|
|
|
CGDirectDisplayID screenId,
|
|
|
|
QuartzModeInfoPtr pMode,
|
|
|
|
void *data) {
|
|
|
|
QuartzModeInfoPtr pReqMode = (QuartzModeInfoPtr) data;
|
2010-07-26 10:17:12 +02:00
|
|
|
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
if (!QuartzRandRModesEqual(pMode, pReqMode))
|
|
|
|
return TRUE; /* continue enumeration */
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
if (pReqMode->ref == pQuartzScreen->currentMode.ref) {
|
|
|
|
DEBUG_LOG("Requested RandR resolution matches current CG mode\n");
|
|
|
|
return FALSE; /* We don't need to do anything in CG */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (QuartzRandRSetMode(screenId, pMode) == FALSE) {
|
|
|
|
ignore_next_fake_mode_update = TRUE;
|
|
|
|
return FALSE;
|
|
|
|
} else {
|
|
|
|
return TRUE;
|
|
|
|
};
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
|
|
|
|
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
|
|
|
|
CGDirectDisplayID screenId;
|
|
|
|
|
|
|
|
*rotations = RR_Rotate_0; /* TODO: support rotation */
|
|
|
|
|
|
|
|
if (pQuartzScreen->displayCount == 0)
|
|
|
|
return FALSE;
|
2010-07-26 10:17:12 +02:00
|
|
|
|
|
|
|
QuartzRandRRegisterMode(pScreen, &pQuartzScreen->rootlessMode);
|
|
|
|
QuartzRandRRegisterMode(pScreen, &pQuartzScreen->fullScreenMode);
|
|
|
|
|
2010-07-16 17:18:03 +02:00
|
|
|
if (pQuartzScreen->displayCount > 1) {
|
|
|
|
/* RandR operations are not well-defined for an X11 screen spanning
|
2010-07-16 17:54:55 +02:00
|
|
|
multiple CG displays. Create two entries for the current virtual
|
|
|
|
resolution including/excluding the menu bar. */
|
2010-07-16 17:18:03 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
screenId = pQuartzScreen->displayIDs[0];
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
return QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRRegisterModeCallback, NULL);
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool QuartzRandRSetConfig (ScreenPtr pScreen,
|
2010-07-26 10:17:12 +02:00
|
|
|
Rotation randr,
|
|
|
|
int rate,
|
|
|
|
RRScreenSizePtr pSize) {
|
2010-07-16 17:18:03 +02:00
|
|
|
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
|
|
|
|
CGDirectDisplayID screenId;
|
2010-07-26 10:17:12 +02:00
|
|
|
QuartzModeInfo reqMode;
|
2010-07-16 17:54:55 +02:00
|
|
|
|
|
|
|
reqMode.width = pSize->width;
|
|
|
|
reqMode.height = pSize->height;
|
|
|
|
reqMode.refresh = rate;
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
/* If the client requested the fake rootless mode, switch to rootless.
|
|
|
|
* Otherwise, force fullscreen mode.
|
|
|
|
*/
|
|
|
|
QuartzSetFullscreen(reqMode.refresh != FAKE_REFRESH_ROOTLESS);
|
|
|
|
QuartzSetRootless(reqMode.refresh == FAKE_REFRESH_ROOTLESS);
|
2010-07-16 17:18:03 +02:00
|
|
|
|
|
|
|
if (pQuartzScreen->displayCount == 0)
|
|
|
|
return FALSE;
|
|
|
|
if (pQuartzScreen->displayCount > 1) {
|
|
|
|
/* RandR operations are not well-defined for an X11 screen spanning
|
|
|
|
multiple CG displays. Do not accept any configuations that differ
|
|
|
|
from the current configuration. */
|
2010-07-26 10:17:12 +02:00
|
|
|
return TRUE;
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Do not switch modes if requested mode is equal to current mode. */
|
2010-07-26 10:17:12 +02:00
|
|
|
if (QuartzRandRModesEqual(&reqMode, &pQuartzScreen->currentMode))
|
2010-07-16 17:18:03 +02:00
|
|
|
return TRUE;
|
2010-07-26 10:17:12 +02:00
|
|
|
|
|
|
|
screenId = pQuartzScreen->displayIDs[0];
|
|
|
|
if (QuartzRandREnumerateModes(pScreen, screenId, QuartzRandRSetModeCallback, &reqMode)) {
|
|
|
|
pQuartzScreen->currentMode = reqMode;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_LOG("Unable to find a matching config: %d x %d @ %d\n", (int)reqMode.width, (int)reqMode.height, (int)reqMode.refresh);
|
2010-07-16 17:18:03 +02:00
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
return FALSE;
|
2010-07-16 17:18:03 +02:00
|
|
|
}
|
|
|
|
|
2010-07-26 10:17:12 +02:00
|
|
|
static Bool _QuartzRandRUpdateFakeModes (ScreenPtr pScreen) {
|
2010-07-16 17:54:55 +02:00
|
|
|
QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
|
2010-07-16 17:18:03 +02:00
|
|
|
|
2010-07-16 17:54:55 +02:00
|
|
|
if (pQuartzScreen->displayCount == 1) {
|
|
|
|
if (!QuartzRandRGetCurrentModeInfo(pQuartzScreen->displayIDs[0],
|
2010-07-26 10:17:12 +02:00
|
|
|
&pQuartzScreen->fullScreenMode))
|
2010-07-16 17:54:55 +02:00
|
|
|
return FALSE;
|
2010-07-26 10:17:12 +02:00
|
|
|
} else {
|
|
|
|
pQuartzScreen->fullScreenMode.width = pScreen->width;
|
|
|
|
pQuartzScreen->fullScreenMode.height = pScreen->height;
|
|
|
|
if(quartzEnableRootless)
|
|
|
|
pQuartzScreen->fullScreenMode.height += aquaMenuBarHeight;
|
2010-07-16 17:54:55 +02:00
|
|
|
}
|
2010-07-26 10:17:12 +02:00
|
|
|
|
|
|
|
pQuartzScreen->fullScreenMode.refresh = FAKE_REFRESH_FULLSCREEN;
|
|
|
|
|
|
|
|
pQuartzScreen->rootlessMode = pQuartzScreen->fullScreenMode;
|
|
|
|
pQuartzScreen->rootlessMode.refresh = FAKE_REFRESH_ROOTLESS;
|
|
|
|
pQuartzScreen->rootlessMode.height -= aquaMenuBarHeight;
|
|
|
|
|
|
|
|
if(quartzEnableRootless) {
|
|
|
|
pQuartzScreen->currentMode = pQuartzScreen->rootlessMode;
|
|
|
|
} else {
|
|
|
|
pQuartzScreen->currentMode = pQuartzScreen->fullScreenMode;
|
2010-07-16 17:54:55 +02:00
|
|
|
}
|
2010-07-26 10:17:12 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
DEBUG_LOG("currentMode: %d x %d\n", (int)pQuartzScreen->currentMode.width, (int)pQuartzScreen->currentMode.height);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bool QuartzRandRUpdateFakeModes (BOOL force_update) {
|
|
|
|
ScreenPtr pScreen = screenInfo.screens[0];
|
|
|
|
|
|
|
|
if(ignore_next_fake_mode_update) {
|
|
|
|
DEBUG_LOG("Ignoring update request caused by RandR resolution change.\n");
|
|
|
|
ignore_next_fake_mode_update = FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!_QuartzRandRUpdateFakeModes(pScreen))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if(force_update)
|
|
|
|
RRGetInfo(pScreen, TRUE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bool QuartzRandRInit (ScreenPtr pScreen) {
|
|
|
|
rrScrPrivPtr pScrPriv;
|
|
|
|
|
|
|
|
if (!RRScreenInit (pScreen)) return FALSE;
|
|
|
|
if (!_QuartzRandRUpdateFakeModes (pScreen)) return FALSE;
|
2010-07-16 17:54:55 +02:00
|
|
|
|
2010-07-16 17:18:03 +02:00
|
|
|
pScrPriv = rrGetScrPriv(pScreen);
|
|
|
|
pScrPriv->rrGetInfo = QuartzRandRGetInfo;
|
|
|
|
pScrPriv->rrSetConfig = QuartzRandRSetConfig;
|
|
|
|
return TRUE;
|
|
|
|
}
|