diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-02-13 19:05:26 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-02-14 10:12:10 -0500 |
commit | aa1d08687d5e395649b59640567efb40f6203053 (patch) | |
tree | 63397479dd95a986151b199ef74c4b2f9a978f3e | |
parent | 39f72b38341d2ff2d67c2043ce04915797d24fb8 (diff) | |
download | gtk+-aa1d08687d5e395649b59640567efb40f6203053.tar.gz |
popover: Handle shadow changes
When the box-shadow css property of the contents
widget changes, queue a resize on the popover.
-rw-r--r-- | gtk/gtkpopover.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 217c2f30a2..bf9be24709 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -880,6 +880,15 @@ node_style_changed_cb (GtkCssNode *node, } static void +contents_css_changed (GtkGizmo *contents, + GtkCssStyleChange *change) +{ + if (change == NULL || + gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_BOX_SHADOW)) + gtk_widget_queue_resize (gtk_widget_get_parent (GTK_WIDGET (contents))); +} + +static void gtk_popover_init (GtkPopover *popover) { GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover); @@ -914,6 +923,7 @@ gtk_popover_init (GtkPopover *popover) priv->contents_widget = gtk_gizmo_new ("contents", NULL, NULL, NULL, NULL, (GtkGizmoFocusFunc)gtk_widget_focus_child, (GtkGizmoGrabFocusFunc)gtk_widget_grab_focus_child); + gtk_gizmo_set_css_changed_func (GTK_GIZMO (priv->contents_widget), contents_css_changed); gtk_widget_set_layout_manager (priv->contents_widget, gtk_bin_layout_new ()); gtk_widget_set_parent (priv->contents_widget, GTK_WIDGET (popover)); gtk_widget_set_overflow (priv->contents_widget, GTK_OVERFLOW_HIDDEN); |