From e2675e946259a35ca1dc9c639e2fd5c379994555 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 22 Jun 2020 11:38:22 +0300 Subject: [PATCH] macOS, prevent multiple CGDisplayHideCursor calls unpaired with CGDisplayShowCursor. (cherry picked from commit 7a250b579fb2a95bc1e11eb165b31662efbb4699) --- platform/osx/os_osx.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 180ae4cabd6..d183a759ee1 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -3072,10 +3072,14 @@ void OS_OSX::set_mouse_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);