[gtk+] tooltip: Use subsurfaces on wayland
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tooltip: Use subsurfaces on wayland
- Date: Thu, 28 Aug 2014 14:42:41 +0000 (UTC)
commit 3df8b95e0efd024588786aff7229a855b7ba693e
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 22 13:13:50 2014 +0200
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
gtk/gtktooltip.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index c5edfe4..f7a6ab9 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]