improve relationship between ArdourDialog and Splash on OS X, where window restacking...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 30 Apr 2013 17:50:15 +0000 (13:50 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 30 Apr 2013 17:50:45 +0000 (13:50 -0400)
gtk2_ardour/ardour_dialog.cc
gtk2_ardour/ardour_dialog.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/splash.cc

index c0e17087818cf9d98498a85f4390d66792a2641c..6775a70953e97928fc3e524392547a10eca3e379 100644 (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
index 4f53662c235aebcfa4e7226661d5abf4d18aa8c9..1008f63000fe1a4a9d5eba86c1c00c248cae65e6 100644 (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;
index eebd35aefbc041c1449979c5670b0e3f30cafe78..7e972b8032a63f171c51a3d558f93a5247a80cad 100644 (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;
 }
 
 
index 0922ec75ba1fd8273372370de9f37095dfd3c293..99adff68e931f7e72016f35843963581e7024929 100644 (file)
 #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