فهرست منبع

Fixed duplicate ShowCursor() calls after the window closing & reopening.

Lasse Öörni 14 سال پیش
والد
کامیت
06aa3e21a7
3فایلهای تغییر یافته به همراه6 افزوده شده و 8 حذف شده
  1. 0 3
      ThirdParty/GLFW/src/internal.h
  2. 6 4
      ThirdParty/GLFW/src/win32_window.c
  3. 0 1
      ThirdParty/GLFW/src/window.c

+ 0 - 3
ThirdParty/GLFW/src/internal.h

@@ -218,9 +218,6 @@ struct _GLFWwindow
     // These are defined in the current port's platform.h
     _GLFW_PLATFORM_WINDOW_STATE;
     _GLFW_PLATFORM_CONTEXT_STATE;
-    
-    // Mouse cursor visible state; needed on Windows to avoid multiple redundant ShowCursor calls
-    GLboolean mouseCursorVisible;
 };
 
 

+ 6 - 4
ThirdParty/GLFW/src/win32_window.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+// Urho3D: global flag needed to prevent duplicate ShowCursor calls which "stack"
+static GLboolean mouseCursorVisible = GL_TRUE;
 
 //========================================================================
 // Convert BPP to RGB bits based on "best guess"
@@ -491,10 +493,10 @@ static void captureMouseCursor(_GLFWwindow* window)
 {
     RECT ClipWindowRect;
 
-    if (window->mouseCursorVisible == GL_TRUE)
+    if (mouseCursorVisible)
     {
         ShowCursor(FALSE);
-        window->mouseCursorVisible = GL_FALSE;
+        mouseCursorVisible = GL_FALSE;
     }
     
     // Clip cursor to the window
@@ -518,10 +520,10 @@ static void showMouseCursor(_GLFWwindow* window)
     // Release the cursor from the window
     ClipCursor(NULL);
 
-    if (window->mouseCursorVisible == GL_FALSE)
+    if (!mouseCursorVisible)
     {
         ShowCursor(TRUE);
-        window->mouseCursorVisible = GL_TRUE;
+        mouseCursorVisible = GL_TRUE;
     }
 }
 

+ 0 - 1
ThirdParty/GLFW/src/window.c

@@ -312,7 +312,6 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
     window->mode       = mode;
     window->cursorMode = GLFW_CURSOR_NORMAL;
     window->systemKeys = GL_TRUE;
-    window->mouseCursorVisible = GL_TRUE;
     
     // Open the actual window and create its context
     if (!_glfwPlatformOpenWindow(window, &wndconfig, &fbconfig))