summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
diff options
context:
space:
mode:
authorLC <mathew1800@gmail.com>2021-01-03 11:26:11 -0500
committerGitHub <noreply@github.com>2021-01-03 11:26:11 -0500
commit4b9259d6913e582156e9d1147ece4fa646709e58 (patch)
tree7d7b616d57ac0dcdd50b761c86e401747df3a3d8 /Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
parentf477a10e65febd146746b02b723d62bdfe576342 (diff)
parent8813ba69f5594180923cb2e2699ecd270a9cbd71 (diff)
Merge pull request #9415 from Filoppi/patch-8
Fix cursor going to +infinite if the window size was 0
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp6
1 files 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();