diff options
| author | 2021-01-10 08:36:31 -0600 | |
|---|---|---|
| committer | 2021-01-15 09:05:17 -0600 | |
| commit | b483f2d010bf745ab873e8f8bfaca5515e56d39f (patch) | |
| tree | d14bc19b4ca1c60460a941db612195be12f16b0d /src/core | |
| parent | Add mutitouch support for touch screens (diff) | |
| download | yuzu-b483f2d010bf745ab873e8f8bfaca5515e56d39f.tar.gz yuzu-b483f2d010bf745ab873e8f8bfaca5515e56d39f.tar.xz yuzu-b483f2d010bf745ab873e8f8bfaca5515e56d39f.zip | |
Always initialize keyboard input
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/frontend/emu_window.cpp | 5 | ||||
| -rw-r--r-- | src/core/frontend/emu_window.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 6 |
3 files changed, 8 insertions, 12 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index af6c1633a..ee7a58b1c 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp | |||
| @@ -28,12 +28,11 @@ private: | |||
| 28 | public: | 28 | public: |
| 29 | explicit Device(std::weak_ptr<TouchState>&& touch_state) : touch_state(touch_state) {} | 29 | explicit Device(std::weak_ptr<TouchState>&& touch_state) : touch_state(touch_state) {} |
| 30 | Input::TouchStatus GetStatus() const override { | 30 | Input::TouchStatus GetStatus() const override { |
| 31 | Input::TouchStatus touch_status{}; | ||
| 32 | if (auto state = touch_state.lock()) { | 31 | if (auto state = touch_state.lock()) { |
| 33 | std::lock_guard guard{state->mutex}; | 32 | std::lock_guard guard{state->mutex}; |
| 34 | touch_status = state->status; | 33 | return state->status; |
| 35 | } | 34 | } |
| 36 | return touch_status; | 35 | return {}; |
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | private: | 38 | private: |
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index f8db42ab4..2436c6580 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h | |||
| @@ -117,12 +117,13 @@ public: | |||
| 117 | * Signal that a touch pressed event has occurred (e.g. mouse click pressed) | 117 | * Signal that a touch pressed event has occurred (e.g. mouse click pressed) |
| 118 | * @param framebuffer_x Framebuffer x-coordinate that was pressed | 118 | * @param framebuffer_x Framebuffer x-coordinate that was pressed |
| 119 | * @param framebuffer_y Framebuffer y-coordinate that was pressed | 119 | * @param framebuffer_y Framebuffer y-coordinate that was pressed |
| 120 | * @param id Touch event id | 120 | * @param id Touch event ID |
| 121 | */ | 121 | */ |
| 122 | void TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); | 122 | void TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); |
| 123 | 123 | ||
| 124 | /** Signal that a touch released event has occurred (e.g. mouse click released) | 124 | /** |
| 125 | *@param id Touch event id | 125 | * Signal that a touch released event has occurred (e.g. mouse click released) |
| 126 | * @param id Touch event ID | ||
| 126 | */ | 127 | */ |
| 127 | void TouchReleased(std::size_t id); | 128 | void TouchReleased(std::size_t id); |
| 128 | 129 | ||
| @@ -130,7 +131,7 @@ public: | |||
| 130 | * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) | 131 | * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) |
| 131 | * @param framebuffer_x Framebuffer x-coordinate | 132 | * @param framebuffer_x Framebuffer x-coordinate |
| 132 | * @param framebuffer_y Framebuffer y-coordinate | 133 | * @param framebuffer_y Framebuffer y-coordinate |
| 133 | * @param id Touch event id | 134 | * @param id Touch event ID |
| 134 | */ | 135 | */ |
| 135 | void TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); | 136 | void TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id); |
| 136 | 137 | ||
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index cd318f25b..5219f2dad 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -100,11 +100,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 100 | void Controller_Touchscreen::OnLoadInputDevices() { | 100 | void Controller_Touchscreen::OnLoadInputDevices() { |
| 101 | touch_mouse_device = Input::CreateDevice<Input::TouchDevice>("engine:emu_window"); | 101 | touch_mouse_device = Input::CreateDevice<Input::TouchDevice>("engine:emu_window"); |
| 102 | touch_udp_device = Input::CreateDevice<Input::TouchDevice>("engine:cemuhookudp"); | 102 | touch_udp_device = Input::CreateDevice<Input::TouchDevice>("engine:cemuhookudp"); |
| 103 | if (Settings::values.use_touch_from_button) { | 103 | touch_btn_device = Input::CreateDevice<Input::TouchDevice>("engine:touch_from_button"); |
| 104 | touch_btn_device = Input::CreateDevice<Input::TouchDevice>("engine:touch_from_button"); | ||
| 105 | } else { | ||
| 106 | touch_btn_device.reset(); | ||
| 107 | } | ||
| 108 | } | 104 | } |
| 109 | 105 | ||
| 110 | std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { | 106 | std::optional<std::size_t> Controller_Touchscreen::GetUnusedFingerID() const { |