diff --git a/src/SFML/Window/OSX/SFOpenGLView.mm b/src/SFML/Window/OSX/SFOpenGLView.mm index ef1d416a..2330e5e2 100644 --- a/src/SFML/Window/OSX/SFOpenGLView.mm +++ b/src/SFML/Window/OSX/SFOpenGLView.mm @@ -174,16 +174,19 @@ BOOL isValidTextUnicode(NSEvent* event); } +//////////////////////////////////////////////////////// +-(NSPoint)convertPointToScreen:(NSPoint)point +{ + NSRect rect = NSZeroRect; + rect.origin = point; + rect = [[self window] convertRectToScreen:rect]; + return rect.origin; +} + + //////////////////////////////////////////////////////// -(NSPoint)computeGlobalPositionOfRelativePoint:(NSPoint)point { - // Note : -[NSWindow convertBaseToScreen:] is deprecated on 10.7 - // but the recommended -[NSWindow convertRectToScreen] is not - // available until 10.7. - // - // So we stick with the old one for now. - - // Flip SFML coordinates to match window coordinates point.y = [self frame].size.height - point.y; @@ -192,7 +195,7 @@ BOOL isValidTextUnicode(NSEvent* event); point = [self convertPoint:point toView:nil]; // nil means window // Convert it to screen coordinates - point = [[self window] convertBaseToScreen:point]; + point = [self convertPointToScreen:point]; // Flip screen coordinates to match CGDisplayMoveCursorToPoint referential. const float screenHeight = [[[self window] screen] frame].size.height; diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index 8a2ea501..e045d087 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -343,7 +343,7 @@ const NSPoint origin = [m_oglView frame].origin; const NSSize size = [m_oglView frame].size; const NSPoint topLeftCornerOfView = NSMakePoint(origin.x, origin.y + size.height); - const NSPoint positionInView = [m_oglView convertPointToBase:topLeftCornerOfView]; + const NSPoint positionInView = [m_oglView convertPointToBacking:topLeftCornerOfView]; // Then, convert it to window base system const NSPoint positionInWindow = [m_oglView convertPoint:positionInView toView:nil];