summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-12-31 23:34:09 -0600
committerTellowKrinkle <tellowkrinkle@gmail.com>2022-12-31 23:42:11 -0600
commit8659de4d713ead782bf4a81a2ab94688b30b9c46 (patch)
tree5447a89178b5e49209f44a9635597acbe973db03 /Source/Core/InputCommon/ControllerInterface
parent20ac2cf781b1c514b4eea47e5da4195d95b5bad8 (diff)
InputCommon:QuartzKB&M: Fix mouse y coordinates
Cocoa uses a different coordinate system from Carbon (Carbon's origin is the top left while Cocoa's is the bottom left)
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
index a610956d93..5ea4ff2624 100644
--- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
+++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm
@@ -259,16 +259,14 @@ void KeyboardAndMouse::UpdateInput()
}
else
{
- CGEventRef event = CGEventCreate(nil);
- CGPoint loc = CGEventGetLocation(event);
- CFRelease(event);
+ NSPoint loc = [NSEvent mouseLocation];
const auto window_scale = g_controller_interface.GetWindowInputScale();
loc.x -= bounds.origin.x;
loc.y -= bounds.origin.y;
m_cursor.x = (loc.x / window_width * 2 - 1.0) * window_scale.x;
- m_cursor.y = (loc.y / window_height * 2 - 1.0) * window_scale.y;
+ m_cursor.y = (loc.y / window_height * 2 - 1.0) * -window_scale.y;
}
}