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.
This commit is contained in:
Robin Gareus 2022-11-15 03:07:43 +01:00
parent f107c063e7
commit d1b462c213
5 changed files with 10 additions and 6 deletions

View File

@ -1039,6 +1039,7 @@ ARDOUR_UI::handle_locations_change (Location *)
bool bool
ARDOUR_UI::tabbed_window_state_event_handler (GdkEventWindowState* ev, void* object) ARDOUR_UI::tabbed_window_state_event_handler (GdkEventWindowState* ev, void* object)
{ {
#ifndef __APPLE__
if (object == editor) { if (object == editor) {
if ((ev->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) && 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; return false;
} }

View File

@ -49,7 +49,9 @@ ArdourWindow::ArdourWindow (Gtk::Window& parent, string title)
{ {
init (); init ();
set_title (title); set_title (title);
#ifndef __APPLE__
set_transient_for (parent); set_transient_for (parent);
#endif
set_position (Gtk::WIN_POS_CENTER_ON_PARENT); set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
} }

View File

@ -335,7 +335,7 @@ IOPluginWindow::IOPlugUI::edit_plugin (bool custom_ui)
_window_proxy->set_custom_ui_mode (custom_ui); _window_proxy->set_custom_ui_mode (custom_ui);
_window_proxy->show_the_right_window (); _window_proxy->show_the_right_window ();
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ()); Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
_window_proxy->get ()->set_transient_for (*tlw); _window_proxy->set_transient_for (*tlw);
} }
bool bool

View File

@ -4450,8 +4450,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
proxy->show_the_right_window (); proxy->show_the_right_window ();
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ()); Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
assert (tlw && proxy->get (false)); proxy->set_transient_for (*tlw);
proxy->get ()->set_transient_for (*tlw);
} }
} }
@ -4475,8 +4474,7 @@ ProcessorBox::generic_edit_processor (boost::shared_ptr<Processor> processor)
proxy->show_the_right_window (); proxy->show_the_right_window ();
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ()); Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
assert (tlw && proxy->get (false)); proxy->set_transient_for (*tlw);
proxy->get ()->set_transient_for (*tlw);
} }
} }
@ -4492,7 +4490,7 @@ ProcessorBox::manage_pins (boost::shared_ptr<Processor> processor)
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ()); Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
assert (tlw); assert (tlw);
proxy->get ()->set_transient_for (*tlw); proxy->set_transient_for (*tlw);
proxy->present(); proxy->present();
} }

View File

@ -685,7 +685,9 @@ TriggerClipPicker::open_dir ()
{ {
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ()); Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
assert (tlw); assert (tlw);
#ifndef __APPLE__
_fcd.set_transient_for (*tlw); _fcd.set_transient_for (*tlw);
#endif
int result = _fcd.run (); int result = _fcd.run ();
_fcd.hide (); _fcd.hide ();