diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-16 10:44:20 -0600 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-04-16 17:48:12 -0600 |
commit | ffd9aa2fc9c1bdb619db6786649830a7c47205bb (patch) | |
tree | c24ed094bbc28d63e71abed40a576016827404b4 /libs | |
parent | cc74c7b7ad440782b8ee5eda51ad350fddc381e1 (diff) |
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
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gtkmm2ext/bindings.cc | 9 |
1 files changed, 7 insertions, 2 deletions
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)); } |