diff --git a/glfw/glfw3.h b/glfw/glfw3.h index 116927990..714909818 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -4009,8 +4009,8 @@ GLFWAPI int glfwGetKey(GLFWwindow* window, int key); * `GLFW_RELEASE`. * * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function - * `GLFW_PRESS` the first time you call it for a mouse button that was pressed, - * even if that mouse button has already been released. + * returns `GLFW_PRESS` the first time you call it for a mouse button that was + * pressed, even if that mouse button has already been released. * * @param[in] window The desired window. * @param[in] button The desired [mouse button](@ref buttons). @@ -4807,6 +4807,8 @@ GLFWAPI const char* glfwGetGamepadName(int jid); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_INVALID_ENUM. * + * @thread_safety This function must only be called from the main thread. + * * @sa @ref gamepad * @sa @ref glfwUpdateGamepadMappings * @sa @ref glfwJoystickIsGamepad diff --git a/glfw/win32_platform.h b/glfw/win32_platform.h index 598151468..50b57441b 100644 --- a/glfw/win32_platform.h +++ b/glfw/win32_platform.h @@ -142,6 +142,9 @@ typedef enum // HACK: Define versionhelpers.h functions manually as MinGW lacks the header BOOL IsWindowsVersionOrGreater(WORD major, WORD minor, WORD sp); +#define IsWindowsXPOrGreater() \ + IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), \ + LOBYTE(_WIN32_WINNT_WINXP), 0) #define IsWindowsVistaOrGreater() \ IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), \ LOBYTE(_WIN32_WINNT_VISTA), 0) @@ -300,6 +303,7 @@ typedef struct _GLFWlibraryWin32 _GLFWwindow* disabledCursorWindow; RAWINPUT* rawInput; int rawInputSize; + UINT mouseTrailSize; struct { HINSTANCE instance; diff --git a/glfw/win32_window.c b/glfw/win32_window.c index a4bda1ebc..20bca7581 100644 --- a/glfw/win32_window.c +++ b/glfw/win32_window.c @@ -529,7 +529,18 @@ static void fitToMonitor(_GLFWwindow* window) static void acquireMonitor(_GLFWwindow* window) { if (!_glfw.win32.acquiredMonitorCount) + { SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); + + // HACK: When mouse trails are enabled the cursor becomes invisible when + // the OpenGL ICD switches to page flipping + if (IsWindowsXPOrGreater()) + { + SystemParametersInfo(SPI_GETMOUSETRAILS, 0, &_glfw.win32.mouseTrailSize, 0); + SystemParametersInfo(SPI_SETMOUSETRAILS, 0, 0, 0); + } + } + if (!window->monitor->window) _glfw.win32.acquiredMonitorCount++; @@ -546,8 +557,14 @@ static void releaseMonitor(_GLFWwindow* window) _glfw.win32.acquiredMonitorCount--; if (!_glfw.win32.acquiredMonitorCount) + { SetThreadExecutionState(ES_CONTINUOUS); + // HACK: Restore mouse trail length saved in acquireMonitor + if (IsWindowsXPOrGreater()) + SystemParametersInfo(SPI_SETMOUSETRAILS, _glfw.win32.mouseTrailSize, 0, 0); + } + _glfwInputMonitorWindow(window->monitor, NULL); _glfwRestoreVideoModeWin32(window->monitor); } diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index 7bf8ca427..d80919723 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -1160,7 +1160,9 @@ typedef void (* GLFWscrollfun)(GLFWwindow*,double,double); * @param[in] mods Bit field describing which [modifier keys](@ref mods) were * held down. * @param[in] text UTF-8 encoded text generated by this key event or empty string. - * @param[in] reserved Reserved for future use. + * @param[in] Used for Input Method events. Zero for normal key events. + * A value of 1 means the pre-edit text for the input event has been changed. + * A value of 2 means the text should be committed. * * @note On X11/Wayland if a modifier other than the modifiers GLFW reports * (ctrl/shift/alt/super) is used, GLFW will report the shifted key rather