diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-06-22 11:38:22 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-06-22 11:38:43 +0300 |
commit | 7a250b579fb2a95bc1e11eb165b31662efbb4699 (patch) | |
tree | 76984af393fac79d9e637ffffc572cd6fda97a2e | |
parent | 492625db28aaef7be670488f10f1f1053c8620ad (diff) |
macOS, prevent multiple CGDisplayHideCursor calls unpaired with CGDisplayShowCursor.
-rw-r--r-- | platform/osx/display_server_osx.mm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 4a94e09c1c..920fd24c4a 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -1937,10 +1937,14 @@ void DisplayServerOSX::mouse_set_mode(MouseMode p_mode) { // Apple Docs state that the display parameter is not used. // "This parameter is not used. By default, you may pass kCGDirectMainDisplay." // https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/Quartz_Services_Ref/Reference/reference.html - CGDisplayHideCursor(kCGDirectMainDisplay); + if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) { + CGDisplayHideCursor(kCGDirectMainDisplay); + } CGAssociateMouseAndMouseCursorPosition(false); } else if (p_mode == MOUSE_MODE_HIDDEN) { - CGDisplayHideCursor(kCGDirectMainDisplay); + if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) { + CGDisplayHideCursor(kCGDirectMainDisplay); + } CGAssociateMouseAndMouseCursorPosition(true); } else { CGDisplayShowCursor(kCGDirectMainDisplay); |