]> code.delx.au - gnu-emacs/blobdiff - src/gtkutil.c
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
[gnu-emacs] / src / gtkutil.c
index 88e6d30bd9a02d9afd5e5e2b9c48aa9bd5db0c0b..e08a4b53489cc55a43b5dff934ceec8b5ed247ad 100644 (file)
@@ -731,14 +731,23 @@ xg_show_tooltip (struct frame *f, int root_x, int root_y)
 bool
 xg_hide_tooltip (struct frame *f)
 {
-  bool ret = 0;
 #ifdef USE_GTK_TOOLTIP
-  if (f->output_data.x->ttip_window)
+  struct x_output *x = FRAME_X_OUTPUT (f);
+
+  if (x->ttip_window)
     {
       GtkWindow *win = f->output_data.x->ttip_window;
+
       block_input ();
       gtk_widget_hide (GTK_WIDGET (win));
 
+      /* Cancel call to xg_hide_tip.  */
+      if (x->ttip_timeout != 0)
+       {
+         g_source_remove (x->ttip_timeout);
+         x->ttip_timeout = 0;
+       }
+
       if (g_object_get_data (G_OBJECT (win), "restore-tt"))
         {
           GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win));
@@ -747,11 +756,21 @@ xg_hide_tooltip (struct frame *f)
           g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL);
         }
       unblock_input ();
-
-      ret = 1;
+      return 1;
     }
 #endif
-  return ret;
+  return 0;
+}
+
+/* One-shot timeout handler attached to GTK event loop in Fx_show_tip.  */
+
+gboolean
+xg_hide_tip (gpointer data)
+{
+#ifdef USE_GTK_TOOLTIP
+  xg_hide_tooltip ((struct frame *) data);
+#endif
+  return FALSE;
 }
 
 \f