summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/touch_from_buttons.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-02 02:49:14 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:27 +0100
commit136eb9c4c2b2425c2dd45a79cf444dee7170714d (patch)
tree74a055a08126fdd33b2071baa08125177847db6e /src/input_common/helpers/touch_from_buttons.cpp
parentsecond commit lion review (diff)
downloadyuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.gz
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.bz2
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.lz
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.xz
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.tar.zst
yuzu-136eb9c4c2b2425c2dd45a79cf444dee7170714d.zip
Diffstat (limited to 'src/input_common/helpers/touch_from_buttons.cpp')
-rw-r--r--src/input_common/helpers/touch_from_buttons.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp
index 024343715..35d60bc90 100644
--- a/src/input_common/helpers/touch_from_buttons.cpp
+++ b/src/input_common/helpers/touch_from_buttons.cpp
@@ -16,10 +16,15 @@ public:
: button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) {
Common::Input::InputCallback button_up_callback{
[this](Common::Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }};
+ last_button_value = false;
button->SetCallback(button_up_callback);
button->ForceUpdate();
}
+ void ForceUpdate() override {
+ button->ForceUpdate();
+ }
+
Common::Input::TouchStatus GetStatus(bool pressed) const {
const Common::Input::ButtonStatus button_status{
.value = pressed,
@@ -47,11 +52,15 @@ public:
.type = Common::Input::InputType::Touch,
.touch_status = GetStatus(button_callback.button_status.value),
};
- TriggerOnChange(status);
+ if (last_button_value != button_callback.button_status.value) {
+ last_button_value = button_callback.button_status.value;
+ TriggerOnChange(status);
+ }
}
private:
Button button;
+ bool last_button_value;
const int touch_id;
const float x;
const float y;