From d1b462c21310dea4434edcb3d5b44caa0da3586d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 15 Nov 2022 03:07:43 +0100 Subject: [PATCH] Special case tansient-parent windows on macOS macOS has its own z-axis stacking (see Manager::set_transient_for) for dialog and utility windows of a single application. There only case to set a dedicated transient parent is to keep the child window on top of a dialog. Valid use-cases are e.g. Plugin Preset Name entry on top of a PluginWindow Export Format Settings on top of the Export Dialog Alternatively one would need to patch gtk to handle [NSView shouldDelayWindowOrderingForEvent] and explicitly reorder siblings of a common parent window. This fixes an issue that plugin windows cannot be re-stacked but were previously always stacked in the order they were opened. --- gtk2_ardour/ardour_ui_dialogs.cc | 2 ++ gtk2_ardour/ardour_window.cc | 2 ++ gtk2_ardour/io_plugin_window.cc | 2 +- gtk2_ardour/processor_box.cc | 8 +++----- gtk2_ardour/trigger_clip_picker.cc | 2 ++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index fdbbd31b62..3b33e32dbe 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -1039,6 +1039,7 @@ ARDOUR_UI::handle_locations_change (Location *) bool ARDOUR_UI::tabbed_window_state_event_handler (GdkEventWindowState* ev, void* object) { +#ifndef __APPLE__ if (object == editor) { if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && @@ -1069,6 +1070,7 @@ ARDOUR_UI::tabbed_window_state_event_handler (GdkEventWindowState* ev, void* obj } } } +#endif return false; } diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc index 27e0247c34..660f7055fc 100644 --- a/gtk2_ardour/ardour_window.cc +++ b/gtk2_ardour/ardour_window.cc @@ -49,7 +49,9 @@ ArdourWindow::ArdourWindow (Gtk::Window& parent, string title) { init (); set_title (title); +#ifndef __APPLE__ set_transient_for (parent); +#endif set_position (Gtk::WIN_POS_CENTER_ON_PARENT); } diff --git a/gtk2_ardour/io_plugin_window.cc b/gtk2_ardour/io_plugin_window.cc index f2699d6bd0..24d3c6b1ab 100644 --- a/gtk2_ardour/io_plugin_window.cc +++ b/gtk2_ardour/io_plugin_window.cc @@ -335,7 +335,7 @@ IOPluginWindow::IOPlugUI::edit_plugin (bool custom_ui) _window_proxy->set_custom_ui_mode (custom_ui); _window_proxy->show_the_right_window (); Gtk::Window* tlw = dynamic_cast (get_toplevel ()); - _window_proxy->get ()->set_transient_for (*tlw); + _window_proxy->set_transient_for (*tlw); } bool diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 277bed812e..695a09dd0c 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -4450,8 +4450,7 @@ ProcessorBox::edit_processor (boost::shared_ptr processor) proxy->show_the_right_window (); Gtk::Window* tlw = dynamic_cast (get_toplevel ()); - assert (tlw && proxy->get (false)); - proxy->get ()->set_transient_for (*tlw); + proxy->set_transient_for (*tlw); } } @@ -4475,8 +4474,7 @@ ProcessorBox::generic_edit_processor (boost::shared_ptr processor) proxy->show_the_right_window (); Gtk::Window* tlw = dynamic_cast (get_toplevel ()); - assert (tlw && proxy->get (false)); - proxy->get ()->set_transient_for (*tlw); + proxy->set_transient_for (*tlw); } } @@ -4492,7 +4490,7 @@ ProcessorBox::manage_pins (boost::shared_ptr processor) Gtk::Window* tlw = dynamic_cast (get_toplevel ()); assert (tlw); - proxy->get ()->set_transient_for (*tlw); + proxy->set_transient_for (*tlw); proxy->present(); } diff --git a/gtk2_ardour/trigger_clip_picker.cc b/gtk2_ardour/trigger_clip_picker.cc index a164a33e34..73ff1a53e5 100644 --- a/gtk2_ardour/trigger_clip_picker.cc +++ b/gtk2_ardour/trigger_clip_picker.cc @@ -685,7 +685,9 @@ TriggerClipPicker::open_dir () { Gtk::Window* tlw = dynamic_cast (get_toplevel ()); assert (tlw); +#ifndef __APPLE__ _fcd.set_transient_for (*tlw); +#endif int result = _fcd.run (); _fcd.hide ();