From d16244d25e3fae369be62fded72582dae071a1f9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 12 Jan 2026 12:46:14 -0700 Subject: [PATCH] swallow all events in pianoroll automation group if there's no active automation --- gtk2_ardour/pianoroll_midi_view.cc | 11 +++++++++++ gtk2_ardour/pianoroll_midi_view.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gtk2_ardour/pianoroll_midi_view.cc b/gtk2_ardour/pianoroll_midi_view.cc index 27daecac1f..c27fa8fe44 100644 --- a/gtk2_ardour/pianoroll_midi_view.cc +++ b/gtk2_ardour/pianoroll_midi_view.cc @@ -104,6 +104,7 @@ PianorollMidiView::PianorollMidiView (std::shared_ptr mt, _note_group->raise_to_top (); automation_group = new ArdourCanvas::Rectangle (&parent); + automation_group->Event.connect (sigc::mem_fun (*this, &PianorollMidiView::automation_group_event)); CANVAS_DEBUG_NAME (automation_group, "cue automation group"); automation_group->set_fill_color (UIConfiguration::instance().color ("midi automation track fill")); automation_group->set_data ("linemerger", this); @@ -118,6 +119,16 @@ PianorollMidiView::~PianorollMidiView () delete velocity_display; } +bool +PianorollMidiView::automation_group_event (GdkEvent* ev) +{ + if (!active_automation) { + /* Eat the event to prevent the parent seeing it */ + return true; + } + return false; +} + bool PianorollMidiView::midi_canvas_group_event (GdkEvent* ev) { diff --git a/gtk2_ardour/pianoroll_midi_view.h b/gtk2_ardour/pianoroll_midi_view.h index fd167fe303..0f9ed13fa2 100644 --- a/gtk2_ardour/pianoroll_midi_view.h +++ b/gtk2_ardour/pianoroll_midi_view.h @@ -146,6 +146,7 @@ class PianorollMidiView : public MidiView void unset_active_automation (); bool midi_canvas_group_event (GdkEvent*); + bool automation_group_event (GdkEvent*); Gtkmm2ext::Color line_color_for (Evoral::Parameter const &); void reset_width_dependent_items (double pixel_width);