diff options
Diffstat (limited to 'src')
| -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 | |||
| 33 | shared_memory.header.timestamp = core_timing.GetCPUTicks(); | 33 | shared_memory.header.timestamp = core_timing.GetCPUTicks(); |
| 34 | shared_memory.header.total_entry_count = 17; | 34 | shared_memory.header.total_entry_count = 17; |
| 35 | 35 | ||
| 36 | if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { | 36 | if (!IsControllerActivated()) { |
| 37 | shared_memory.header.entry_count = 0; | 37 | shared_memory.header.entry_count = 0; |
| 38 | shared_memory.header.last_entry_index = 0; | 38 | shared_memory.header.last_entry_index = 0; |
| 39 | return; | 39 | return; |
| @@ -129,6 +129,10 @@ void Controller_Gesture::OnLoadInputDevices() { | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const { | 131 | std::optional<std::size_t> Controller_Gesture::GetUnusedFingerID() const { |
| 132 | // Dont assign any touch input to a point if disabled | ||
| 133 | if (!Settings::values.touchscreen.enabled) { | ||
| 134 | return std::nullopt; | ||
| 135 | } | ||
| 132 | std::size_t first_free_id = 0; | 136 | std::size_t first_free_id = 0; |
| 133 | while (first_free_id < MAX_POINTS) { | 137 | while (first_free_id < MAX_POINTS) { |
| 134 | if (!fingers[first_free_id].pressed) { | 138 | 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 | |||
| 33 | shared_memory.header.timestamp = core_timing.GetCPUTicks(); | 33 | shared_memory.header.timestamp = core_timing.GetCPUTicks(); |
| 34 | shared_memory.header.total_entry_count = 17; | 34 | shared_memory.header.total_entry_count = 17; |
| 35 | 35 | ||
| 36 | if (!IsControllerActivated() || !Settings::values.touchscreen.enabled) { | 36 | if (!IsControllerActivated()) { |
| 37 | shared_memory.header.entry_count = 0; | 37 | shared_memory.header.entry_count = 0; |
| 38 | shared_memory.header.last_entry_index = 0; | 38 | shared_memory.header.last_entry_index = 0; |
| 39 | return; | 39 | return; |
| @@ -105,6 +105,10 @@ void Controller_Touchscreen::OnLoadInputDevices() { | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { | 107 | std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { |
| 108 | // Dont assign any touch input to a finger if disabled | ||
| 109 | if (!Settings::values.touchscreen.enabled) { | ||
| 110 | return std::nullopt; | ||
| 111 | } | ||
| 108 | std::size_t first_free_id = 0; | 112 | std::size_t first_free_id = 0; |
| 109 | while (first_free_id < MAX_FINGERS) { | 113 | while (first_free_id < MAX_FINGERS) { |
| 110 | if (!fingers[first_free_id].pressed) { | 114 | 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_) { | |||
| 143 | mouse_info[button_index].data.axis = {0, 0}; | 143 | mouse_info[button_index].data.axis = {0, 0}; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | void Mouse::ReleaseAllButtons() { | ||
| 147 | buttons = 0; | ||
| 148 | for (auto& info : mouse_info) { | ||
| 149 | info.tilt_speed = 0; | ||
| 150 | info.data.pressed = false; | ||
| 151 | info.data.axis = {0, 0}; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | |||
| 146 | void Mouse::BeginConfiguration() { | 155 | void Mouse::BeginConfiguration() { |
| 147 | buttons = 0; | 156 | buttons = 0; |
| 148 | last_button = MouseButton::Undefined; | 157 | 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: | |||
| 65 | void MouseMove(int x, int y, int center_x, int center_y); | 65 | void MouseMove(int x, int y, int center_x, int center_y); |
| 66 | 66 | ||
| 67 | /** | 67 | /** |
| 68 | * Signals that a motion sensor tilt has ended. | 68 | * Signals that a button is released. |
| 69 | * @param button_ the button pressed | ||
| 69 | */ | 70 | */ |
| 70 | void ReleaseButton(MouseButton button_); | 71 | void ReleaseButton(MouseButton button_); |
| 71 | 72 | ||
| 73 | /** | ||
| 74 | * Signals that all buttons are released | ||
| 75 | */ | ||
| 76 | void ReleaseAllButtons(); | ||
| 77 | |||
| 72 | [[nodiscard]] bool ToggleButton(std::size_t button_); | 78 | [[nodiscard]] bool ToggleButton(std::size_t button_); |
| 73 | [[nodiscard]] bool UnlockButton(std::size_t button_); | 79 | [[nodiscard]] bool UnlockButton(std::size_t button_); |
| 74 | 80 | ||
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) { | |||
| 539 | void GRenderWindow::focusOutEvent(QFocusEvent* event) { | 539 | void GRenderWindow::focusOutEvent(QFocusEvent* event) { |
| 540 | QWidget::focusOutEvent(event); | 540 | QWidget::focusOutEvent(event); |
| 541 | input_subsystem->GetKeyboard()->ReleaseAllKeys(); | 541 | input_subsystem->GetKeyboard()->ReleaseAllKeys(); |
| 542 | input_subsystem->GetMouse()->ReleaseAllButtons(); | ||
| 543 | this->TouchReleased(0); | ||
| 542 | } | 544 | } |
| 543 | 545 | ||
| 544 | void GRenderWindow::resizeEvent(QResizeEvent* event) { | 546 | void GRenderWindow::resizeEvent(QResizeEvent* event) { |