Merge pull request #39748 from bruvzg/macos_mouse_hide_counter

[macOS] Fix mouse cursor not shown after multiple mode changes.
This commit is contained in:
Rémi Verschelde 2020-06-22 11:21:08 +02:00 committed by GitHub
commit bd85e4ec16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);