diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2014-08-22 13:13:50 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2014-08-28 16:41:14 +0200 |
commit | 3df8b95e0efd024588786aff7229a855b7ba693e (patch) | |
tree | f76506b6b3e53db4e16007213a5a0e9075575ddb /gtk/gtktooltip.c | |
parent | 68d6968955e8e744f21e286385b0b8cfde79833b (diff) | |
download | gtk+-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.c | 17 |
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 |