diff options
author | german77 <juangerman-13@hotmail.com> | 2021-02-24 03:39:02 +0100 |
---|---|---|
committer | german <german@thesoftwareartisans.com> | 2021-02-28 00:53:10 +0100 |
commit | 4738e14cb052a44c53e47379e595f00cef034dca (patch) | |
tree | 4264dd4e9d4a750951d1581241c484513c89b571 /src/input_common | |
parent | Merge pull request #5944 from Morph1984/gc-vibrations (diff) | |
download | yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar.gz yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar.bz2 yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar.lz yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar.xz yuzu-4738e14cb052a44c53e47379e595f00cef034dca.tar.zst yuzu-4738e14cb052a44c53e47379e595f00cef034dca.zip |
Diffstat (limited to 'src/input_common')
-rw-r--r-- | src/input_common/mouse/mouse_input.cpp | 11 | ||||
-rw-r--r-- | src/input_common/mouse/mouse_input.h | 12 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/input_common/mouse/mouse_input.cpp b/src/input_common/mouse/mouse_input.cpp index b864d26f2..d81e790ee 100644 --- a/src/input_common/mouse/mouse_input.cpp +++ b/src/input_common/mouse/mouse_input.cpp @@ -59,7 +59,7 @@ void Mouse::UpdateYuzuSettings() { }); } -void Mouse::PressButton(int x, int y, int button_) { +void Mouse::PressButton(int x, int y, MouseButton button_) { const auto button_index = static_cast<std::size_t>(button_); if (button_index >= mouse_info.size()) { return; @@ -67,7 +67,7 @@ void Mouse::PressButton(int x, int y, int button_) { const auto button = 1U << button_index; buttons |= static_cast<u16>(button); - last_button = static_cast<MouseButton>(button_index); + last_button = button_; mouse_info[button_index].mouse_origin = Common::MakeVec(x, y); mouse_info[button_index].last_mouse_position = Common::MakeVec(x, y); @@ -129,7 +129,7 @@ void Mouse::MouseMove(int x, int y, int center_x, int center_y) { } } -void Mouse::ReleaseButton(int button_) { +void Mouse::ReleaseButton(MouseButton button_) { const auto button_index = static_cast<std::size_t>(button_); if (button_index >= mouse_info.size()) { return; @@ -152,6 +152,11 @@ void Mouse::BeginConfiguration() { void Mouse::EndConfiguration() { buttons = 0; + for (MouseInfo& info : mouse_info) { + info.tilt_speed = 0; + info.data.pressed = false; + info.data.axis = {0, 0}; + } last_button = MouseButton::Undefined; mouse_queue.Clear(); configuring = false; diff --git a/src/input_common/mouse/mouse_input.h b/src/input_common/mouse/mouse_input.h index 46aa676c1..3622fe080 100644 --- a/src/input_common/mouse/mouse_input.h +++ b/src/input_common/mouse/mouse_input.h @@ -18,10 +18,12 @@ namespace MouseInput { enum class MouseButton { Left, - Wheel, Right, - Forward, + Wheel, Backward, + Forward, + Task, + Extra, Undefined, }; @@ -51,7 +53,7 @@ public: * @param y the y-coordinate of the cursor * @param button_ the button pressed */ - void PressButton(int x, int y, int button_); + void PressButton(int x, int y, MouseButton button_); /** * Signals that mouse has moved. @@ -65,7 +67,7 @@ public: /** * Signals that a motion sensor tilt has ended. */ - void ReleaseButton(int button_); + void ReleaseButton(MouseButton button_); [[nodiscard]] Common::SPSCQueue<MouseStatus>& GetMouseQueue(); [[nodiscard]] const Common::SPSCQueue<MouseStatus>& GetMouseQueue() const; @@ -94,7 +96,7 @@ private: u16 buttons{}; std::thread update_thread; MouseButton last_button{MouseButton::Undefined}; - std::array<MouseInfo, 5> mouse_info; + std::array<MouseInfo, 7> mouse_info; Common::SPSCQueue<MouseStatus> mouse_queue; bool configuring{false}; bool update_thread_running{true}; |