mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio.
This commit is contained in:
@ -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()
|
||||
|
@ -12,6 +12,7 @@ extern "C" {
|
||||
#include <X11/keysym.h>
|
||||
}
|
||||
|
||||
#include "Common/Matrix.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
namespace ciface::XInput2
|
||||
@ -25,10 +26,8 @@ private:
|
||||
{
|
||||
char keyboard[32];
|
||||
unsigned int buttons;
|
||||
struct
|
||||
{
|
||||
float x, y;
|
||||
} cursor, axis;
|
||||
Common::Vec2 cursor;
|
||||
Common::Vec2 axis;
|
||||
};
|
||||
|
||||
class Key : public Input
|
||||
|
Reference in New Issue
Block a user