diff options
| author | Filippo Tarpini <filippotarpini@hotmail.it> | 2021-01-02 18:30:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-02 18:30:14 +0200 |
| commit | 75f35393c33a06dda4b92f22d9634a92142145f3 (patch) | |
| tree | 0931cd0928bbac97d7efbab41918ea84e9351cea /Source/Core/InputCommon/ControllerInterface/Xlib | |
| parent | f06e9c55c802f20ad144d936c597f2d532f6b048 (diff) | |
Fix XInput2 cursor going to +infinite if the window size was 0
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Xlib')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index dac0c085fa..a60edc3282 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -227,8 +227,8 @@ void KeyboardMouse::UpdateCursor() const auto window_scale = g_controller_interface.GetWindowInputScale(); // the mouse position as a range from -1 to 1 - m_state.cursor.x = (win_x / win_attribs.width * 2 - 1) * window_scale.x; - m_state.cursor.y = (win_y / win_attribs.height * 2 - 1) * window_scale.y; + m_state.cursor.x = (win_x / std::max(win_attribs.width, 1) * 2 - 1) * window_scale.x; + m_state.cursor.y = (win_y / std::max(win_attribs.height, 1) * 2 - 1) * window_scale.y; } void KeyboardMouse::UpdateInput() |
