From b92f6480a0b7517666ad139fc81c89033f84830f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 24 Jan 2020 00:06:39 -0600 Subject: InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio. --- Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp index d9642c6264..540a2ec9a8 100644 --- a/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Xlib/XInput2.cpp @@ -212,9 +212,11 @@ void KeyboardMouse::UpdateCursor() XWindowAttributes win_attribs; XGetWindowAttributes(m_display, m_window, &win_attribs); + const auto window_scale = g_controller_interface.GetWindowInputScale(); + // the mouse position as a range from -1 to 1 - m_state.cursor.x = win_x / (float)win_attribs.width * 2 - 1; - m_state.cursor.y = win_y / (float)win_attribs.height * 2 - 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; } void KeyboardMouse::UpdateInput() -- cgit v1.2.3