From 5a5c815ff037b4520d2ef90581b080d5d78e4b4f Mon Sep 17 00:00:00 2001 From: Filippo Tarpini Date: Sat, 2 Jan 2021 18:33:13 +0200 Subject: [PATCH] Fix DInput cursor going to +infinite if the window size was 0 --- .../ControllerInterface/DInput/DInputKeyboardMouse.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp index 5aca9f5280..e5e10802cc 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp @@ -126,9 +126,9 @@ void KeyboardMouse::UpdateCursorInput() RECT rect; GetClientRect(m_hwnd, &rect); - // Width and height are the size of the rendering window. - const auto win_width = rect.right - rect.left; - const auto win_height = rect.bottom - rect.top; + // Width and height are the size of the rendering window. They could be 0 + const auto win_width = std::max(rect.right - rect.left, 1l); + const auto win_height = std::max(rect.bottom - rect.top, 1l); const auto window_scale = g_controller_interface.GetWindowInputScale();