improve relationship between ArdourDialog and Splash on OS X, where window restacking doesn't really work the way we need it to. more complex than anticipated because it seems that destroying a Gtk::Dialog does not emit its hide() or unmap() or unmap_event() signals

This commit is contained in:
Paul Davis 2013-04-30 13:50:15 -04:00
parent 63e4c37def
commit a9341bd5f0
4 changed files with 41 additions and 6 deletions

View File

@ -34,12 +34,14 @@ sigc::signal<void> ArdourDialog::CloseAllDialogs;
ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
: Dialog (title, modal, use_seperator)
, _splash_pushed (false)
{
init ();
}
ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool use_seperator)
: Dialog (title, parent, modal, use_seperator)
, _splash_pushed (false)
{
init ();
set_position (Gtk::WIN_POS_CENTER_ON_PARENT);
@ -47,6 +49,13 @@ ArdourDialog::ArdourDialog (Gtk::Window& parent, string title, bool modal, bool
ArdourDialog::~ArdourDialog ()
{
if (_splash_pushed) {
Splash* spl = Splash::instance();
if (spl) {
spl->pop_front();
}
}
}
bool
@ -73,15 +82,16 @@ ArdourDialog::on_unmap ()
void
ArdourDialog::on_show ()
{
Dialog::on_show ();
// never allow the splash screen to obscure any dialog
Splash* spl = Splash::instance();
if (spl) {
if (spl && spl->is_visible()) {
spl->pop_back_for (*this);
_splash_pushed = true;
}
Dialog::on_show ();
}
void

View File

@ -46,6 +46,7 @@ class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
static void close_all_dialogs () { CloseAllDialogs(); }
private:
bool _splash_pushed;
void init ();
static sigc::signal<void> CloseAllDialogs;

View File

@ -3771,12 +3771,14 @@ audio may be played at the wrong sample rate.\n"), desired, PROGRAM_NAME, actual
image->show();
hbox->show();
switch (dialog.run ()) {
switch (dialog.run()) {
case RESPONSE_ACCEPT:
return 0;
default:
return 1;
break;
}
return 1;
}

View File

@ -25,6 +25,10 @@
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
#ifdef check
#undef check
#endif
#include "gui_thread.h"
#include "splash.h"
@ -96,15 +100,33 @@ Splash::~Splash ()
void
Splash::pop_back_for (Gtk::Window& win)
{
#ifdef __APPLE__
/* April 2013: window layering on OS X is a bit different to X Window. at present,
the "restack()" functionality in GDK will only operate on windows in the same
"level" (e.g. two normal top level windows, or two utility windows) and will not
work across them. The splashscreen is on its own "StatusWindowLevel" so restacking
is not going to work.
So for OS X, we just hide ourselves.
*/
hide();
#else
set_keep_above (false);
get_window()->restack (win.get_window(), false);
win.signal_hide().connect (sigc::mem_fun (*this, &Splash::pop_front));
#endif
}
void
Splash::pop_front ()
{
#ifdef __APPLE__
if (get_window()) {
show ();
}
#else
set_keep_above (true);
#endif
}
void