Allow touch to tigger act-on-release events

This commit is contained in:
Robin Gareus 2025-04-10 18:26:23 +02:00
parent 8eab71fef4
commit 7e8230c3be
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 8 additions and 3 deletions

View file

@ -27,6 +27,7 @@
#include "pbd/compose.h" #include "pbd/compose.h"
#include "pbd/controllable.h" #include "pbd/controllable.h"
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/unwind.h"
#include "gtkmm2ext/colors.h" #include "gtkmm2ext/colors.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
@ -92,6 +93,7 @@ ArdourButton::ArdourButton (Element e, bool toggle)
, _led_left (false) , _led_left (false)
, _distinct_led_click (false) , _distinct_led_click (false)
, _hovering (false) , _hovering (false)
, _touching (false)
, _focused (false) , _focused (false)
, _fixed_colors_set (false) , _fixed_colors_set (false)
, _fallthrough_to_parent (false) , _fallthrough_to_parent (false)
@ -142,6 +144,7 @@ ArdourButton::ArdourButton (const std::string& str, Element e, bool toggle)
, _led_left (false) , _led_left (false)
, _distinct_led_click (false) , _distinct_led_click (false)
, _hovering (false) , _hovering (false)
, _touching (false)
, _focused (false) , _focused (false)
, _fixed_colors_set (false) , _fixed_colors_set (false)
, _fallthrough_to_parent (false) , _fallthrough_to_parent (false)
@ -989,7 +992,8 @@ ArdourButton::on_touch_begin_event (GdkEventTouch *ev)
bev.state = 0; bev.state = 0;
bev.axes = NULL; bev.axes = NULL;
bev.device = NULL; bev.device = NULL;
_hovering = true; _touching = true;
PBD::Unwinder<bool> uw (_hovering, true);
return event ((GdkEvent*)&bev); return event ((GdkEvent*)&bev);
} }
@ -1011,8 +1015,8 @@ ArdourButton::on_touch_end_event (GdkEventTouch *ev)
bev.state = 0; bev.state = 0;
bev.axes = NULL; bev.axes = NULL;
bev.device = NULL; bev.device = NULL;
PBD::Unwinder<bool> uw (_hovering, _touching);
_hovering = false; _touching = false;
return event ((GdkEvent*)&bev); return event ((GdkEvent*)&bev);
} }

View file

@ -219,6 +219,7 @@ class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activ
bool _led_left; bool _led_left;
bool _distinct_led_click; bool _distinct_led_click;
bool _hovering; bool _hovering;
bool _touching;
bool _focused; bool _focused;
int _fixed_colors_set; int _fixed_colors_set;
bool _fallthrough_to_parent; bool _fallthrough_to_parent;