From 74b7f0a9aa7658857714db365853db8f6c8512bd Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 28 Jan 2018 23:01:10 +0100 Subject: Fix: [OSX] Remove some OSX compiler warnings on newer SDKs/compilers. --- src/video/cocoa/wnd_quartz.mm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/video/cocoa/wnd_quartz.mm') diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index 795a311bc..d42749bac 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -333,7 +333,9 @@ bool WindowQuartzSubdriver::SetVideoMode(int width, int height, int bpp) [ this->window setAcceptsMouseMovedEvents:YES ]; [ this->window setViewsNeedDisplay:NO ]; - [ this->window useOptimizedDrawing:YES ]; +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 + if ([ this->window respondsToSelector:@selector(useOptimizedDrawing:) ]) [ this->window useOptimizedDrawing:YES ]; +#endif delegate = [ [ OTTD_CocoaWindowDelegate alloc ] init ]; [ delegate setDriver:this ]; @@ -517,7 +519,16 @@ CGPoint WindowQuartzSubdriver::PrivateLocalToCG(NSPoint *p) p->y = this->window_height - p->y; *p = [ this->cocoaview convertPoint:*p toView:nil ]; - *p = [ this->window convertBaseToScreen:*p ]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if ([ this->window respondsToSelector:@selector(convertRectToScreen:) ]) { + *p = [ this->window convertRectToScreen:NSMakeRect(p->x, p->y, 0, 0) ].origin; + } else +#endif + { +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 + *p = [ this->window convertBaseToScreen:*p ]; +#endif + } p->y = this->device_height - p->y; CGPoint cgp; @@ -539,7 +550,9 @@ NSPoint WindowQuartzSubdriver::GetMouseLocation(NSEvent *event) else #endif { +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7 pt = [ this->cocoaview convertPoint:[ [ this->cocoaview window ] convertScreenToBase:[ event locationInWindow ] ] fromView:nil ]; +#endif } } else { pt = [ event locationInWindow ]; -- cgit v1.2.3-70-g09d2