GtkStyleContext: Fix animation framework to work with the new draw() semantics.
Invalidation region coalescing now happens recursively as draw() runs, and the widget's x/y as now drawing coordinates are 0,0 based.
This commit is contained in:
parent
f9788eb173
commit
c575733eda
@ -1852,7 +1852,9 @@ _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context)
|
_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||||
|
gint rel_x,
|
||||||
|
gint rel_y)
|
||||||
{
|
{
|
||||||
GtkStyleContextPrivate *priv;
|
GtkStyleContextPrivate *priv;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
@ -1885,11 +1887,16 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context)
|
|||||||
cairo_rectangle_int_t *rect;
|
cairo_rectangle_int_t *rect;
|
||||||
|
|
||||||
rect = &g_array_index (info->rectangles, cairo_rectangle_int_t, i);
|
rect = &g_array_index (info->rectangles, cairo_rectangle_int_t, i);
|
||||||
|
rect->x += rel_x;
|
||||||
|
rect->y += rel_y;
|
||||||
|
|
||||||
cairo_region_union_rectangle (info->invalidation_region, rect);
|
cairo_region_union_rectangle (info->invalidation_region, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_array_remove_range (info->rectangles, 0, info->rectangles->len);
|
g_array_remove_range (info->rectangles, 0, info->rectangles->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->animations_invalidated = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -152,7 +152,9 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
|||||||
GType widget_type,
|
GType widget_type,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
|
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
|
||||||
void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context);
|
void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
|
||||||
|
gint rel_x,
|
||||||
|
gint rel_y);
|
||||||
|
|
||||||
/* Animation for state changes */
|
/* Animation for state changes */
|
||||||
void gtk_style_context_state_transition_start (GtkStyleContext *context,
|
void gtk_style_context_state_transition_start (GtkStyleContext *context,
|
||||||
|
@ -4160,7 +4160,6 @@ gtk_widget_realize (GtkWidget *widget)
|
|||||||
GtkWidgetPrivate *priv;
|
GtkWidgetPrivate *priv;
|
||||||
GdkExtensionMode mode;
|
GdkExtensionMode mode;
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (widget->priv->anchored ||
|
g_return_if_fail (widget->priv->anchored ||
|
||||||
@ -5413,6 +5412,8 @@ _gtk_widget_draw_internal (GtkWidget *widget,
|
|||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
gboolean clip_to_size)
|
gboolean clip_to_size)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
if (!gtk_widget_is_drawable (widget))
|
if (!gtk_widget_is_drawable (widget))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -5433,6 +5434,11 @@ _gtk_widget_draw_internal (GtkWidget *widget,
|
|||||||
0, cr,
|
0, cr,
|
||||||
&result);
|
&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
_gtk_style_context_coalesce_animation_areas (context,
|
||||||
|
widget->priv->allocation.x,
|
||||||
|
widget->priv->allocation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5652,7 +5658,6 @@ gtk_widget_send_expose (GtkWidget *widget,
|
|||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
int x, y;
|
int x, y;
|
||||||
gboolean do_clip;
|
gboolean do_clip;
|
||||||
GtkStyleContext *context;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
|
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
|
||||||
g_return_val_if_fail (gtk_widget_get_realized (widget), TRUE);
|
g_return_val_if_fail (gtk_widget_get_realized (widget), TRUE);
|
||||||
@ -5677,9 +5682,6 @@ gtk_widget_send_expose (GtkWidget *widget,
|
|||||||
gtk_cairo_set_event (cr, NULL);
|
gtk_cairo_set_event (cr, NULL);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
|
||||||
_gtk_style_context_coalesce_animation_areas (context);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user