Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Sources/OvWindowing/src/OvWindowing/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include <stdexcept>

#if defined(_WIN32)
#include <windows.h>
#endif

std::unordered_map<GLFWwindow*, OvWindowing::Window*> OvWindowing::Window::__WINDOWS_MAP;

OvWindowing::Window::Window(const Context::Device& p_device, const Settings::WindowSettings& p_windowSettings) :
Expand Down Expand Up @@ -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<int>(p_cursorMode));
}

Expand Down