ArdourButton: if _act_on_release is true, only trigger actions/signal clicks on key release, and vice versa
This should really be split in separate semantics for key and button events. Fixes a subtle but nasty bug in the EngineDialog where the change of the default focus widget from a Gtk::Button (acts on press) to an ArdourButton (acts on release) caused events occuring after a dialog has grabbed focus to trigger button clicks
This commit is contained in:
parent
ac9bc19762
commit
05b0102668
@ -1107,7 +1107,21 @@ ArdourButton::on_focus_out_event (GdkEventFocus* ev)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
ArdourButton::on_key_release_event (GdkEventKey *ev) {
|
ArdourButton::on_key_release_event (GdkEventKey *ev) {
|
||||||
if (_focused &&
|
if (_act_on_release && _focused &&
|
||||||
|
(ev->keyval == GDK_space || ev->keyval == GDK_Return))
|
||||||
|
{
|
||||||
|
signal_clicked();
|
||||||
|
if (_action) {
|
||||||
|
_action->activate ();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return CairoWidget::on_key_release_event (ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ArdourButton::on_key_press_event (GdkEventKey *ev) {
|
||||||
|
if (!_act_on_release && _focused &&
|
||||||
(ev->keyval == GDK_space || ev->keyval == GDK_Return))
|
(ev->keyval == GDK_space || ev->keyval == GDK_Return))
|
||||||
{
|
{
|
||||||
signal_clicked();
|
signal_clicked();
|
||||||
|
@ -139,6 +139,7 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
|
|||||||
bool on_focus_in_event (GdkEventFocus*);
|
bool on_focus_in_event (GdkEventFocus*);
|
||||||
bool on_focus_out_event (GdkEventFocus*);
|
bool on_focus_out_event (GdkEventFocus*);
|
||||||
bool on_key_release_event (GdkEventKey *);
|
bool on_key_release_event (GdkEventKey *);
|
||||||
|
bool on_key_press_event (GdkEventKey *);
|
||||||
|
|
||||||
void controllable_changed ();
|
void controllable_changed ();
|
||||||
PBD::ScopedConnection watch_connection;
|
PBD::ScopedConnection watch_connection;
|
||||||
|
@ -280,6 +280,7 @@ EngineControl::EngineControl ()
|
|||||||
start_stop_button.set_name ("generic button");
|
start_stop_button.set_name ("generic button");
|
||||||
start_stop_button.set_can_focus(true);
|
start_stop_button.set_can_focus(true);
|
||||||
start_stop_button.set_can_default(true);
|
start_stop_button.set_can_default(true);
|
||||||
|
start_stop_button.set_act_on_release (false);
|
||||||
|
|
||||||
update_devices_button.signal_clicked.connect (mem_fun (*this, &EngineControl::update_devices_button_clicked));
|
update_devices_button.signal_clicked.connect (mem_fun (*this, &EngineControl::update_devices_button_clicked));
|
||||||
update_devices_button.set_sensitive (false);
|
update_devices_button.set_sensitive (false);
|
||||||
|
Loading…
Reference in New Issue
Block a user