From 39ffd1e4c047e50c2db5256c03ddbf07df2e09e1 Mon Sep 17 00:00:00 2001 From: rti Date: Wed, 2 Jun 2010 13:25:53 +0200 Subject: [PATCH] Changed: #947 window position and cocoa screen coordinates --- .../src/3d/driver/opengl/mac/cocoa_adapter.mm | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm index 93eeba689..02b90c589 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm @@ -126,23 +126,18 @@ void getWindowSize(uint32 &width, uint32 &height) void getWindowPos(uint32 &x, uint32 &y) { - /* - TODO mac os gives bottom left - */ - - NSRect rect = [g_window frame]; - x = rect.origin.x; - y = rect.origin.y; - - nldebug("%d %d", x, y); + NSRect screenRect = [[g_window screen] frame]; + NSRect windowRect = [g_window frame]; + x = windowRect.origin.x; + y = screenRect.size.height - windowRect.size.height - windowRect.origin.y; } void setWindowPos(uint32 x, uint32 y) { - /* - TODO mac os gets bottom left - */ - [g_window setFrameOrigin:NSMakePoint(x, y)]; + NSRect screenRect = [[g_window screen] frame]; + NSRect windowRect = [g_window frame]; + y = screenRect.size.height - y; + [g_window setFrameTopLeftPoint:NSMakePoint(x, y)]; } void setWindowTitle(const ucstring &title)