From a81bfbfc416753331f791f1b8ca246f460ad74b9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 6 May 2015 12:10:41 -0400 Subject: [PATCH] use Tracks' MainMenuDisabler during session lock (could be improved with more RAII) --- gtk2_ardour/editor.cc | 1 + gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_ops.cc | 15 ++++----------- gtk2_ardour/public_editor.h | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index ea4da49325..59edb1420a 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -302,6 +302,7 @@ Editor::Editor () , _control_point_toggled_on_press (false) , _stepping_axis_view (0) , quantize_dialog (0) + , _main_menu_disabler (0) { constructed = false; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ac25455c04..9d0f83d040 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -2239,6 +2239,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void bring_all_sources_into_session (); QuantizeDialog* quantize_dialog; + MainMenuDisabler* _main_menu_disabler; friend class Drag; friend class RegionDrag; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ccb9fe55be..2d26a90a86 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -7547,15 +7547,10 @@ Editor::lock () lock_dialog->get_vbox()->show_all (); lock_dialog->set_size_request (200, 200); } + + delete _main_menu_disabler; + _main_menu_disabler = new MainMenuDisabler; -#ifdef __APPLE__ - /* The global menu bar continues to be accessible to applications - with modal dialogs, which means that we need to desensitize - all items in the menu bar. Since those items are really just - proxies for actions, that means disabling all actions. - */ - ActionManager::disable_all_actions (); -#endif lock_dialog->present (); } @@ -7564,9 +7559,7 @@ Editor::unlock () { lock_dialog->hide (); -#ifdef __APPLE__ - ActionManager::pop_action_state (); -#endif + delete _main_menu_disabler; if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) { start_lock_event_timing (); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 951c3e9b0e..b5d139b543 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -40,6 +40,8 @@ #include "pbd/statefuldestructible.h" #include "canvas/fwd.h" + +#include "gtkmm2ext/actions.h" #include "gtkmm2ext/visibility_tracker.h" #include "editing.h" @@ -459,4 +461,19 @@ class DisplaySuspender { } }; +class MainMenuDisabler { +public: + MainMenuDisabler () { + /* The global menu bar continues to be accessible to applications + with modal dialogs on mac, which means that we need to desensitize + all items in the menu bar. + */ + ActionManager::disable_active_actions (); + } + + ~MainMenuDisabler () { + ActionManager::enable_active_actions (); + } +}; + #endif // __gtk_ardour_public_editor_h__