summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-03-15 12:39:13 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-03-15 12:41:21 -0400
commitad4ae69a1d365480f7fc10507ac793e7df27c7f3 (patch)
tree2ad542b8c39322105d2267f535c5500bfb17bd43
parent7460bbefb6e69b4f726b6f1324b999790b6ca42a (diff)
when handling a keyboard event, if the current focus widget has ardour bindings attached, use them rather the ones for the main window content tab
-rw-r--r--gtk2_ardour/ardour_ui.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 0916007431..dcad1574bd 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -5283,6 +5283,20 @@ ARDOUR_UI::key_event_handler (GdkEventKey* ev, Gtk::Window* event_window)
return key_press_focus_accelerator_handler (*window, ev, bindings);
}
+static Gtkmm2ext::Bindings*
+get_bindings_from_widget_heirarchy (GtkWidget* w)
+{
+ void* p;
+
+ while (w) {
+ if ((p = g_object_get_data (G_OBJECT(w), "ardour-bindings")) != 0) {
+ break;
+ }
+ }
+
+ return reinterpret_cast<Gtkmm2ext::Bindings*> (p);
+}
+
bool
ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings* bindings)
{
@@ -5303,6 +5317,14 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
*/
special_handling_of_unmodified_accelerators = true;
+
+ } else {
+
+ Gtkmm2ext::Bindings* focus_bindings = get_bindings_from_widget_heirarchy (focus);
+ if (focus_bindings) {
+ bindings = focus_bindings;
+ DEBUG_TRACE (DEBUG::Accelerators, string_compose ("Switch bindings based on focus widget, now using %1\n", bindings->name()));
+ }
}
}
@@ -5361,7 +5383,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
if (bindings) {
- DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tusing Ardour bindings %1 for this event\n", bindings));
+ DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tusing Ardour bindings %1 @ %2 for this event\n", bindings->name(), bindings));
if (bindings->activate (k, Bindings::Press)) {
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");