diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 6 | ||||
-rw-r--r-- | src/input_common/mouse/mouse_input.cpp | 9 | ||||
-rw-r--r-- | src/input_common/mouse/mouse_input.h | 8 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 2 |
5 files changed, 28 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 71545bf1f..69708c79d 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -33,7 +33,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u shared_memory.header.timestamp = core_timing.GetCPUTicks(); shared_memory.header.total_entry_count = 17; - if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { + if (!IsControllerActivated()) { shared_memory.header.entry_count = 0; shared_memory.header.last_entry_index = 0; return; @@ -129,6 +129,10 @@ void Controller_Gesture::OnLoadInputDevices() { } std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const { + // Dont assign any touch input to a point if disabled + if (!Settings::values.touchscreen.enabled) { + return std::nullopt; + } std::size_t first_free_id = 0; while (first_free_id < MAX_POINTS) { if (!fingers[first_free_id].pressed) { diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 8f56a0255..55e3cc014 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -33,7 +33,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin shared_memory.header.timestamp = core_timing.GetCPUTicks(); shared_memory.header.total_entry_count = 17; - if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { + if (!IsControllerActivated()) { shared_memory.header.entry_count = 0; shared_memory.header.last_entry_index = 0; return; @@ -105,6 +105,10 @@ void Controller_Touchscreen::OnLoadInputDevices() { } std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { + // Dont assign any touch input to a finger if disabled + if (!Settings::values.touchscreen.enabled) { + return std::nullopt; + } std::size_t first_free_id = 0; while (first_free_id < MAX_FINGERS) { if (!fingers[first_free_id].pressed) { diff --git a/src/input_common/mouse/mouse_input.cpp b/src/input_common/mouse/mouse_input.cpp index fff1c6b45..a335e6da1 100644 --- a/src/input_common/mouse/mouse_input.cpp +++ b/src/input_common/mouse/mouse_input.cpp @@ -143,6 +143,15 @@ void Mouse::ReleaseButton(MouseButton button_) { mouse_info[button_index].data.axis = {0, 0}; } +void Mouse::ReleaseAllButtons() { + buttons = 0; + for (auto& info : mouse_info) { + info.tilt_speed = 0; + info.data.pressed = false; + info.data.axis = {0, 0}; + } +} + void Mouse::BeginConfiguration() { buttons = 0; last_button = MouseButton::Undefined; diff --git a/src/input_common/mouse/mouse_input.h b/src/input_common/mouse/mouse_input.h index 750d9b011..5a971ad67 100644 --- a/src/input_common/mouse/mouse_input.h +++ b/src/input_common/mouse/mouse_input.h @@ -65,10 +65,16 @@ public: void MouseMove(int x, int y, int center_x, int center_y); /** - * Signals that a motion sensor tilt has ended. + * Signals that a button is released. + * @param button_ the button pressed */ void ReleaseButton(MouseButton button_); + /** + * Signals that all buttons are released + */ + void ReleaseAllButtons(); + [[nodiscard]] bool ToggleButton(std::size_t button_); [[nodiscard]] bool UnlockButton(std::size_t button_); diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 9c7daeac7..7ff9491f4 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -539,6 +539,8 @@ bool GRenderWindow::event(QEvent* event) { void GRenderWindow::focusOutEvent(QFocusEvent* event) { QWidget::focusOutEvent(event); input_subsystem->GetKeyboard()->ReleaseAllKeys(); + input_subsystem->GetMouse()->ReleaseAllButtons(); + this->TouchReleased(0); } void GRenderWindow::resizeEvent(QResizeEvent* event) { |