From 47eb7ed0ccccb35b1785b19bc5b5be5db01c13b4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 9 Jul 2012 21:25:22 +0000 Subject: some hacks to try to get the splash to function reliably, particularly on OS X git-svn-id: svn://localhost/ardour2/branches/3.0@13001 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 46 ++++++++++++++++++++++++++++++++++++++++++---- gtk2_ardour/ardour_ui.h | 6 ++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 96e309ed01..959101ac57 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2830,9 +2830,34 @@ ARDOUR_UI::about_signal_response (int /*response*/) hide_about(); } +bool +ARDOUR_UI::wakeup_from_splash_sleep (void* arg) +{ + cerr << "idle after splash\n"; + ((ARDOUR_UI*)arg)->_wakeup_from_splash_sleep (); + return false; +} + +void +ARDOUR_UI::_wakeup_from_splash_sleep () +{ + splash_done_visible = true; + cerr << "Set sdv to " << splash_done_visible << endl; +} + +bool +ARDOUR_UI::splash_visible (GdkEventAny*) +{ + cerr << "Splash now mapped\n"; + g_idle_add ((gboolean (*)(void*))ARDOUR_UI::wakeup_from_splash_sleep, this); + return false; +} + void ARDOUR_UI::show_splash () { + cerr << "Show splash!\n"; + if (splash == 0) { try { splash = new Splash; @@ -2841,11 +2866,24 @@ ARDOUR_UI::show_splash () } } - splash->present (); + bool was_mapped = splash->is_mapped (); + + if (!was_mapped) { + splash_expose = splash->signal_map_event().connect (sigc::mem_fun (this, &ARDOUR_UI::splash_visible), false); + splash_done_visible = false; + } + splash->pop_front (); - splash->queue_draw (); - splash->get_window()->process_updates (true); - flush_pending (); + splash->present (); + + if (!was_mapped) { + while (!splash_done_visible) { + cerr << "nested iteration. sdv = " << splash_done_visible << endl; + gtk_main_iteration (); + } + } + + cerr << "show splash done\n"; } void diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index c48d373ca3..3d29eebc2f 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -611,6 +611,12 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr About* about; Splash* splash; + bool splash_done_visible; + static bool wakeup_from_splash_sleep (void *); + void _wakeup_from_splash_sleep (); + bool splash_visible (GdkEventAny*); + sigc::connection splash_expose; + void pop_back_splash (Gtk::Window&); /* cleanup */ -- cgit v1.2.3