summaryrefslogtreecommitdiff
path: root/hw/xquartz/quartzRandR.c
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-01-27 13:23:18 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-02-01 16:21:39 -0800
commit5ad49102722274f53b9b011082d9e0f202fcd9a4 (patch)
treee99ecc3e8bd98396e9e01ceb03ed2c9433cf0b4f /hw/xquartz/quartzRandR.c
parent6e6db055f8b517ae9d63351d4c00fd480cb6b54a (diff)
xquartz: Remove support for Leopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'hw/xquartz/quartzRandR.c')
-rw-r--r--hw/xquartz/quartzRandR.c150
1 files changed, 0 insertions, 150 deletions
diff --git a/hw/xquartz/quartzRandR.c b/hw/xquartz/quartzRandR.c
index cb470fa8e..2e0c7b53d 100644
--- a/hw/xquartz/quartzRandR.c
+++ b/hw/xquartz/quartzRandR.c
@@ -66,154 +66,6 @@ static Bool ignore_next_fake_mode_update = FALSE;
typedef int (*QuartzModeCallback)
(ScreenPtr, QuartzModeInfoPtr, void *);
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
-
-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;
- pMode->pSize = NULL;
-}
-
-static Bool
-QuartzRandRCopyCurrentModeInfo(CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode)
-{
- CFDictionaryRef curModeRef = CGDisplayCurrentMode(screenId);
- if (!curModeRef)
- return FALSE;
-
- QuartzRandRGetModeInfo(curModeRef, pMode);
- pMode->ref = (void *)curModeRef;
- CFRetain(pMode->ref);
- return TRUE;
-}
-
-static Bool
-QuartzRandRSetCGMode(CGDirectDisplayID screenId,
- QuartzModeInfoPtr pMode)
-{
- CFDictionaryRef modeRef = (CFDictionaryRef)pMode->ref;
- return (CGDisplaySwitchToMode(screenId, modeRef) == kCGErrorSuccess);
-}
-
-static Bool
-QuartzRandREnumerateModes(ScreenPtr pScreen,
- QuartzModeCallback callback,
- void *data)
-{
- Bool retval = FALSE;
- QuartzScreenPtr pQuartzScreen = QUARTZ_PRIV(pScreen);
-
- /* 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)
- return FALSE;
- }
- }
-
- switch (callback(pScreen, &pQuartzScreen->rootlessMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
-
- case CALLBACK_ERROR:
- return FALSE;
-
- case CALLBACK_CONTINUE:
- retval = TRUE;
-
- default:
- break;
- }
-
- switch (callback(pScreen, &pQuartzScreen->fullscreenMode, data)) {
- case CALLBACK_SUCCESS:
- return TRUE;
-
- case CALLBACK_ERROR:
- return FALSE;
-
- case CALLBACK_CONTINUE:
- retval = TRUE;
-
- default:
- break;
- }
-
- return retval;
-}
-
-#else /* we have the new CG APIs from Snow Leopard */
-
static void
QuartzRandRGetModeInfo(CGDisplayModeRef modeRef,
QuartzModeInfoPtr pMode)
@@ -350,8 +202,6 @@ QuartzRandREnumerateModes(ScreenPtr pScreen,
return retval;
}
-#endif /* Snow Leopard CoreGraphics APIs */
-
static Bool
QuartzRandRModesEqual(QuartzModeInfoPtr pMode1,
QuartzModeInfoPtr pMode2)