widget: Queue a draw when we need to

The code in gtk_widget_real_css_changed assumes that
queue_resize > queue_allocate > queue_draw, but the
second one is not really true. These days, we happily
keep reusing the same render node even when the child
allocation is changed.

So, if a css change has flags that tell us we should
redraw, we need to queue a draw, otherwise we might
end up reusing an outdated render node.

This fixes spinners staying visible when they stop
spinning, despite the theme setting their opacity
to 0.
This commit is contained in:
Matthias Clasen 2020-08-23 17:07:37 -04:00
parent dc963dcbcb
commit 40d7092f4a

View File

@ -4674,7 +4674,8 @@ gtk_widget_real_css_changed (GtkWidget *widget,
{ {
gtk_widget_queue_allocate (priv->parent); gtk_widget_queue_allocate (priv->parent);
} }
else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW) ||
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW) ||
(has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CONTENT))) (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CONTENT)))
{ {
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);