diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc index a8b972c671..7e4a397b9f 100644 --- a/libs/widgets/ardour_button.cc +++ b/libs/widgets/ardour_button.cc @@ -1055,19 +1055,29 @@ ArdourButton::on_button_press_event (GdkEventButton *ev) return _fallthrough_to_parent ? false : true; } +bool +ArdourButton::is_led_click (GdkEventButton *ev) +{ + if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) { + if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width && + ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) { + return true; + } + } + + return false; +} + bool ArdourButton::on_button_release_event (GdkEventButton *ev) { if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) { return _fallthrough_to_parent ? false : true; } - if (ev->button == 1 && _hovering && (_elements & Indicator) && _led_rect && _distinct_led_click) { - if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width && - ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) { - std::cerr << "LED click\n"; - signal_led_clicked(ev); /* EMIT SIGNAL */ - return true; - } + + if (is_led_click (ev)) { + signal_led_clicked(ev); /* EMIT SIGNAL */ + return true; } _grabbed = false; diff --git a/libs/widgets/widgets/ardour_button.h b/libs/widgets/widgets/ardour_button.h index 30c1bf7fef..7619ba790a 100644 --- a/libs/widgets/widgets/ardour_button.h +++ b/libs/widgets/widgets/ardour_button.h @@ -117,6 +117,7 @@ class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activ void add_sizing_text (std::string const&); void set_sizing_texts (std::vector const&); + bool is_led_click (GdkEventButton*); sigc::signal signal_led_clicked; sigc::signal signal_clicked;