Skip to content

Commit

Permalink
added support for OS X 10.6 windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemcdonald committed Jun 15, 2013
1 parent f1c88b4 commit f03d999
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/cocoa_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
// Needed for _NSGetProgname
#include <crt_externs.h>


// Enter fullscreen mode
//
static void enterFullscreenMode(_GLFWwindow* window)
Expand Down Expand Up @@ -112,7 +111,11 @@ - (void)windowDidResize:(NSNotification *)notification
[window->nsgl.context update];

const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
const NSRect fbRect = contentRect;
#else
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
#endif

_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
Expand Down Expand Up @@ -525,7 +528,11 @@ - (void)mouseEntered:(NSEvent *)event
- (void)viewDidChangeBackingProperties
{
const NSRect contentRect = [window->ns.view frame];
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
const NSRect fbRect = contentRect;
#else
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
#endif

_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
}
Expand Down Expand Up @@ -814,18 +821,23 @@ static GLboolean createWindow(_GLFWwindow* window,
}

window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window];

#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
#else
[window->ns.view setWantsBestResolutionOpenGLSurface:YES];
#endif

[window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]];
[window->ns.object setContentView:window->ns.view];
[window->ns.object setDelegate:window->ns.delegate];
[window->ns.object setAcceptsMouseMovedEvents:YES];
[window->ns.object disableCursorRects];
[window->ns.object center];


#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
#else
if ([window->ns.object respondsToSelector:@selector(setRestorable:)])
[window->ns.object setRestorable:NO];
#endif

return GL_TRUE;
}
Expand Down

0 comments on commit f03d999

Please sign in to comment.