summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-10-29 22:27:29 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-10-29 22:27:29 +0000
commit1127dcdb9abc5ce4e28f2557306a237ea867dab7 (patch)
tree8941fddf4dfe0659e7405730ce1d959c3fb5c82c /gtk2_ardour/utils.cc
parentc528d174e8e22e3cf57a6fe2400208d76c0bee07 (diff)
fix up key focus handling for plugin windows
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4031 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc65
1 files changed, 36 insertions, 29 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index ad75577c3f..1f4410e361 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -408,9 +408,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
GtkWindow* win = window.gobj();
GtkWidget* focus = gtk_window_get_focus (win);
bool special_handling_of_unmodified_accelerators = false;
-#ifdef GTKOSX
- bool allow_forwarding = true;
-#endif
+ bool allow_activating = true;
#undef DEBUG_ACCELERATOR_HANDLING
#ifdef DEBUG_ACCELERATOR_HANDLING
@@ -423,8 +421,9 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
}
#ifdef GTKOSX
+ /* should this be universally true? */
if (Keyboard::some_magic_widget_has_focus ()) {
- allow_forwarding = false;
+ allow_activating = false;
}
#endif
@@ -432,6 +431,10 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
if (debug) {
cerr << "Win = " << win << " Key event: code = " << ev->keyval << " state = " << hex << ev->state << dec << " special handling ? "
<< special_handling_of_unmodified_accelerators
+ << " magic widget focus ? "
+ << Keyboard::some_magic_widget_has_focus()
+ << " allow_activation ? "
+ << allow_activating
<< endl;
}
#endif
@@ -478,17 +481,19 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
uint32_t fakekey = ev->keyval;
if (possibly_translate_keyval_to_make_legal_accelerator (fakekey)) {
- if (gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state))) {
+ if (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state))) {
return true;
}
#ifdef GTKOSX
- int oldval = ev->keyval;
- ev->keyval = fakekey;
- if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
+ if (allow_activating) {
+ int oldval = ev->keyval;
+ ev->keyval = fakekey;
+ if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
+ return true;
+ }
+ ev->keyval = oldval;
}
- ev->keyval = oldval;
#endif
}
}
@@ -507,26 +512,23 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
}
#endif
+ if (allow_activating) {
#ifdef GTKOSX
- if (allow_forwarding && gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
- }
-#endif
- if (!gtk_window_activate_key (win, ev)) {
-#ifdef DEBUG_ACCELERATOR_HANDLING
- if (debug) {
- cerr << "\tnot accelerated, now propagate\n";
+ if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
+ return true;
}
#endif
- return gtk_window_propagate_key_event (win, ev);
- } else {
-#ifdef DEBUG_ACCELERATOR_HANDLING
- if (debug) {
- cerr << "\taccelerated - done.\n";
+ if (gtk_window_activate_key (win, ev)) {
+ return true;
}
+ }
+
+#ifdef DEBUG_ACCELERATOR_HANDLING
+ if (debug) {
+ cerr << "\tnot accelerated, now propagate\n";
+ }
#endif
- return true;
- }
+ return gtk_window_propagate_key_event (win, ev);
}
/* no modifiers, propagate first */
@@ -542,12 +544,17 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
cerr << "\tpropagation didn't handle, so activate\n";
}
#endif
+
+ if (allow_activating) {
+
#ifdef GTKOSX
- if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
- }
+ if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
+ return true;
+ }
#endif
- return gtk_window_activate_key (win, ev);
+ return gtk_window_activate_key (win, ev);
+ }
+
} else {
#ifdef DEBUG_ACCELERATOR_HANDLING
if (debug) {