]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktooltip.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtktooltip.c
index eaf94b8dd1f6d5bc76f75b49b54849b98ec793a1..aba9ffb38a173b8be9a9a377bc19c76c4c9f05d2 100644 (file)
 #include "gtkwindowprivate.h"
 
 
+#ifdef GDK_WINDOWING_WAYLAND
+#include "wayland/gdkwayland.h"
+#endif
+
+
 /**
  * SECTION:gtktooltip
  * @Short_description: Add tips to your widgets
@@ -206,7 +211,7 @@ gtk_tooltip_init (GtkTooltip *tooltip)
 
   tooltip->last_window = NULL;
 
-  window = g_object_ref (gtk_window_new (GTK_WINDOW_POPUP));
+  window = gtk_window_new (GTK_WINDOW_POPUP);
   screen = gtk_widget_get_screen (window);
   visual = gdk_screen_get_rgba_visual (screen);
 
@@ -1200,6 +1205,20 @@ found:
             y = tooltip->last_y - height - 2;
         }
 
+#ifdef GDK_WINDOWING_WAYLAND
+      /* set the transient parent on the tooltip when running with the Wayland
+       * backend to allow correct positioning of the tooltip windows */
+      if (GDK_IS_WAYLAND_DISPLAY (display))
+        {
+          GtkWidget *toplevel;
+
+          toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
+          if (GTK_IS_WINDOW (toplevel))
+            gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
+                                          GTK_WINDOW (toplevel));
+        }
+#endif
+
       gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
       gtk_widget_show (GTK_WIDGET (tooltip->current_window));
     }