mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-30 08:53:08 +01:00
Fix stuck insensitive macOS main menu
Popup Dialog Windows never unset the modal flag. e.g. Session > Save Snapshot & switch. Furthermore a 2nd dialog was able to get the menu stuck forever (e.g. Snapshot & Switch .. -> Replace existing?
This commit is contained in:
parent
3acc8c76ca
commit
267cddfb05
2 changed files with 25 additions and 8 deletions
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
static gint _exiting = 0;
|
||||
static std::vector<GtkMenuItem*> global_menu_items;
|
||||
static bool _modal_state = false;
|
||||
static gint _modal_state = 0;
|
||||
|
||||
static guint
|
||||
gdk_quartz_keyval_to_ns_keyval (guint keyval)
|
||||
|
|
@ -585,7 +585,7 @@ idle_call_activate (gpointer data)
|
|||
}
|
||||
- (BOOL) validateMenuItem:(NSMenuItem*) menuItem
|
||||
{
|
||||
if (_modal_state) {
|
||||
if (_modal_state > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1468,7 +1468,7 @@ namespace Gtk {
|
|||
- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *) app
|
||||
{
|
||||
UNUSED_PARAMETER(app);
|
||||
if (_modal_state) {
|
||||
if (_modal_state > 0) {
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
Gtkmm2ext::Application::instance()->ShouldQuit ();
|
||||
|
|
@ -1480,14 +1480,18 @@ static void
|
|||
gdk_quartz_modal_notify (GdkWindow*, gboolean modal)
|
||||
{
|
||||
/* this global will control sensitivity of our app menu items, via validateMenuItem */
|
||||
_modal_state = modal;
|
||||
if (modal) {
|
||||
++_modal_state;
|
||||
} else if (_modal_state > 0) {
|
||||
--_modal_state;
|
||||
}
|
||||
|
||||
/* Need to notify GTK that actions are insensitive where necessary */
|
||||
|
||||
for (auto & mitem : global_menu_items) {
|
||||
GtkAction* act = gtk_activatable_get_related_action (GTK_ACTIVATABLE(mitem));
|
||||
if (act) {
|
||||
gtk_action_set_sensitive (act, !modal);
|
||||
gtk_action_set_sensitive (act, 0 == _modal_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,15 @@ gdk_window_impl_quartz_finalize (GObject *object)
|
|||
{
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (object);
|
||||
|
||||
check_grab_destroy (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper);
|
||||
GdkWindow *window = GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper;
|
||||
GdkWindowObject *private = (GdkWindowObject*) window;
|
||||
|
||||
check_grab_destroy (window);
|
||||
|
||||
if (private->modal_hint && _gdk_modal_notify)
|
||||
{
|
||||
_gdk_modal_notify (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper, false);
|
||||
}
|
||||
|
||||
if (impl->paint_clip_region)
|
||||
gdk_region_destroy (impl->paint_clip_region);
|
||||
|
|
@ -2386,14 +2394,19 @@ void
|
|||
gdk_window_set_modal_hint (GdkWindow *window,
|
||||
gboolean modal)
|
||||
{
|
||||
GdkWindowObject *private;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL (window))
|
||||
return;
|
||||
|
||||
if (_gdk_modal_notify) {
|
||||
private = (GdkWindowObject*) window;
|
||||
|
||||
if (_gdk_modal_notify && private->modal_hint != modal) {
|
||||
_gdk_modal_notify (window, modal);
|
||||
}
|
||||
/* FIXME: Implement */
|
||||
|
||||
private->modal_hint = modal;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue