13
0

use Tracks' MainMenuDisabler during session lock (could be improved with more RAII)

This commit is contained in:
Paul Davis 2015-05-06 12:10:41 -04:00
parent 2363fb71e3
commit a81bfbfc41
4 changed files with 23 additions and 11 deletions

View File

@ -302,6 +302,7 @@ Editor::Editor ()
, _control_point_toggled_on_press (false) , _control_point_toggled_on_press (false)
, _stepping_axis_view (0) , _stepping_axis_view (0)
, quantize_dialog (0) , quantize_dialog (0)
, _main_menu_disabler (0)
{ {
constructed = false; constructed = false;

View File

@ -2239,6 +2239,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void bring_all_sources_into_session (); void bring_all_sources_into_session ();
QuantizeDialog* quantize_dialog; QuantizeDialog* quantize_dialog;
MainMenuDisabler* _main_menu_disabler;
friend class Drag; friend class Drag;
friend class RegionDrag; friend class RegionDrag;

View File

@ -7547,15 +7547,10 @@ Editor::lock ()
lock_dialog->get_vbox()->show_all (); lock_dialog->get_vbox()->show_all ();
lock_dialog->set_size_request (200, 200); 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 (); lock_dialog->present ();
} }
@ -7564,9 +7559,7 @@ Editor::unlock ()
{ {
lock_dialog->hide (); lock_dialog->hide ();
#ifdef __APPLE__ delete _main_menu_disabler;
ActionManager::pop_action_state ();
#endif
if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) { if (ARDOUR_UI::config()->get_lock_gui_after_seconds()) {
start_lock_event_timing (); start_lock_event_timing ();

View File

@ -40,6 +40,8 @@
#include "pbd/statefuldestructible.h" #include "pbd/statefuldestructible.h"
#include "canvas/fwd.h" #include "canvas/fwd.h"
#include "gtkmm2ext/actions.h"
#include "gtkmm2ext/visibility_tracker.h" #include "gtkmm2ext/visibility_tracker.h"
#include "editing.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__ #endif // __gtk_ardour_public_editor_h__