diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-15 19:00:28 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-02-15 20:07:49 +0100 |
commit | 3d3f2a79f619ef9725f113a48c1de4fcf9d33ac7 (patch) | |
tree | 054c5782b26a08a05a17f3c08d68f45050cb2e41 /gtk2_ardour/editor_canvas.cc | |
parent | 0a41daa932a0f742c7dc7a14c02ae93baa12903a (diff) |
use leave/enter from track canvas to be the primary driver of region action sensitivity
This works for context menus also, because GTK sends us leave/enter notify
events when they appear.
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index f6a34eb0e0..0799645ed9 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -808,22 +808,46 @@ Editor::get_enter_context(ItemType type) } bool -Editor::left_track_canvas (GdkEventCrossing */*ev*/) +Editor::left_track_canvas (GdkEventCrossing* ev) { + const bool was_within = within_track_canvas; DropDownKeys (); within_track_canvas = false; set_entered_track (0); set_entered_regionview (0); reset_canvas_action_sensitivity (false); + + if (was_within) { + if (ev->detail == GDK_NOTIFY_NONLINEAR || + ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) { + /* context menu or something similar */ + sensitize_the_right_region_actions (true, false); + } else { + sensitize_the_right_region_actions (false, true); + } + } + return false; } bool -Editor::entered_track_canvas (GdkEventCrossing */*ev*/) +Editor::entered_track_canvas (GdkEventCrossing* ev) { + const bool was_within = within_track_canvas; within_track_canvas = true; reset_canvas_action_sensitivity (true); - return FALSE; + + if (!was_within) { + if (ev->detail == GDK_NOTIFY_NONLINEAR || + ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) { + /* context menu or something similar */ + sensitize_the_right_region_actions (true, false); + } else { + sensitize_the_right_region_actions (false, true); + } + } + + return false; } void |