From 6e6db055f8b517ae9d63351d4c00fd480cb6b54a Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Wed, 27 Jan 2021 13:18:35 -0800 Subject: xquartz: Remove support for Tiger and earlier versions of macOS Signed-off-by: Jeremy Huddleston Sequoia --- hw/xquartz/X11Application.m | 25 +------------------------ hw/xquartz/X11Controller.h | 10 ---------- hw/xquartz/console_redirect.c | 14 -------------- hw/xquartz/mach-startup/bundle-main.c | 11 +---------- hw/xquartz/mach-startup/stub.c | 13 ------------- hw/xquartz/pbproxy/pbproxy.h | 9 --------- hw/xquartz/quartzKeyboard.c | 20 +++++--------------- 7 files changed, 7 insertions(+), 95 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index f7b139685..39544e953 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -85,11 +85,7 @@ static dispatch_queue_t eventTranslationQueue; extern Bool noTestExtensions; extern Bool noRenderExtension; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 static TISInputSourceRef last_key_layout; -#else -static KeyboardLayoutRef last_key_layout; -#endif /* This preference is only tested on Lion or later as it's not relevant to * earlier OS versions. @@ -1236,18 +1232,11 @@ X11ApplicationMain(int argc, char **argv, char **envp) #endif /* Set the key layout seed before we start the server */ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 last_key_layout = TISCopyCurrentKeyboardLayoutInputSource(); if (!last_key_layout) ErrorF( "X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n"); -#else - KLGetCurrentKeyboardLayout(&last_key_layout); - if (!last_key_layout) - ErrorF( - "X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n"); -#endif if (!QuartsResyncKeymap(FALSE)) { ErrorF("X11ApplicationMain: Could not build a valid keymap.\n"); @@ -1653,11 +1642,6 @@ handle_mouse: case NSScrollWheel: { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 - float deltaX = [e deltaX]; - float deltaY = [e deltaY]; - BOOL isContinuous = NO; -#else CGFloat deltaX = [e deltaX]; CGFloat deltaY = [e deltaY]; CGEventRef cge = [e CGEvent]; @@ -1679,7 +1663,6 @@ handle_mouse: deltaY *= lineHeight / 5.0; } #endif -#endif #if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0 /* If we're in the background, we need to send a MotionNotify event @@ -1806,7 +1789,6 @@ handle_mouse: } if (darwinSyncKeymap) { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource(); TISInputSourceRef clear; @@ -1818,12 +1800,7 @@ handle_mouse: clear = last_key_layout; last_key_layout = key_layout; CFRelease(clear); -#else - KeyboardLayoutRef key_layout; - KLGetCurrentKeyboardLayout(&key_layout); - if (key_layout != last_key_layout) { - last_key_layout = key_layout; -#endif + /* Update keyInfo */ if (!QuartsResyncKeymap(TRUE)) { ErrorF( diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h index c8b501831..84c7ce6d8 100644 --- a/hw/xquartz/X11Controller.h +++ b/hw/xquartz/X11Controller.h @@ -46,16 +46,6 @@ #undef BOOL #endif -#ifndef NSINTEGER_DEFINED -#if __LP64__ || NS_BUILD_32_LIKE_64 -typedef long NSInteger; -typedef unsigned long NSUInteger; -#else -typedef int NSInteger; -typedef unsigned int NSUInteger; -#endif -#endif - @interface X11Controller : NSObject #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c index 8fdce4699..30d05ecc0 100644 --- a/hw/xquartz/console_redirect.c +++ b/hw/xquartz/console_redirect.c @@ -316,20 +316,6 @@ xq_asl_init(void) atexit(redirect_atexit); } -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -#define fls(v) xq_fls(v) - -static inline int fls(int value) { - unsigned int b, v; - - v = *((unsigned int *)&value); - - for(b=0 ; v ; v >>= 1 , b++); - - return b; -} -#endif - int xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd) { diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index 8cfe1e47d..8a68785c2 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -91,12 +91,8 @@ extern int noPanoramiXExtension; static char __crashreporter_info_buff__[4096] = { 0 }; static const char *__crashreporter_info__ __attribute__((__used__)) = &__crashreporter_info_buff__[0]; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 -// This is actually a toolchain requirement, but I'm not sure the correct check, -// but it should be fine to just only include it for Leopard and later. This line -// just tells the linker to never strip this symbol (such as for space optimization) +// This line just tells the linker to never strip this symbol (such as for space optimization) asm (".desc ___crashreporter_info__, 0x10"); -#endif static const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION; @@ -477,14 +473,9 @@ startup_trigger(int argc, char **argv, char **envp) kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if (kr != KERN_SUCCESS) { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 ErrorF("bootstrap_look_up(%s): %s\n", server_bootstrap_name, bootstrap_strerror( kr)); -#else - ErrorF("bootstrap_look_up(%s): %ul\n", server_bootstrap_name, - (unsigned long)kr); -#endif exit(EXIT_FAILURE); } diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index 756e4ef2d..fad7ea76d 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -61,8 +61,6 @@ aslclient aslc; static void set_x11_path(void) { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 - CFURLRef appURL = NULL; OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR( @@ -104,11 +102,6 @@ set_x11_path(void) (int)osstatus); exit(11); } -#else - /* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */ - strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11", - sizeof(x11_path)); -#endif } static int @@ -291,15 +284,9 @@ main(int argc, char **argv, char **envp) } if (kr != KERN_SUCCESS) { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror( kr)); -#else - asl_log(aslc, NULL, ASL_LEVEL_ERR, - "Xquartz: bootstrap_look_up(): %ul", - (unsigned long)kr); -#endif return EXIT_FAILURE; } } diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h index c5a07f2d0..1b94097b7 100644 --- a/hw/xquartz/pbproxy/pbproxy.h +++ b/hw/xquartz/pbproxy/pbproxy.h @@ -36,15 +36,6 @@ #include #include -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -#if __LP64__ || NS_BUILD_32_LIKE_64 -typedef long NSInteger; -typedef unsigned long NSUInteger; -#else -typedef int NSInteger; -typedef unsigned int NSUInteger; -#endif -#endif #define Cursor X_Cursor #undef _SHAPE_H_ diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index bb99e8cd0..cd1f96550 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -733,7 +733,7 @@ DarwinModifierStringToNXMask(const char *str, int separatelr) return 0; } -#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if !defined(__LP64__) static inline UniChar macroman2ucs(unsigned char c) { @@ -795,7 +795,7 @@ make_dead_key(KeySym in) static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { -#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if !defined(__LP64__) KeyboardLayoutRef key_layout; int is_uchr = 1; #endif @@ -807,7 +807,6 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) KeySym *k; CFDataRef currentKeyLayoutDataRef = NULL; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); @@ -817,33 +816,28 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); } -#endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty #endif -#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if !defined(__LP64__) if (chr_data == NULL) { -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 ErrorF( "X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n"); ErrorF( "X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n", (unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data); -#endif KLGetCurrentKeyboardLayout(&key_layout); KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if (chr_data != NULL) { ErrorF( "X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } -#endif } if (chr_data == NULL) { @@ -855,12 +849,10 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) is_uchr = 0; num_keycodes = 128; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if (chr_data != NULL) { ErrorF( "X11.app: Fallback succeeded, but this is still a bug. Please report the above information.\n"); } -#endif } #endif @@ -868,10 +860,8 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) #pragma clang diagnostic pop #endif -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if (currentKeyLayoutRef) CFRelease(currentKeyLayoutRef); -#endif if (chr_data == NULL) { ErrorF("Couldn't get uchr or kchr resource\n"); @@ -895,7 +885,7 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) k = info->keyMap + i * GLYPHS_PER_KEY; for (j = 0; j < 4; j++) { -#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if !defined(__LP64__) if (is_uchr) { #endif UniChar s[8]; @@ -924,7 +914,7 @@ QuartzReadSystemKeymap(darwinKeyboardInfo *info) k[j] = ucs2keysym(s[0]); if (dead_key_state != 0) k[j] = make_dead_key(k[j]); } -#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +#if !defined(__LP64__) } else { // kchr UInt32 c, state = 0, state2 = 0; -- cgit v1.2.3