From e456bef163c1b667ff5a045a4bda66b30326ae90 Mon Sep 17 00:00:00 2001 From: Filoppi Date: Wed, 24 May 2023 22:58:30 +0300 Subject: Input: Improve Controller Interface devices threading This specific issue was already addressed by https://github.com/dolphin-emu/dolphin/pull/11635 though I felt like there was something more we could do, and wasn't too happy with the likelihood of devices update calls being skipped (due to `m_devices_population_mutex` being locked). --- .../InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h | 2 +- .../InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/Quartz') diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h index e4bdb6e5fb..07292f9039 100644 --- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h +++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.h @@ -62,7 +62,7 @@ private: }; public: - void UpdateInput() override; + Core::DeviceRemoval UpdateInput() override; explicit KeyboardAndMouse(void* view); ~KeyboardAndMouse() override; diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm index 5ea4ff2624..e41c370edf 100644 --- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm +++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm @@ -236,7 +236,7 @@ void KeyboardAndMouse::MainThreadInitialization(void* view) m_window_pos_observer = [[DolWindowPositionObserver alloc] initWithView:cocoa_view]; } -void KeyboardAndMouse::UpdateInput() +Core::DeviceRemoval KeyboardAndMouse::UpdateInput() { NSRect bounds = [m_window_pos_observer frame]; @@ -268,6 +268,8 @@ void KeyboardAndMouse::UpdateInput() 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; } + + return Core::DeviceRemoval::Keep; } std::string KeyboardAndMouse::GetName() const -- cgit v1.2.3