Explorar el Código

Merge pull request #22188 from guilhermefelipecgs/fix_20177_latest

Fix Input::set_custom_mouse_cursor showing cursor when it's invisible
Rémi Verschelde hace 7 años
padre
commit
ede5f696b6
Se han modificado 3 ficheros con 9 adiciones y 3 borrados
  1. 3 1
      platform/osx/os_osx.mm
  2. 3 1
      platform/windows/os_windows.cpp
  3. 3 1
      platform/x11/os_x11.cpp

+ 3 - 1
platform/osx/os_osx.mm

@@ -1663,7 +1663,9 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
 		cursors[p_shape] = cursor;
 		cursors[p_shape] = cursor;
 
 
 		if (p_shape == cursor_shape) {
 		if (p_shape == cursor_shape) {
-			[cursor set];
+			if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+				[cursor set];
+			}
 		}
 		}
 
 
 		[imgrep release];
 		[imgrep release];

+ 3 - 1
platform/windows/os_windows.cpp

@@ -2312,7 +2312,9 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
 		cursors[p_shape] = CreateIconIndirect(&iconinfo);
 		cursors[p_shape] = CreateIconIndirect(&iconinfo);
 
 
 		if (p_shape == cursor_shape) {
 		if (p_shape == cursor_shape) {
-			SetCursor(cursors[p_shape]);
+			if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+				SetCursor(cursors[p_shape]);
+			}
 		}
 		}
 
 
 		if (hAndMask != NULL) {
 		if (hAndMask != NULL) {

+ 3 - 1
platform/x11/os_x11.cpp

@@ -2607,7 +2607,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
 		cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image);
 		cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image);
 
 
 		if (p_shape == current_cursor) {
 		if (p_shape == current_cursor) {
-			XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+			if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+				XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+			}
 		}
 		}
 
 
 		memfree(cursor_image->pixels);
 		memfree(cursor_image->pixels);