diff options
Diffstat (limited to 'src/input_common/helpers/touch_from_buttons.cpp')
| -rw-r--r-- | src/input_common/helpers/touch_from_buttons.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp index 35d60bc90..ece1e3b32 100644 --- a/src/input_common/helpers/touch_from_buttons.cpp +++ b/src/input_common/helpers/touch_from_buttons.cpp | |||
| @@ -14,10 +14,13 @@ public: | |||
| 14 | using Button = std::unique_ptr<Common::Input::InputDevice>; | 14 | using Button = std::unique_ptr<Common::Input::InputDevice>; |
| 15 | TouchFromButtonDevice(Button button_, int touch_id_, float x_, float y_) | 15 | TouchFromButtonDevice(Button button_, int touch_id_, float x_, float y_) |
| 16 | : button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) { | 16 | : button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) { |
| 17 | Common::Input::InputCallback button_up_callback{ | ||
| 18 | [this](Common::Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; | ||
| 19 | last_button_value = false; | 17 | last_button_value = false; |
| 20 | button->SetCallback(button_up_callback); | 18 | button->SetCallback({ |
| 19 | .on_change = | ||
| 20 | [this](const Common::Input::CallbackStatus& callback_) { | ||
| 21 | UpdateButtonStatus(callback_); | ||
| 22 | }, | ||
| 23 | }); | ||
| 21 | button->ForceUpdate(); | 24 | button->ForceUpdate(); |
| 22 | } | 25 | } |
| 23 | 26 | ||
| @@ -47,7 +50,7 @@ public: | |||
| 47 | return status; | 50 | return status; |
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | void UpdateButtonStatus(Common::Input::CallbackStatus button_callback) { | 53 | void UpdateButtonStatus(const Common::Input::CallbackStatus& button_callback) { |
| 51 | const Common::Input::CallbackStatus status{ | 54 | const Common::Input::CallbackStatus status{ |
| 52 | .type = Common::Input::InputType::Touch, | 55 | .type = Common::Input::InputType::Touch, |
| 53 | .touch_status = GetStatus(button_callback.button_status.value), | 56 | .touch_status = GetStatus(button_callback.button_status.value), |