[gtk/tooltip-window-allocate: 4/5] popover: Implement set_tooltip
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/tooltip-window-allocate: 4/5] popover: Implement set_tooltip
- Date: Wed, 6 May 2020 02:14:56 +0000 (UTC)
commit b72de7e067309f995fe1fc3cabdb66b2a16779e4
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 5 22:11:13 2020 -0400
popover: Implement set_tooltip
Store the tooltip, and call check_resize on it
when necessary.
gtk/gtkpopover.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 30e03125fe..5e63080be8 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -156,6 +156,8 @@ typedef struct {
GtkCssNode *arrow_node;
GskRenderNode *arrow_render_node;
+ GtkNative *tooltip;
+
GdkPopupLayout *layout;
GdkRectangle final_rect;
GtkPositionType final_position;
@@ -231,6 +233,16 @@ gtk_popover_native_get_surface_transform (GtkNative *native,
_gtk_css_number_value_get (style->size->padding_top, 100);
}
+static void
+gtk_popover_native_set_tooltip (GtkNative *native,
+ GtkNative *tooltip)
+{
+ GtkPopover *popover = GTK_POPOVER (native);
+ GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
+
+ priv->tooltip = tooltip;
+}
+
static gboolean
is_gravity_facing_north (GdkGravity gravity)
{
@@ -1420,6 +1432,9 @@ gtk_popover_size_allocate (GtkWidget *widget,
gtk_popover_update_shape (popover);
g_clear_pointer (&priv->arrow_render_node, gsk_render_node_unref);
}
+
+ if (priv->tooltip && gtk_widget_get_visible (GTK_WIDGET (priv->tooltip)))
+ gtk_native_check_resize (priv->tooltip);
}
static void
@@ -1890,6 +1905,7 @@ gtk_popover_native_interface_init (GtkNativeInterface *iface)
iface->get_renderer = gtk_popover_native_get_renderer;
iface->get_surface_transform = gtk_popover_native_get_surface_transform;
iface->check_resize = gtk_popover_native_check_resize;
+ iface->set_tooltip = gtk_popover_native_set_tooltip;
}
static GtkBuildableIface *parent_buildable_iface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]