diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-03-09 17:15:25 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-03-09 17:15:25 +0000 |
commit | c52c2b7368cf40eda6fcbe5840de6390e58ac382 (patch) | |
tree | 6e6bf9df8fc4edad7b18c50ca7aa2f16efdc93da | |
parent | 3e3d831251ec026eec1887697f6873650536848e (diff) |
forward-port some fixes from a2
git-svn-id: svn://localhost/ardour2/branches/3.0@11630 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 15 | ||||
-rw-r--r-- | gtk2_ardour/editor_routes.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 27 |
6 files changed, 46 insertions, 2 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2b7b0e9918..d77296b07e 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -370,6 +370,7 @@ Editor::Editor () layering_order_editor = 0; no_save_visual = false; resize_idle_id = -1; + within_track_canvas = false; scrubbing_direction = 0; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 857a9786ae..327eafea57 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -714,6 +714,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_canvas_cursor (); ArdourCanvas::Canvas* track_canvas; + bool within_track_canvas; friend class VerboseCursor; VerboseCursor* _verbose_cursor; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 9a990b4dc3..4ebb3a834a 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -731,6 +731,7 @@ bool Editor::left_track_canvas (GdkEventCrossing */*ev*/) { DropDownKeys (); + within_track_canvas = false; set_entered_track (0); set_entered_regionview (0); reset_canvas_action_sensitivity (false); @@ -740,6 +741,7 @@ Editor::left_track_canvas (GdkEventCrossing */*ev*/) bool Editor::entered_track_canvas (GdkEventCrossing */*ev*/) { + within_track_canvas = false; reset_canvas_action_sensitivity (true); return FALSE; } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index a3a563340f..404affeaa1 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -91,6 +91,21 @@ using Gtkmm2ext::Keyboard; bool Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const { + /* gdk_window_get_pointer() has X11's XQueryPointer semantics in that it only + pays attentions to subwindows. this means that menu windows are ignored, and + if the pointer is in a menu, the return window from the call will be the + the regular subwindow *under* the menu. + + this matters quite a lot if the pointer is moving around in a menu that overlaps + the track canvas because we will believe that we are within the track canvas + when we are not. therefore, we track enter/leave events for the track canvas + and allow that to override the result of gdk_window_get_pointer(). + */ + + if (!within_track_canvas) { + return false; + } + int x, y; double wx, wy; Gdk::ModifierType mask; diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index 17a5c5b440..d98ee0a8d2 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -488,7 +488,7 @@ EditorRoutes::show_menu () void EditorRoutes::redisplay () { - if (_no_redisplay || !_session) { + if (_no_redisplay || !_session || _session->deletion_in_progress()) { return; } diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index a6af6900a2..d061fce35f 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -417,7 +417,32 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) uint32_t fakekey = ev->keyval; if (Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (fakekey)) { - if (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, GdkModifierType(ev->state))) { + DEBUG_TRACE (DEBUG::Accelerators, string_compose ("\tactivate (was %1 now %2) without special hanlding of unmodified accels\n", + ev->keyval, fakekey)); + + GdkModifierType mod = GdkModifierType (ev->state); + + mod = GdkModifierType (mod & gtk_accelerator_get_default_mod_mask()); +#ifdef GTKOSX + /* GTK on OS X is currently (February 2012) setting both + the Meta and Mod2 bits in the event modifier state if + the Command key is down. + + gtk_accel_groups_activate() does not invoke any of the logic + that gtk_window_activate_key() will that sorts out that stupid + state of affairs, and as a result it fails to find a match + for the key event and the current set of accelerators. + + to fix this, if the meta bit is set, remove the mod2 bit + from the modifier. this assumes that our bindings use Primary + which will have set the meta bit in the accelerator entry. + */ + if (mod & GDK_META_MASK) { + mod = GdkModifierType (mod & ~GDK_MOD2_MASK); + } +#endif + + if (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, mod)) { DEBUG_TRACE (DEBUG::Accelerators, "\taccel group activated by fakekey\n"); return true; } |