Keep track of splash visibility behind dialogs

This fixes various issues, esp on macOS and Windows where
the window is only hidden, not re-stacked:

* plugin scan dialog hides the splash, but
  the plugin-manager emits BootMessage
  (this worked mostly because gtk event loop didn't
  have time to catch up)

* More than one dialog can pop back/front the splash,
  e.g. scripted session-setup or error messages when
  loading recent sessions.
This commit is contained in:
Robin Gareus 2021-06-23 12:52:16 +02:00
parent 8ad1405cf5
commit 8237add6d2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 26 additions and 6 deletions

View File

@ -92,7 +92,7 @@ ArdourDialog::pop_splash ()
Splash* spl = Splash::exists () ? Splash::instance() : NULL;
if (spl) {
spl->pop_front();
spl->pop_front_for (*this);
}
_splash_pushed = false;
}

View File

@ -79,7 +79,7 @@ ArdourMessageDialog::pop_splash ()
if (_splash_pushed) {
Splash* spl = Splash::exists () ? Splash::instance() : NULL;
if (spl) {
spl->pop_front();
spl->pop_front_for (*this);
}
_splash_pushed = false;
}

View File

@ -536,7 +536,7 @@ ARDOUR_UI::starting ()
/* allow signals to be handled, ShouldLoad() from flush-pending */
Splash::instance()->pop_front();
Splash::instance()->exists(); // create splash
flush_pending ();
if (!startup_fsm) {
@ -811,7 +811,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
* 3) no audio/MIDI setup required
*/
Splash::instance()->pop_front();
Splash::instance()->exists(); // create splash
startup_fsm->start ();
}
}

View File

@ -63,7 +63,7 @@ Message::run ()
if (splash_pushed) {
spl = Splash::instance();
if (spl) {
spl->pop_front();
spl->pop_front_for (_message_dialog);
}
}

View File

@ -153,12 +153,27 @@ Splash::pop_back_for (Gtk::Window& win)
if (is_mapped()) {
get_window()->restack (win.get_window(), false);
}
#endif
_window_stack.insert (&win);
}
void
Splash::pop_front_for (Gtk::Window& win)
{
#ifndef NDEBUG
assert (1 == _window_stack.erase (&win));
#else
_window_stack.erase (&win);
#endif
}
void
Splash::pop_front ()
{
if (!_window_stack.empty ()) {
return;
}
if (get_window()) {
#if defined __APPLE__ || defined PLATFORM_WINDOWS
show ();

View File

@ -21,6 +21,8 @@
#ifndef __ardour_gtk_splash_h__
#define __ardour_gtk_splash_h__
#include <set>
#include <gtkmm/window.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm/box.h>
@ -42,7 +44,7 @@ public:
void display ();
void pop_back_for (Gtk::Window&);
void pop_front ();
void pop_front_for (Gtk::Window&);
bool expose (GdkEventExpose*);
bool on_button_release_event (GdkEventButton*);
@ -59,6 +61,9 @@ private:
Gtk::DrawingArea darea;
Glib::RefPtr<Pango::Layout> layout;
void pop_front ();
std::set<Gtk::Window*> _window_stack;
void boot_message (std::string);
PBD::ScopedConnection msg_connection;