1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Fix full screen window position on OS X

Fixes #653.
This commit is contained in:
Camilla Berglund 2015-12-07 21:03:24 +01:00
parent 001761ed58
commit e82e2b7570
2 changed files with 17 additions and 20 deletions

View File

@ -76,6 +76,7 @@ used by the tests and examples and are not required to build the library.
- Removed dependency on external OpenGL or OpenGL ES headers - Removed dependency on external OpenGL or OpenGL ES headers
- [Win32] Added support for Windows 8.1 per-monitor DPI - [Win32] Added support for Windows 8.1 per-monitor DPI
- [Cocoa] Removed support for OS X 10.6 - [Cocoa] Removed support for OS X 10.6
- [Cocoa] Bugfix: Full screen windows on secondary monitors were mispositioned
- [X11] Bugfix: Monitor connection and disconnection events were not reported - [X11] Bugfix: Monitor connection and disconnection events were not reported
- [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end - [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end
- [POSIX] Bugfix: An unrelated TLS key could be deleted by `glfwTerminate` - [POSIX] Bugfix: An unrelated TLS key could be deleted by `glfwTerminate`

View File

@ -64,22 +64,27 @@ static void centerCursor(_GLFWwindow *window)
_glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0); _glfwPlatformSetCursorPos(window, width / 2.0, height / 2.0);
} }
// Transforms the specified y-coordinate between the CG display and NS screen
// coordinate systems
//
static float transformY(float y)
{
const float height = CGDisplayBounds(CGMainDisplayID()).size.height;
return height - y;
}
// Enter full screen mode // Enter full screen mode
// //
static GLFWbool enterFullscreenMode(_GLFWwindow* window) static GLFWbool enterFullscreenMode(_GLFWwindow* window)
{ {
GLFWvidmode mode; const GLFWbool status = _glfwSetVideoMode(window->monitor, &window->videoMode);
GLFWbool status; const CGRect bounds = CGDisplayBounds(window->monitor->ns.displayID);
int xpos, ypos; const NSRect frame = NSMakeRect(bounds.origin.x,
transformY(bounds.origin.y + bounds.size.height),
status = _glfwSetVideoMode(window->monitor, &window->videoMode); bounds.size.width,
bounds.size.height);
_glfwPlatformGetVideoMode(window->monitor, &mode);
_glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos);
[window->ns.object setFrame:NSMakeRect(xpos, ypos, mode.width, mode.height)
display:YES];
[window->ns.object setFrame:frame display:YES];
return status; return status;
} }
@ -90,15 +95,6 @@ static void leaveFullscreenMode(_GLFWwindow* window)
_glfwRestoreVideoMode(window->monitor); _glfwRestoreVideoMode(window->monitor);
} }
// Transforms the specified y-coordinate between the CG display and NS screen
// coordinate systems
//
static float transformY(float y)
{
const float height = CGDisplayBounds(CGMainDisplayID()).size.height;
return height - y;
}
// 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)