macOS: remove dead code for supporting 10.6 at runtime.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
diff --git a/include/SDL_hints.h b/include/SDL_hints.h
index cc5d466..83cfe89 100644
--- a/include/SDL_hints.h
+++ b/include/SDL_hints.h
@@ -1469,9 +1469,7 @@ extern "C" {
* SDL_WINDOW_RESIZABLE windows will offer the "fullscreen"
* button on their titlebars).
*
- * The default value is "1". Spaces are disabled regardless of this hint if
- * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before
- * any windows are created.
+ * The default value is "1". This hint must be set before any windows are created.
*/
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m
index 774a93b..3a256d2 100644
--- a/src/video/cocoa/SDL_cocoaevents.m
+++ b/src/video/cocoa/SDL_cocoaevents.m
@@ -424,15 +424,13 @@ CreateApplicationMenus(void)
[windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
- /* Add the fullscreen toggle menu option, if supported */
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
- /* Cocoa should update the title to Enter or Exit Full Screen automatically.
- * But if not, then just fallback to Toggle Full Screen.
- */
- menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"];
- [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
- [windowMenu addItem:menuItem];
- }
+ /* Add the fullscreen toggle menu option. */
+ /* Cocoa should update the title to Enter or Exit Full Screen automatically.
+ * But if not, then just fallback to Toggle Full Screen.
+ */
+ menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"];
+ [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];
+ [windowMenu addItem:menuItem];
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
@@ -505,19 +503,6 @@ Cocoa_RegisterApp(void)
int
Cocoa_PumpEventsUntilDate(_THIS, NSDate *expiration, bool accumulate)
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- /* Update activity every 30 seconds to prevent screensaver */
- SDL_VideoData *data = (SDL_VideoData *)_this->driverdata;
- if (_this->suspend_screensaver && !data->screensaver_use_iopm) {
- Uint32 now = SDL_GetTicks();
- if (!data->screensaver_activity ||
- SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) {
- UpdateSystemActivity(UsrActivity);
- data->screensaver_activity = now;
- }
- }
-#endif
-
for ( ; ; ) {
NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:expiration inMode:NSDefaultRunLoopMode dequeue:YES ];
if ( event == nil ) {
@@ -584,10 +569,6 @@ Cocoa_SuspendScreenSaver(_THIS)
{
SDL_VideoData *data = (__bridge SDL_VideoData *)_this->driverdata;
- if (!data.screensaver_use_iopm) {
- return;
- }
-
if (data.screensaver_assertion) {
IOPMAssertionRelease(data.screensaver_assertion);
data.screensaver_assertion = kIOPMNullAssertionID;
diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m
index 2c9606b..59ee39d 100644
--- a/src/video/cocoa/SDL_cocoakeyboard.m
+++ b/src/video/cocoa/SDL_cocoakeyboard.m
@@ -140,14 +140,7 @@
aRange.location, aRange.length, windowHeight,
NSStringFromRect(rect));
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- if (![window respondsToSelector:@selector(convertRectToScreen:)]) {
- rect.origin = [window convertBaseToScreen:rect.origin];
- } else
-#endif
- {
- rect = [window convertRectToScreen:rect];
- }
+ rect = [window convertRectToScreen:rect];
return rect;
}
diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m
index 3732ebb..ebdc921 100644
--- a/src/video/cocoa/SDL_cocoametalview.m
+++ b/src/video/cocoa/SDL_cocoametalview.m
@@ -187,11 +187,8 @@ Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
/* Fall back to the viewport size. */
NSRect viewport = [contentView bounds];
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
- /* This gives us the correct viewport for a Retina-enabled view, only
- * supported on 10.7+. */
- if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
- viewport = [contentView convertRectToBacking:viewport];
- }
+ /* This gives us the correct viewport for a Retina-enabled view. */
+ viewport = [contentView convertRectToBacking:viewport];
}
if (w) {
*w = viewport.size.width;
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index 1404258..88284b5 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -31,9 +31,6 @@
#include <CoreVideo/CVBase.h>
#include <CoreVideo/CVDisplayLink.h>
-/* we need this for ShowMenuBar() and HideMenuBar(). */
-#include <Carbon/Carbon.h>
-
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
#include <AvailabilityMacros.h>
@@ -45,23 +42,6 @@
#endif
-static void
-Cocoa_ToggleMenuBar(const BOOL show)
-{
- /* !!! FIXME: keep an eye on this.
- * ShowMenuBar/HideMenuBar is officially unavailable for 64-bit binaries.
- * It happens to work, as of 10.7, but we're going to see if
- * we can just simply do without it on newer OSes...
- */
-#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) && !defined(__LP64__)
- if (show) {
- ShowMenuBar();
- } else {
- HideMenuBar();
- }
-#endif
-}
-
static int
CG_SetError(const char *prefix, CGDisplayErr result)
{
@@ -497,7 +477,7 @@ Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdp
CFRelease(dmOptions);
} else
#endif
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
+ {
// fallback for 10.7
scaleFactor = [screen backingScaleFactor];
displayNativeSize.width = displayNativeSize.width * scaleFactor;
@@ -646,10 +626,6 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
} else {
CGDisplayRelease(displaydata->display);
}
-
- if (CGDisplayIsMain(displaydata->display)) {
- Cocoa_ToggleMenuBar(YES);
- }
} else {
/* Put up the blanking window (a window above all other windows) */
if (CGDisplayIsMain(displaydata->display)) {
@@ -669,11 +645,6 @@ Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
CG_SetError("CGDisplaySwitchToMode()", result);
goto ERR_NO_SWITCH;
}
-
- /* Hide the menu bar so it doesn't intercept events */
- if (CGDisplayIsMain(displaydata->display)) {
- Cocoa_ToggleMenuBar(NO);
- }
}
/* Fade in again (asynchronously) */
@@ -720,7 +691,6 @@ Cocoa_QuitModes(_THIS)
CFRelease(mode->modes);
}
}
- Cocoa_ToggleMenuBar(YES);
}
#endif /* SDL_VIDEO_DRIVER_COCOA */
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m
index 70d2db3..25041eb 100644
--- a/src/video/cocoa/SDL_cocoamouse.m
+++ b/src/video/cocoa/SDL_cocoamouse.m
@@ -461,15 +461,13 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
CGFloat y = [event deltaY];
SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL;
- if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) {
- if ([event isDirectionInvertedFromDevice] == YES) {
- direction = SDL_MOUSEWHEEL_FLIPPED;
- }
+ if ([event isDirectionInvertedFromDevice] == YES) {
+ direction = SDL_MOUSEWHEEL_FLIPPED;
}
/* For discrete scroll events from conventional mice, always send a full tick.
For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
- if (![event respondsToSelector:@selector(hasPreciseScrollingDeltas)] || ![event hasPreciseScrollingDeltas]) {
+ if (![event hasPreciseScrollingDeltas]) {
if (x > 0) {
x = SDL_ceil(x);
} else if (x < 0) {
diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m
index 1ec8f9b..aa2f51e 100644
--- a/src/video/cocoa/SDL_cocoaopengl.m
+++ b/src/video/cocoa/SDL_cocoaopengl.m
@@ -180,7 +180,6 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
- SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
NSOpenGLPixelFormatAttribute attr[32];
NSOpenGLPixelFormat *fmt;
SDLOpenGLContext *context;
@@ -214,22 +213,15 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
return NULL;
#endif
}
- if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) {
- SDL_SetError ("OpenGL Core Profile is not supported on this platform version");
- return NULL;
- }
attr[i++] = NSOpenGLPFAAllowOfflineRenderers;
- /* specify a profile if we're on Lion (10.7) or later. */
- if (lion_or_later) {
- NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
- if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
- profile = NSOpenGLProfileVersion3_2Core;
- }
- attr[i++] = NSOpenGLPFAOpenGLProfile;
- attr[i++] = profile;
+ NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy;
+ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
+ profile = NSOpenGLProfileVersion3_2Core;
}
+ attr[i++] = NSOpenGLPFAOpenGLProfile;
+ attr[i++] = profile;
attr[i++] = NSOpenGLPFAColorSize;
attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8;
@@ -377,11 +369,8 @@ Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
NSRect viewport = [contentView bounds];
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
- /* This gives us the correct viewport for a Retina-enabled view, only
- * supported on 10.7+. */
- if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
- viewport = [contentView convertRectToBacking:viewport];
- }
+ /* This gives us the correct viewport for a Retina-enabled view. */
+ viewport = [contentView convertRectToBacking:viewport];
}
if (w) {
diff --git a/src/video/cocoa/SDL_cocoavideo.h b/src/video/cocoa/SDL_cocoavideo.h
index 826b52e..4de8511 100644
--- a/src/video/cocoa/SDL_cocoavideo.h
+++ b/src/video/cocoa/SDL_cocoavideo.h
@@ -103,8 +103,6 @@ DECLARE_ALERT_STYLE(Critical);
@property (nonatomic) void *key_layout;
@property (nonatomic) SDLTranslatorResponder *fieldEdit;
@property (nonatomic) NSInteger clipboard_count;
- @property (nonatomic) Uint32 screensaver_activity;
- @property (nonatomic) BOOL screensaver_use_iopm;
@property (nonatomic) IOPMAssertionID screensaver_assertion;
@property (nonatomic) SDL_mutex *swaplock;
@end
diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m
index dbc4fc9..1df31f6 100644
--- a/src/video/cocoa/SDL_cocoavideo.m
+++ b/src/video/cocoa/SDL_cocoavideo.m
@@ -196,10 +196,7 @@ Cocoa_VideoInit(_THIS)
return -1;
}
- data.allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE));
-
- /* The IOPM assertion API can disable the screensaver as of 10.7. */
- data.screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
+ data.allow_spaces = SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE);
data.swaplock = SDL_CreateMutex();
if (!data.swaplock) {
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index a9d9b85..7943025 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -1713,8 +1713,6 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
#endif
if (videodata.allow_spaces) {
- SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6);
- SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]);
/* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
if (window->flags & SDL_WINDOW_RESIZABLE) {
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
@@ -1738,10 +1736,8 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
#endif
/* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when
* the NSHighResolutionCapable boolean is set in Info.plist. */
- if ([contentView respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
- BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
- [contentView setWantsBestResolutionOpenGLSurface:highdpi];
- }
+ BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
+ [contentView setWantsBestResolutionOpenGLSurface:highdpi];
#ifdef __clang__
#pragma clang diagnostic pop
#endif
@@ -1813,10 +1809,8 @@ Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
#endif
/* Note: as of the macOS 10.15 SDK, this defaults to YES instead of NO when
* the NSHighResolutionCapable boolean is set in Info.plist. */
- if ([nsview respondsToSelector:@selector(setWantsBestResolutionOpenGLSurface:)]) {
- BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
- [nsview setWantsBestResolutionOpenGLSurface:highdpi];
- }
+ BOOL highdpi = (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
+ [nsview setWantsBestResolutionOpenGLSurface:highdpi];
#ifdef __clang__
#pragma clang diagnostic pop
#endif