diff --git a/Sources/OvWindowing/src/OvWindowing/Window.cpp b/Sources/OvWindowing/src/OvWindowing/Window.cpp index 10ff9e6f..4edbc1bb 100644 --- a/Sources/OvWindowing/src/OvWindowing/Window.cpp +++ b/Sources/OvWindowing/src/OvWindowing/Window.cpp @@ -14,6 +14,10 @@ #include +#if defined(_WIN32) +#include +#endif + std::unordered_map OvWindowing::Window::__WINDOWS_MAP; OvWindowing::Window::Window(const Context::Device& p_device, const Settings::WindowSettings& p_windowSettings) : @@ -229,6 +233,18 @@ void OvWindowing::Window::SwapBuffers() void OvWindowing::Window::SetCursorMode(Cursor::ECursorMode p_cursorMode) { m_cursorMode = p_cursorMode; + + // Workaround to avoid mouse issues with RDP sessions on Windows. (https://github.com/glfw/glfw/issues/2463) + // This effectively disable the DISABLED cursor mode when in a remote session. + // This is far from ideal, but at least it prevents the mouse from going crazy, + // which keeps the application usable. +#if defined(_WIN32) + if (p_cursorMode == Cursor::ECursorMode::DISABLED && GetSystemMetrics(SM_REMOTESESSION)) + { + return; + } +#endif + glfwSetInputMode(m_glfwWindow, GLFW_CURSOR, static_cast(p_cursorMode)); }