Skip to content

Commit 2f1bfed

Browse files
authored
Workaround for buggy mouse cursor with RDP (#625)
1 parent 0f607cb commit 2f1bfed

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Sources/OvWindowing/src/OvWindowing/Window.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include <stdexcept>
1616

17+
#if defined(_WIN32)
18+
#include <windows.h>
19+
#endif
20+
1721
std::unordered_map<GLFWwindow*, OvWindowing::Window*> OvWindowing::Window::__WINDOWS_MAP;
1822

1923
OvWindowing::Window::Window(const Context::Device& p_device, const Settings::WindowSettings& p_windowSettings) :
@@ -229,6 +233,18 @@ void OvWindowing::Window::SwapBuffers()
229233
void OvWindowing::Window::SetCursorMode(Cursor::ECursorMode p_cursorMode)
230234
{
231235
m_cursorMode = p_cursorMode;
236+
237+
// Workaround to avoid mouse issues with RDP sessions on Windows. (https://github.com/glfw/glfw/issues/2463)
238+
// This effectively disable the DISABLED cursor mode when in a remote session.
239+
// This is far from ideal, but at least it prevents the mouse from going crazy,
240+
// which keeps the application usable.
241+
#if defined(_WIN32)
242+
if (p_cursorMode == Cursor::ECursorMode::DISABLED && GetSystemMetrics(SM_REMOTESESSION))
243+
{
244+
return;
245+
}
246+
#endif
247+
232248
glfwSetInputMode(m_glfwWindow, GLFW_CURSOR, static_cast<int>(p_cursorMode));
233249
}
234250

0 commit comments

Comments
 (0)