diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-07-10 01:04:36 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-07-10 01:04:36 +0000 |
commit | 2de80a5e90dca50c5c018afdca6b11ca80f25f7a (patch) | |
tree | d93cbea042b07ccd64ef0fd0a12759b0a5dc006e /gtk2_ardour/splash.cc | |
parent | 7aa66b6623aedbe7614ae153dee8f5b97c3e1c75 (diff) |
OS X-based fixes for splash screen mgmt
git-svn-id: svn://localhost/ardour2/branches/3.0@13006 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/splash.cc')
-rw-r--r-- | gtk2_ardour/splash.cc | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index cd09be0574..78b5547ded 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -21,6 +21,7 @@ #include "pbd/failed_constructor.h" #include "pbd/file_utils.h" + #include "ardour/ardour.h" #include "ardour/filesystem_paths.h" @@ -44,6 +45,7 @@ Splash::Splash () std::string splash_file; if (!find_file_in_search_path (ardour_data_search_path(), "splash.png", splash_file)) { + cerr << "Cannot find splash screen image file\n"; throw failed_constructor(); } @@ -52,6 +54,7 @@ Splash::Splash () } catch (...) { + cerr << "Cannot construct splash screen image\n"; throw failed_constructor(); } @@ -77,6 +80,8 @@ Splash::Splash () set_default_size (pixbuf->get_width(), pixbuf->get_height()); the_splash = this; + expose_done = false; + ARDOUR::BootMessage.connect (msg_connection, invalidator (*this), boost::bind (&Splash::boot_message, this, _1), gui_context()); } @@ -85,40 +90,6 @@ Splash::~Splash () the_splash = 0; } -bool -Splash::wakeup_from_splash_sleep () -{ - splash_done_visible = true; - return false; -} - -bool -Splash::splash_mapped (GdkEventAny*) -{ - Glib::signal_idle().connect (sigc::mem_fun (this, &Splash::wakeup_from_splash_sleep)); - return false; -} - -void -Splash::display () -{ - bool was_mapped = is_mapped (); - - if (!was_mapped) { - signal_map_event().connect (sigc::mem_fun (this, &Splash::splash_mapped), false); - splash_done_visible = false; - } - - pop_front (); - present (); - - if (!was_mapped) { - while (!splash_done_visible) { - gtk_main_iteration (); - } - } -} - void Splash::pop_back_for (Gtk::Window& win) { @@ -141,10 +112,15 @@ Splash::on_realize () layout->set_font_description (get_style()->get_font()); } - bool -Splash::on_button_release_event (GdkEventButton*) +Splash::on_button_release_event (GdkEventButton* ev) { + RefPtr<Gdk::Window> window = get_window(); + + if (!window || ev->window != window->gobj()) { + return false; + } + hide (); return true; } @@ -169,6 +145,8 @@ Splash::expose (GdkEventExpose* ev) Glib::RefPtr<Gdk::GC> white = style->get_white_gc(); window->draw_layout (white, 10, pixbuf->get_height() - 30, layout); + + Glib::signal_idle().connect (sigc::mem_fun (this, &Splash::idle_after_expose)); return true; } @@ -179,6 +157,32 @@ Splash::boot_message (std::string msg) message (msg); } +bool +Splash::idle_after_expose () +{ + expose_done = true; + return false; +} + +void +Splash::display () +{ + bool was_mapped = is_mapped (); + + if (!was_mapped) { + expose_done = false; + } + + pop_front (); + present (); + + if (!was_mapped) { + while (!expose_done) { + gtk_main_iteration (); + } + } +} + void Splash::message (const string& msg) { @@ -190,9 +194,12 @@ Splash::message (const string& msg) Glib::RefPtr<Gdk::Window> win = darea.get_window(); if (win) { - win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30, - darea.get_width(), 30), true); - win->process_updates (true); - gdk_flush (); + expose_done = false; + + win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30, darea.get_width(), 30), true); + + while (!expose_done) { + gtk_main_iteration (); + } } } |