Remove support for OS X 10.6

If you want 10.6 to be supported in future releases, please submit
a patch for #448.
This commit is contained in:
Camilla Berglund 2015-10-18 19:15:36 +02:00
parent a94a84b507
commit aee6b8765e
2 changed files with 19 additions and 63 deletions

View File

@ -65,6 +65,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
absolute and relative window size limits absolute and relative window size limits
- Added `GLFW_TRUE` and `GLFW_FALSE` as client API independent boolean values - Added `GLFW_TRUE` and `GLFW_FALSE` as client API independent boolean values
- Removed dependency on external OpenGL or OpenGL ES headers - Removed dependency on external OpenGL or OpenGL ES headers
- [Cocoa] Removed support for OS X 10.6
- [WGL] Removed dependency on external WGL headers - [WGL] Removed dependency on external WGL headers
- [GLX] Removed dependency on external GLX headers - [GLX] Removed dependency on external GLX headers
- [EGL] Removed dependency on external EGL headers - [EGL] Removed dependency on external EGL headers

View File

@ -99,18 +99,6 @@ static float transformY(float y)
return height - y; return height - y;
} }
// Returns the backing rect of the specified window
//
static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
return [window->ns.view convertRectToBacking:contentRect];
else
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
return contentRect;
}
// Translates OS X key modifiers into GLFW ones // Translates OS X key modifiers into GLFW ones
// //
static int translateFlags(NSUInteger flags) static int translateFlags(NSUInteger flags)
@ -181,7 +169,7 @@ static int translateKey(unsigned int key)
} }
const NSRect contentRect = [window->ns.view frame]; const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = convertRectToBacking(window, contentRect); const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height); _glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
@ -451,7 +439,7 @@ static int translateKey(unsigned int key)
- (void)viewDidChangeBackingProperties - (void)viewDidChangeBackingProperties
{ {
const NSRect contentRect = [window->ns.view frame]; const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = convertRectToBacking(window, contentRect); const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
} }
@ -542,9 +530,6 @@ static int translateKey(unsigned int key)
{ {
double deltaX, deltaY; double deltaX, deltaY;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
deltaX = [event scrollingDeltaX]; deltaX = [event scrollingDeltaX];
deltaY = [event scrollingDeltaY]; deltaY = [event scrollingDeltaY];
@ -553,13 +538,6 @@ static int translateKey(unsigned int key)
deltaX *= 0.1; deltaX *= 0.1;
deltaY *= 0.1; deltaY *= 0.1;
} }
}
else
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
{
deltaX = [event deltaX];
deltaY = [event deltaY];
}
if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0) if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
_glfwInputScroll(window, deltaX, deltaY); _glfwInputScroll(window, deltaX, deltaY);
@ -759,18 +737,12 @@ static void createMenuBar(void)
action:@selector(arrangeInFront:) action:@selector(arrangeInFront:)
keyEquivalent:@""]; keyEquivalent:@""];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
// TODO: Make this appear at the bottom of the menu (for consistency) // TODO: Make this appear at the bottom of the menu (for consistency)
[windowMenu addItem:[NSMenuItem separatorItem]]; [windowMenu addItem:[NSMenuItem separatorItem]];
[[windowMenu addItemWithTitle:@"Enter Full Screen" [[windowMenu addItemWithTitle:@"Enter Full Screen"
action:@selector(toggleFullScreen:) action:@selector(toggleFullScreen:)
keyEquivalent:@"f"] keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// Prior to Snow Leopard, we need to use this oddly-named semi-private API // Prior to Snow Leopard, we need to use this oddly-named semi-private API
// to get the application menu working properly. // to get the application menu working properly.
@ -869,13 +841,8 @@ static GLFWbool createWindow(_GLFWwindow* window,
return GLFW_FALSE; return GLFW_FALSE;
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
{
if (wndconfig->resizable) if (wndconfig->resizable)
[window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; [window->ns.object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
if (wndconfig->monitor) if (wndconfig->monitor)
{ {
@ -892,21 +859,14 @@ static GLFWbool createWindow(_GLFWwindow* window,
window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window]; window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];
#if defined(_GLFW_USE_RETINA) #if defined(_GLFW_USE_RETINA)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window->ns.view setWantsBestResolutionOpenGLSurface:YES]; [window->ns.view setWantsBestResolutionOpenGLSurface:YES];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
#endif /*_GLFW_USE_RETINA*/ #endif /*_GLFW_USE_RETINA*/
[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]]; [window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
[window->ns.object setDelegate:window->ns.delegate]; [window->ns.object setDelegate:window->ns.delegate];
[window->ns.object setAcceptsMouseMovedEvents:YES]; [window->ns.object setAcceptsMouseMovedEvents:YES];
[window->ns.object setContentView:window->ns.view]; [window->ns.object setContentView:window->ns.view];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window->ns.object setRestorable:NO]; [window->ns.object setRestorable:NO];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
return GLFW_TRUE; return GLFW_TRUE;
} }
@ -1030,7 +990,7 @@ void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{ {
const NSRect contentRect = [window->ns.view frame]; const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = convertRectToBacking(window, contentRect); const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
if (width) if (width)
*width = (int) fbRect.size.width; *width = (int) fbRect.size.width;
@ -1179,14 +1139,9 @@ void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
} }
else else
{ {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
const NSRect localRect = NSMakeRect(x, contentRect.size.height - y - 1, 0, 0); const NSRect localRect = NSMakeRect(x, contentRect.size.height - y - 1, 0, 0);
const NSRect globalRect = [window->ns.object convertRectToScreen:localRect]; const NSRect globalRect = [window->ns.object convertRectToScreen:localRect];
const NSPoint globalPoint = globalRect.origin; const NSPoint globalPoint = globalRect.origin;
#else
const NSPoint localPoint = NSMakePoint(x, contentRect.size.height - y - 1);
const NSPoint globalPoint = [window->ns.object convertBaseToScreen:localPoint];
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
CGWarpMouseCursorPosition(CGPointMake(globalPoint.x, CGWarpMouseCursorPosition(CGPointMake(globalPoint.x,
transformY(globalPoint.y))); transformY(globalPoint.y)));