summaryrefslogtreecommitdiffstats
path: root/platform/osx/os_osx.mm
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-03-03 14:41:36 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-03-03 14:41:36 -0300
commit2c2894ceb674927a35d2798b3e63adabdb020077 (patch)
tree9e8950e0acc8fb7531fa60ce8c0321a5b60c335a /platform/osx/os_osx.mm
parent4d2198110b4af7f203eeef95697255569e49bce7 (diff)
parenta0ee5cc3531786a652ee43d3a57cb69dff34bd70 (diff)
downloadredot-engine-2c2894ceb674927a35d2798b3e63adabdb020077.tar.gz
Merge branch 'master' of https://github.com/okamstudio/godot
Conflicts: modules/gdscript/gd_tokenizer.cpp scene/resources/shader_graph.h
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r--platform/osx/os_osx.mm13
1 files changed, 12 insertions, 1 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 5bc47a74c1..1c0d1f9991 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1093,8 +1093,19 @@ void OS_OSX::warp_mouse_pos(const Point2& p_to) {
mouse_y = p_to.y;
}
else{ //set OS position
- CGPoint lMouseWarpPos = {p_to.x, p_to.y};
+ /* this code has not been tested, please be a kind soul and fix it if it fails! */
+
+ //local point in window coords
+ NSPoint localPoint = { p_to.x, p_to.y };
+
+ NSPoint pointInWindow = [window_view convertPoint:localPoint toView:nil];
+ NSPoint pointOnScreen = [[window_view window] convertRectToScreen:(NSRect){.origin=pointInWindow}].origin;
+
+ //point in scren coords
+ CGPoint lMouseWarpPos = { pointOnScreen.x, pointOnScreen.y};
+
+ //do the warping
CGEventSourceRef lEventRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0);
CGAssociateMouseAndMouseCursorPosition(false);