summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-11 14:47:13 +0100
committerGitHub <noreply@github.com>2021-11-11 14:47:13 +0100
commit7d2900e1bdddebe48ae585d77d38dac9dc6311bc (patch)
tree490586fafbc67d65645422018f3eed94b4a530f8
parent9547d6d5437d675c3e49ca687f81dc762260770d (diff)
parentf6e449a194c09e13e7845c84a156f45bb1f202c8 (diff)
Merge pull request #54876 from bruvzg/no_captured_move
-rw-r--r--platform/osx/display_server_osx.mm7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index 03301af0af..647f501e6b 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -1920,6 +1920,7 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) {
return;
}
+ WindowData &wd = windows[MAIN_WINDOW_ID];
if (p_mode == MOUSE_MODE_CAPTURED) {
// Apple Docs state that the display parameter is not used.
// "This parameter is not used. By default, you may pass kCGDirectMainDisplay."
@@ -1928,7 +1929,7 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) {
CGDisplayHideCursor(kCGDirectMainDisplay);
}
CGAssociateMouseAndMouseCursorPosition(false);
- WindowData &wd = windows[MAIN_WINDOW_ID];
+ [wd.window_object setMovable:NO];
const NSRect contentRect = [wd.window_view frame];
NSRect pointInWindowRect = NSMakeRect(contentRect.size.width / 2, contentRect.size.height / 2, 0, 0);
NSPoint pointOnScreen = [[wd.window_view window] convertRectToScreen:pointInWindowRect].origin;
@@ -1938,17 +1939,21 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) {
if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
CGDisplayHideCursor(kCGDirectMainDisplay);
}
+ [wd.window_object setMovable:YES];
CGAssociateMouseAndMouseCursorPosition(true);
} else if (p_mode == MOUSE_MODE_CONFINED) {
CGDisplayShowCursor(kCGDirectMainDisplay);
+ [wd.window_object setMovable:NO];
CGAssociateMouseAndMouseCursorPosition(false);
} else if (p_mode == MOUSE_MODE_CONFINED_HIDDEN) {
if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
CGDisplayHideCursor(kCGDirectMainDisplay);
}
+ [wd.window_object setMovable:NO];
CGAssociateMouseAndMouseCursorPosition(false);
} else { // MOUSE_MODE_VISIBLE
CGDisplayShowCursor(kCGDirectMainDisplay);
+ [wd.window_object setMovable:YES];
CGAssociateMouseAndMouseCursorPosition(true);
}