From ffd9aa2fc9c1bdb619db6786649830a7c47205bb Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 16 Apr 2020 10:44:20 -0600 Subject: if the action associated with a binding is insensitive, do not activate it, and return false from Bindings::activate() This allows "stacking" of bindings by desensitizing the actions associated with a "lower" level of bindings at certain times (e.g. MIDI editing bindings thare are sensitized in the appropriate editing modes --- libs/gtkmm2ext/bindings.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libs') diff --git a/libs/gtkmm2ext/bindings.cc b/libs/gtkmm2ext/bindings.cc index b460b6a5c4..3bf927df9d 100644 --- a/libs/gtkmm2ext/bindings.cc +++ b/libs/gtkmm2ext/bindings.cc @@ -494,8 +494,13 @@ Bindings::activate (KeyboardKey kb, Operation op) if (action) { /* lets do it ... */ - DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", unshifted, k->second.action_name)); - action->activate (); + if (action->get_sensitive()) { + DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", unshifted, k->second.action_name)); + action->activate (); + } else { + DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2 - insensitive, skipped\n", unshifted, k->second.action_name)); + return false; + } } else { DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1 is known but has no action\n", unshifted)); } -- cgit v1.2.3