summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2013-08-05 20:35:49 +0000
committermichi_cc <michi_cc@openttd.org>2013-08-05 20:35:49 +0000
commit408c595eb8d5edfa823d2857c7eda903130b222d (patch)
tree0084d52f0c5074fd11a2918b050500431a6d9135 /src/video
parent7ba4d425c80f4f99092c42b1589451afedadc4f0 (diff)
downloadopenttd-408c595eb8d5edfa823d2857c7eda903130b222d.tar.xz
(svn r25658) -Fix [FS#4392]: [OSX] The mouse cursor would sometimes jump near the window borders. (Matthieu)
Diffstat (limited to 'src/video')
-rw-r--r--src/video/cocoa/wnd_quartz.mm17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm
index 9914b97c9..4274c2ca4 100644
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -514,8 +514,21 @@ CGPoint WindowQuartzSubdriver::PrivateLocalToCG(NSPoint *p)
NSPoint WindowQuartzSubdriver::GetMouseLocation(NSEvent *event)
{
- NSPoint pt = [ event locationInWindow ];
- pt = [ this->cocoaview convertPoint:pt fromView:nil ];
+ NSPoint pt;
+
+ if (event.window == nil) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if ([ this->cocoaview respondsToSelector:@selector(convertRectFromScreen:) ]) {
+ pt = [ this->cocoaview convertPoint:[ [ this->cocoaview window ] convertRectFromScreen:NSMakeRect([ event locationInWindow ].x, [ event locationInWindow ].y, 0, 0) ].origin fromView:nil ];
+ }
+ else
+#endif
+ {
+ pt = [ this->cocoaview convertPoint:[ [ this->cocoaview window ] convertScreenToBase:[ event locationInWindow ] ] fromView:nil ];
+ }
+ } else {
+ pt = [ event locationInWindow ];
+ }
pt.y = this->window_height - pt.y;