Replaced some deprecated functions on OS X
NSWindow convertBaseToScreen: -> convertRectToScreen: NSView convertPointToBase: -> convertPointToBacking:
This commit is contained in:
parent
d8812f0f5c
commit
2eb4f69e41
@ -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
|
-(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
|
// Flip SFML coordinates to match window coordinates
|
||||||
point.y = [self frame].size.height - point.y;
|
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
|
point = [self convertPoint:point toView:nil]; // nil means window
|
||||||
|
|
||||||
// Convert it to screen coordinates
|
// Convert it to screen coordinates
|
||||||
point = [[self window] convertBaseToScreen:point];
|
point = [self convertPointToScreen:point];
|
||||||
|
|
||||||
// Flip screen coordinates to match CGDisplayMoveCursorToPoint referential.
|
// Flip screen coordinates to match CGDisplayMoveCursorToPoint referential.
|
||||||
const float screenHeight = [[[self window] screen] frame].size.height;
|
const float screenHeight = [[[self window] screen] frame].size.height;
|
||||||
|
@ -343,7 +343,7 @@
|
|||||||
const NSPoint origin = [m_oglView frame].origin;
|
const NSPoint origin = [m_oglView frame].origin;
|
||||||
const NSSize size = [m_oglView frame].size;
|
const NSSize size = [m_oglView frame].size;
|
||||||
const NSPoint topLeftCornerOfView = NSMakePoint(origin.x, origin.y + size.height);
|
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
|
// Then, convert it to window base system
|
||||||
const NSPoint positionInWindow = [m_oglView convertPoint:positionInView toView:nil];
|
const NSPoint positionInWindow = [m_oglView convertPoint:positionInView toView:nil];
|
||||||
|
Loading…
Reference in New Issue
Block a user