summaryrefslogtreecommitdiff
path: root/src/input_common/mouse
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/mouse')
-rw-r--r--src/input_common/mouse/mouse_input.cpp9
-rw-r--r--src/input_common/mouse/mouse_input.h8
2 files changed, 16 insertions, 1 deletions
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
146void 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
146void Mouse::BeginConfiguration() { 155void 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