[gtk/abolish-size-allocate: 4/7] window: Implement set_tooltip
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/abolish-size-allocate: 4/7] window: Implement set_tooltip
- Date: Wed, 6 May 2020 03:15:58 +0000 (UTC)
commit 54f58bfc1cc8349ebfb8114dd04332654db2ee20
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 5 22:10:39 2020 -0400
window: Implement set_tooltip
Store the tooltip, and call check_resize on it
when necessary.
gtk/gtkwindow.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index eebf712115..7b91717ff8 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -264,6 +264,8 @@ typedef struct
GdkToplevelLayout *layout;
GdkCursor *resize_cursor;
+
+ GtkNative *tooltip;
} GtkWindowPrivate;
enum {
@@ -2127,6 +2129,16 @@ gtk_window_native_get_renderer (GtkNative *native)
return priv->renderer;
}
+static void
+gtk_window_native_set_tooltip (GtkNative *native,
+ GtkNative *tooltip)
+{
+ GtkWindow *self = GTK_WINDOW (native);
+ GtkWindowPrivate *priv = gtk_window_get_instance_private (self);
+
+ priv->tooltip = tooltip;
+}
+
static GtkConstraintSolver *
gtk_window_root_get_constraint_solver (GtkRoot *root)
{
@@ -2219,6 +2231,7 @@ gtk_window_native_interface_init (GtkNativeInterface *iface)
iface->get_renderer = gtk_window_native_get_renderer;
iface->get_surface_transform = gtk_window_native_get_surface_transform;
iface->check_resize = gtk_window_native_check_resize;
+ iface->set_tooltip = gtk_window_native_set_tooltip;
}
/**
@@ -5075,13 +5088,15 @@ gtk_window_size_allocate (GtkWidget *widget,
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- GtkWidget *child = priv->child;
GtkAllocation child_allocation;
_gtk_window_set_allocation (window, width, height, &child_allocation);
- if (child && gtk_widget_get_visible (child))
- gtk_widget_size_allocate (child, &child_allocation, -1);
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ gtk_widget_size_allocate (priv->child, &child_allocation, -1);
+
+ if (priv->tooltip && gtk_widget_get_visible (GTK_WIDGET (priv->tooltip)))
+ gtk_native_check_resize (priv->tooltip);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]