xquartz: Remove support for Leopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit 5ad4910272
)
This commit is contained in:
parent
2d7eb82499
commit
739c5bd32f
|
@ -46,10 +46,7 @@
|
||||||
#undef BOOL
|
#undef BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface X11Controller : NSObject
|
@interface X11Controller : NSObject <NSTableViewDataSource>
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
|
||||||
<NSTableViewDataSource>
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
IBOutlet NSPanel *prefs_panel;
|
IBOutlet NSPanel *prefs_panel;
|
||||||
|
|
||||||
|
|
|
@ -868,13 +868,7 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
- (IBAction) x11_help:sender
|
- (IBAction) x11_help:sender
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
AHLookupAnchor((CFStringRef)NSLocalizedString(@"Mac Help",
|
|
||||||
no comment),
|
|
||||||
CFSTR("mchlp2276"));
|
|
||||||
#else
|
|
||||||
AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276"));
|
AHLookupAnchor(CFSTR("com.apple.machelp"), CFSTR("mchlp2276"));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
|
- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
|
||||||
|
|
|
@ -72,12 +72,6 @@
|
||||||
#include <rootlessCommon.h>
|
#include <rootlessCommon.h>
|
||||||
#include <Xplugin.h>
|
#include <Xplugin.h>
|
||||||
|
|
||||||
/* Work around a bug on Leopard's headers */
|
|
||||||
#if defined (__LP64__) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 && MAC_OS_X_VERSION_MAX_ALLOWED < 1060
|
|
||||||
extern OSErr UpdateSystemActivity(UInt8 activity);
|
|
||||||
#define OverallAct 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DevPrivateKeyRec quartzScreenKeyRec;
|
DevPrivateKeyRec quartzScreenKeyRec;
|
||||||
int aquaMenuBarHeight = 0;
|
int aquaMenuBarHeight = 0;
|
||||||
QuartzModeProcsPtr quartzProcs = NULL;
|
QuartzModeProcsPtr quartzProcs = NULL;
|
||||||
|
|
|
@ -66,154 +66,6 @@ static Bool ignore_next_fake_mode_update = FALSE;
|
||||||
typedef int (*QuartzModeCallback)
|
typedef int (*QuartzModeCallback)
|
||||||
(ScreenPtr, QuartzModeInfoPtr, void *);
|
(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
|
static void
|
||||||
QuartzRandRGetModeInfo(CGDisplayModeRef modeRef,
|
QuartzRandRGetModeInfo(CGDisplayModeRef modeRef,
|
||||||
QuartzModeInfoPtr pMode)
|
QuartzModeInfoPtr pMode)
|
||||||
|
@ -350,8 +202,6 @@ QuartzRandREnumerateModes(ScreenPtr pScreen,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Snow Leopard CoreGraphics APIs */
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
QuartzRandRModesEqual(QuartzModeInfoPtr pMode1,
|
QuartzRandRModesEqual(QuartzModeInfoPtr pMode1,
|
||||||
QuartzModeInfoPtr pMode2)
|
QuartzModeInfoPtr pMode2)
|
||||||
|
|
|
@ -331,10 +331,6 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
||||||
DEBUG_LOG("index=%d depth=%d\n", index, depth);
|
DEBUG_LOG("index=%d depth=%d\n", index, depth);
|
||||||
|
|
||||||
if (depth == -1) {
|
if (depth == -1) {
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
|
||||||
depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) *
|
|
||||||
CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
|
||||||
#else
|
|
||||||
CGDisplayModeRef modeRef;
|
CGDisplayModeRef modeRef;
|
||||||
CFStringRef encStrRef;
|
CFStringRef encStrRef;
|
||||||
|
|
||||||
|
@ -364,12 +360,9 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(encStrRef);
|
CFRelease(encStrRef);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
|
||||||
have_depth:
|
have_depth:
|
||||||
#endif
|
|
||||||
switch (depth) {
|
switch (depth) {
|
||||||
case 8: // pseudo-working
|
case 8: // pseudo-working
|
||||||
dfb->visuals = PseudoColorMask;
|
dfb->visuals = PseudoColorMask;
|
||||||
|
|
Loading…
Reference in New Issue