summaryrefslogtreecommitdiff
path: root/gtk/gtktooltip.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-08-22 13:13:50 +0200
committerCarlos Garnacho <carlosg@gnome.org>2014-08-28 16:41:14 +0200
commit3df8b95e0efd024588786aff7229a855b7ba693e (patch)
treef76506b6b3e53db4e16007213a5a0e9075575ddb /gtk/gtktooltip.c
parent68d6968955e8e744f21e286385b0b8cfde79833b (diff)
downloadgtk+-3df8b95e0efd024588786aff7229a855b7ba693e.tar.gz
tooltip: Use subsurfaces on wayland
This places tooltips in the right place, and avoids having those attempt to steal the focus. https://bugzilla.gnome.org/show_bug.cgi?id=735531
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r--gtk/gtktooltip.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index c5edfe44fc..f7a6ab98d2 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -183,6 +183,7 @@ gtk_tooltip_init (GtkTooltip *tooltip)
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_TOOLTIP);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
+ gtk_window_set_use_subsurface (GTK_WINDOW (window), TRUE);
g_signal_connect (window, "hide",
G_CALLBACK (gtk_tooltip_window_hide), tooltip);
@@ -881,6 +882,8 @@ static void
gtk_tooltip_set_last_window (GtkTooltip *tooltip,
GdkWindow *window)
{
+ GtkWidget *window_widget = NULL;
+
if (tooltip->last_window == window)
return;
@@ -893,6 +896,20 @@ gtk_tooltip_set_last_window (GtkTooltip *tooltip,
if (window)
g_object_add_weak_pointer (G_OBJECT (tooltip->last_window),
(gpointer *) &tooltip->last_window);
+
+ if (window)
+ gdk_window_get_user_data (window, (gpointer *) &window_widget);
+
+ if (window_widget)
+ window_widget = gtk_widget_get_toplevel (window_widget);
+
+ if (window_widget &&
+ window_widget != tooltip->window &&
+ gtk_widget_is_toplevel (window_widget))
+ gtk_window_set_transient_for (GTK_WINDOW (tooltip->window),
+ GTK_WINDOW (window_widget));
+ else
+ gtk_window_set_transient_for (GTK_WINDOW (tooltip->window), NULL);
}
static gboolean