Merge pull request #54876 from bruvzg/no_captured_move
This commit is contained in:
commit
7d2900e1bd
@ -1920,6 +1920,7 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowData &wd = windows[MAIN_WINDOW_ID];
|
||||||
if (p_mode == MOUSE_MODE_CAPTURED) {
|
if (p_mode == MOUSE_MODE_CAPTURED) {
|
||||||
// Apple Docs state that the display parameter is not used.
|
// Apple Docs state that the display parameter is not used.
|
||||||
// "This parameter is not used. By default, you may pass kCGDirectMainDisplay."
|
// "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);
|
CGDisplayHideCursor(kCGDirectMainDisplay);
|
||||||
}
|
}
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
WindowData &wd = windows[MAIN_WINDOW_ID];
|
[wd.window_object setMovable:NO];
|
||||||
const NSRect contentRect = [wd.window_view frame];
|
const NSRect contentRect = [wd.window_view frame];
|
||||||
NSRect pointInWindowRect = NSMakeRect(contentRect.size.width / 2, contentRect.size.height / 2, 0, 0);
|
NSRect pointInWindowRect = NSMakeRect(contentRect.size.width / 2, contentRect.size.height / 2, 0, 0);
|
||||||
NSPoint pointOnScreen = [[wd.window_view window] convertRectToScreen:pointInWindowRect].origin;
|
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) {
|
if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
|
||||||
CGDisplayHideCursor(kCGDirectMainDisplay);
|
CGDisplayHideCursor(kCGDirectMainDisplay);
|
||||||
}
|
}
|
||||||
|
[wd.window_object setMovable:YES];
|
||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
} else if (p_mode == MOUSE_MODE_CONFINED) {
|
} else if (p_mode == MOUSE_MODE_CONFINED) {
|
||||||
CGDisplayShowCursor(kCGDirectMainDisplay);
|
CGDisplayShowCursor(kCGDirectMainDisplay);
|
||||||
|
[wd.window_object setMovable:NO];
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
} else if (p_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
} else if (p_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
||||||
if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
|
if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
|
||||||
CGDisplayHideCursor(kCGDirectMainDisplay);
|
CGDisplayHideCursor(kCGDirectMainDisplay);
|
||||||
}
|
}
|
||||||
|
[wd.window_object setMovable:NO];
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
} else { // MOUSE_MODE_VISIBLE
|
} else { // MOUSE_MODE_VISIBLE
|
||||||
CGDisplayShowCursor(kCGDirectMainDisplay);
|
CGDisplayShowCursor(kCGDirectMainDisplay);
|
||||||
|
[wd.window_object setMovable:YES];
|
||||||
CGAssociateMouseAndMouseCursorPosition(true);
|
CGAssociateMouseAndMouseCursorPosition(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user