diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-03-30 18:35:08 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-06-03 11:44:28 -0400 |
commit | 98aa3b669ee3425f40d6c3f3f96217bddf7b7137 (patch) | |
tree | b353029af7e783ff1c7c054e1404a1e12a26facb /platform/osx | |
parent | f288a79482ad5272d872fdc84fdb64a228334d8e (diff) |
Add MOUSE_MODE_CONFINED_HIDDEN
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/display_server_osx.mm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index f53b60891f..408feb4db9 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -884,7 +884,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i return; } - if (DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED) { + if (DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED || DS_OSX->mouse_mode == DisplayServer::MOUSE_MODE_CONFINED_HIDDEN) { // Discard late events if (([event timestamp]) < DS_OSX->last_warp) { return; @@ -2106,7 +2106,12 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) { } else if (p_mode == MOUSE_MODE_CONFINED) { CGDisplayShowCursor(kCGDirectMainDisplay); CGAssociateMouseAndMouseCursorPosition(false); - } else { + } else if (p_mode == MOUSE_MODE_CONFINED_HIDDEN) { + if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) { + CGDisplayHideCursor(kCGDirectMainDisplay); + } + CGAssociateMouseAndMouseCursorPosition(false); + } else { // MOUSE_MODE_VISIBLE CGDisplayShowCursor(kCGDirectMainDisplay); CGAssociateMouseAndMouseCursorPosition(true); } @@ -2143,7 +2148,7 @@ void DisplayServerOSX::mouse_warp_to_position(const Point2i &p_to) { CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0); CGAssociateMouseAndMouseCursorPosition(false); CGWarpMouseCursorPosition(lMouseWarpPos); - if (mouse_mode != MOUSE_MODE_CONFINED) { + if (mouse_mode != MOUSE_MODE_CONFINED && mouse_mode != MOUSE_MODE_CONFINED_HIDDEN) { CGAssociateMouseAndMouseCursorPosition(true); } } |