summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-01-15 01:59:56 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-01-15 01:59:56 +0000
commit15bb3b577ec9a8cb50758c4b017718e342a2439c (patch)
tree293407ebe738cfc3378335a82cb69e75751e9e73 /gtk2_ardour/utils.cc
parent496a2da48f8a02a4be7761f0da6eb0b3828ee68b (diff)
rework "ige_mac" menubar integration from Carbon to Cocoa; recast as start of GtkApplication object as per discussions on #gtk+; associated changes in ardour; NOT TESTED ON X11, LEOPARD or SNOW LEOPARD
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6493 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc54
1 files changed, 24 insertions, 30 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 49bd38b6f4..22b6cfa9d5 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -400,12 +400,6 @@ set_color (Gdk::Color& c, int rgb)
c.set_rgb((rgb >> 16)*256, ((rgb & 0xff00) >> 8)*256, (rgb & 0xff)*256);
}
-#ifdef GTKOSX
-extern "C" {
- gboolean gdk_quartz_possibly_forward (GdkEvent*);
-}
-#endif
-
bool
relay_key_press (GdkEventKey* ev, Gtk::Window* win)
{
@@ -424,7 +418,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
bool special_handling_of_unmodified_accelerators = false;
bool allow_activating = true;
-#undef DEBUG_ACCELERATOR_HANDLING
+#define DEBUG_ACCELERATOR_HANDLING
#ifdef DEBUG_ACCELERATOR_HANDLING
//bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0);
bool debug=true;
@@ -447,7 +441,13 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
#ifdef DEBUG_ACCELERATOR_HANDLING
if (debug) {
- cerr << "Win = " << win << " Key event: code = " << ev->keyval << " state = " << hex << ev->state << dec << " special handling ? "
+ cerr << "Win = " << win << " Key event: code = " << ev->keyval << " name = " << gdk_keyval_name (ev->keyval) << " state = " << hex << ev->state << dec
+ << " ctrl " << ((ev->state & GDK_CONTROL_MASK) ? 1 : 0)
+ << " alt " << ((ev->state & GDK_MOD1_MASK) ? 1 : 0)
+ << " shift " << ((ev->state & GDK_SHIFT_MASK) ? 1 : 0)
+ << " cmd/meta " << ((ev->state & GDK_META_MASK) ? 1 : 0)
+ << " lock " << ((ev->state & GDK_LOCK_MASK) ? 1 : 0)
+ << " special handling ? "
<< special_handling_of_unmodified_accelerators
<< " magic widget focus ? "
<< Keyboard::some_magic_widget_has_focus()
@@ -499,20 +499,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 (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state))) {
- return true;
+#ifdef DEBUG_ACCELERATOR_HANDLING
+ if (debug) {
+ cerr << "\tactivate without special handling of unmodified accels\n";
}
-
-#ifdef GTKOSX
- if (allow_activating) {
- int oldval = ev->keyval;
- ev->keyval = fakekey;
- if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
+#endif
+ if (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state))) {
+#ifdef DEBUG_ACCELERATOR_HANDLING
+ if (debug) {
+ cerr << "\tactivation handled key\n";
}
- ev->keyval = oldval;
- }
#endif
+ return true;
+ }
}
}
@@ -531,12 +530,13 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
#endif
if (allow_activating) {
-#ifdef GTKOSX
- if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
- }
-#endif
if (gtk_window_activate_key (win, ev)) {
+#ifdef DEBUG_ACCELERATOR_HANDLING
+ if (debug) {
+ cerr << "\tactivation handled key\n";
+ }
+#endif
+
return true;
}
}
@@ -564,12 +564,6 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
#endif
if (allow_activating) {
-
-#ifdef GTKOSX
- if (gdk_quartz_possibly_forward ((GdkEvent*) ev)) {
- return true;
- }
-#endif
return gtk_window_activate_key (win, ev);
}