Commit 4da945dc authored by Jasper St. Pierre's avatar Jasper St. Pierre

widget: Don't queue redraws for properties that don't affect anything

Properties like transition-property might change when hovering over
something, even if the property itself does not change. These properties
don't affect drawing, so don't queue redraws for them.
parent 36c0c9d0
......@@ -134,6 +134,15 @@ typedef enum {
GTK_CSS_AFFECTS_SIZE = (1 << 9)
} GtkCssAffects;
#define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_FOREGROUND | \
GTK_CSS_AFFECTS_BACKGROUND | \
GTK_CSS_AFFECTS_BORDER | \
GTK_CSS_AFFECTS_FONT | \
GTK_CSS_AFFECTS_TEXT | \
GTK_CSS_AFFECTS_TEXT_ATTRS | \
GTK_CSS_AFFECTS_ICON | \
GTK_CSS_AFFECTS_OUTLINE)
enum { /*< skip >*/
GTK_CSS_PROPERTY_COLOR,
GTK_CSS_PROPERTY_DPI,
......
......@@ -8250,14 +8250,17 @@ gtk_widget_real_style_updated (GtkWidget *widget)
if (widget->priv->anchored)
{
static GtkBitmask *affects_size = NULL;
static GtkBitmask *affects_size, *affects_redraw;
if (G_UNLIKELY (affects_size == NULL))
affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
{
affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
affects_redraw = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_REDRAW);
}
if (changes == NULL || _gtk_bitmask_intersects (changes, affects_size))
gtk_widget_queue_resize (widget);
else
else if (_gtk_bitmask_intersects (changes, affects_redraw))
gtk_widget_queue_draw (widget);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment