diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/Quartz')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h | 6 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h index 902621cddc..5d3ea86f3e 100644 --- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h +++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h @@ -6,6 +6,7 @@ #include <QuartzCore/QuartzCore.h> +#include "Common/Matrix.h" #include "InputCommon/ControllerInterface/Device.h" namespace ciface::Quartz @@ -64,10 +65,7 @@ public: std::string GetSource() const override; private: - struct - { - float x, y; - } m_cursor; + Common::Vec2 m_cursor; uint32_t m_windowid; }; diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm index 6cbc0a3f11..7c4673acd7 100644 --- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm +++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm @@ -9,6 +9,8 @@ #include <Carbon/Carbon.h> #include <Cocoa/Cocoa.h> +#include "InputCommon/ControllerInterface/ControllerInterface.h" + namespace ciface::Quartz { std::string KeycodeToName(const CGKeyCode keycode) @@ -177,10 +179,12 @@ void KeyboardAndMouse::UpdateInput() CGPoint loc = CGEventGetLocation(event); CFRelease(event); + const auto window_scale = g_controller_interface.GetWindowInputScale(); + loc.x -= bounds.origin.x; loc.y -= bounds.origin.y; - m_cursor.x = loc.x / bounds.size.width * 2 - 1.0; - m_cursor.y = loc.y / bounds.size.height * 2 - 1.0; + m_cursor.x = (loc.x / bounds.size.width * 2 - 1.0) * window_scale.x; + m_cursor.y = (loc.y / bounds.size.height * 2 - 1.0) * window_scale.y; } std::string KeyboardAndMouse::GetName() const |
