widget: Propagate display changes to the style context
When a root is set on a widget, the style context may already exist. We need to make sure that the style context has the right display set. This was showing up as "css spillover" in the inspector. Closes: #https://gitlab.gnome.org/GNOME/gtk/issues/1817
This commit is contained in:
@@ -2953,6 +2953,9 @@ gtk_widget_root (GtkWidget *widget)
|
||||
|
||||
priv->root = priv->parent->priv->root;
|
||||
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gtk_root_get_display (priv->root));
|
||||
|
||||
GTK_WIDGET_GET_CLASS (widget)->root (widget);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
@@ -2972,6 +2975,9 @@ gtk_widget_unroot (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_GET_CLASS (widget)->unroot (widget);
|
||||
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
|
||||
|
||||
priv->root = NULL;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
|
||||
Reference in New Issue
Block a user