add explicit inverse fade in/out curves for use when doing constant power xfading
[ardour.git] / libs / gtkmm2ext / popup.cc
index a8ffc4af669526baaca8ec481899d5dc36e6a842..6f4a8a5427d3372d6787098a08b92aac7103bc80 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <gtkmm2ext/popup.h>
 #include <gtkmm2ext/utils.h>
+#include <gtkmm2ext/gtk_ui.h>
 
 using namespace std;
 using namespace Gtk;
@@ -74,18 +75,26 @@ PopUp::remove ()
        hide ();
 
        if (popdown_time != 0 && timeout != -1) {
-               gtk_timeout_remove (timeout);
+               g_source_remove (timeout);
        }
 
        if (delete_on_hide) {
                std::cerr << "deleting prompter\n";
-               gtk_idle_add (idle_delete, this);
+               g_idle_add (idle_delete, this);
        }
 }
+#define ENSURE_GUI_THREAD(slot) \
+     if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {\
+             Gtkmm2ext::UI::instance()->call_slot (MISSING_INVALIDATOR, (slot)); \
+        return;\
+     }
+
 
 void
 PopUp::touch ()
 {
+       ENSURE_GUI_THREAD (mem_fun (*this, &PopUp::touch));
+
        if (is_visible ()) {
                remove ();
        } else {
@@ -94,7 +103,7 @@ PopUp::touch ()
                show_all ();
                
                if (popdown_time != 0) {
-                       timeout = gtk_timeout_add (popdown_time, 
+                       timeout = g_timeout_add (popdown_time, 
                                                   remove_prompt_timeout, 
                                                   this);
                }
@@ -102,7 +111,7 @@ PopUp::touch ()
 }
 
 gint
-PopUp::button_click (GdkEventButton *ev)
+PopUp::button_click (GdkEventButton */*ev*/)
 {
        remove ();
        return TRUE;
@@ -122,17 +131,17 @@ PopUp::set_name (string name)
 }
 
 bool
-PopUp::on_delete_event (GdkEventAny* ev)
+PopUp::on_delete_event (GdkEventAny* /*ev*/)
 {
        hide();
 
        if (popdown_time != 0 && timeout != -1) {
-               gtk_timeout_remove (timeout);
+               g_source_remove (timeout);
        }       
 
        if (delete_on_hide) {
                std::cerr << "deleting prompter\n" << endl;
-               gtk_idle_add (idle_delete, this);
+               g_idle_add (idle_delete, this);
        }
 
        return true;