summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-10-17 13:30:15 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-10-17 13:30:15 -0400
commita127cb35b5b2c01414e677b665843ef94fb7e35f (patch)
tree029b04bc081d0e2d84d3b08bb4ac64edf6a27bda /gtk2_ardour/ardour_ui.cc
parent9a3c1dbfe713e9d1b09f0af838d10e8e586b477c (diff)
propagate key press events through the widget heirarchy + custom ardour bindings, not just focus widget-then-global bindings
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r--gtk2_ardour/ardour_ui.cc36
1 files changed, 29 insertions, 7 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 62043ead74..8c2ec76053 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -5574,15 +5574,15 @@ ARDOUR_UI::key_event_handler (GdkEventKey* ev, Gtk::Window* event_window)
}
static Gtkmm2ext::Bindings*
-get_bindings_from_widget_heirarchy (GtkWidget* w)
+get_bindings_from_widget_heirarchy (GtkWidget** w)
{
void* p = NULL;
- while (w) {
- if ((p = g_object_get_data (G_OBJECT(w), "ardour-bindings")) != 0) {
+ while (*w) {
+ if ((p = g_object_get_data (G_OBJECT(*w), "ardour-bindings")) != 0) {
break;
}
- w = gtk_widget_get_parent (w);
+ *w = gtk_widget_get_parent (*w);
}
return reinterpret_cast<Gtkmm2ext::Bindings*> (p);
@@ -5593,6 +5593,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
{
GtkWindow* win = window.gobj();
GtkWidget* focus = gtk_window_get_focus (win);
+ GtkWidget* binding_widget = focus;
bool special_handling_of_unmodified_accelerators = false;
const guint mask = (Keyboard::RelevantModifierKeyMask & ~(Gdk::SHIFT_MASK|Gdk::LOCK_MASK));
@@ -5611,7 +5612,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
} else {
- Gtkmm2ext::Bindings* focus_bindings = get_bindings_from_widget_heirarchy (focus);
+ Gtkmm2ext::Bindings* focus_bindings = get_bindings_from_widget_heirarchy (&binding_widget);
if (focus_bindings) {
bindings = focus_bindings;
DEBUG_TRACE (DEBUG::Accelerators, string_compose ("Switch bindings based on focus widget, now using %1\n", bindings->name()));
@@ -5673,7 +5674,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
DEBUG_TRACE (DEBUG::Accelerators, "\tsending to window\n");
KeyboardKey k (ev->state, ev->keyval);
- if (bindings) {
+ while (bindings) {
DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tusing Ardour bindings %1 @ %2 for this event\n", bindings->name(), bindings));
@@ -5681,6 +5682,17 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
DEBUG_TRACE (DEBUG::Accelerators, "\t\thandled\n");
return true;
}
+
+ if (binding_widget) {
+ binding_widget = gtk_widget_get_parent (binding_widget);
+ if (binding_widget) {
+ bindings = get_bindings_from_widget_heirarchy (&binding_widget);
+ } else {
+ bindings = 0;
+ }
+ } else {
+ bindings = 0;
+ }
}
DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n");
@@ -5711,7 +5723,7 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
DEBUG_TRACE (DEBUG::Accelerators, "\tpropagation didn't handle, so activate\n");
KeyboardKey k (ev->state, ev->keyval);
- if (bindings) {
+ while (bindings) {
DEBUG_TRACE (DEBUG::Accelerators, "\tusing Ardour bindings for this window\n");
@@ -5721,6 +5733,16 @@ ARDOUR_UI::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey
return true;
}
+ if (binding_widget) {
+ binding_widget = gtk_widget_get_parent (binding_widget);
+ if (binding_widget) {
+ bindings = get_bindings_from_widget_heirarchy (&binding_widget);
+ } else {
+ bindings = 0;
+ }
+ } else {
+ bindings = 0;
+ }
}
DEBUG_TRACE (DEBUG::Accelerators, "\tnot yet handled, try global bindings\n");