From d20aa0428a5da86e48617aa1c936b60d22d17152 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 9 Jul 2013 17:08:26 +0200 Subject: [PATCH] Fixed window positioning on OS X. --- README.md | 1 + src/cocoa_window.m | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0171a67..9a57f058 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/). library termination - [Cocoa] Bugfix: The clipboard string was not freed on terminate - [Cocoa] Bugfix: Selectors were used that are not declared by the 10.6 SDK + - [Cocoa] Bugfix: The position set by `glfwSetWindowPos` was incorrect - [X11] Bugfix: Override-redirect windows were resized to the desired instead of the actual resolution of the selected video mode - [X11] Bugfix: Screensaver override for full screen windows had a possible diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 6209d1eb..df49ab90 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -937,8 +937,9 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y) { - const NSRect frameRect = - [window->ns.object frameRectForContentRect:NSMakeRect(x, y, 0, 0)]; + const NSRect contentRect = [window->ns.view frame]; + const NSRect dummyRect = NSMakeRect(x, transformY(y + contentRect.size.height), 0, 0); + const NSRect frameRect = [window->ns.object frameRectForContentRect:dummyRect]; [window->ns.object setFrameOrigin:frameRect.origin]; }