diff --git a/clutter/clutter-canvas.c b/clutter/clutter-canvas.c index 64c135d4b..c0122ac98 100644 --- a/clutter/clutter-canvas.c +++ b/clutter/clutter-canvas.c @@ -115,12 +115,12 @@ clutter_cairo_context_draw_marshaller (GClosure *closure, cairo_save (cr); - _clutter_marshal_BOOLEAN__BOXED (closure, - return_value, - n_param_values, - param_values, - invocation_hint, - marshal_data); + _clutter_marshal_BOOLEAN__BOXED_INT_INT (closure, + return_value, + n_param_values, + param_values, + invocation_hint, + marshal_data); cairo_restore (cr); } @@ -238,6 +238,8 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) * ClutterCanvas::draw: * @canvas: the #ClutterCanvas that emitted the signal * @cr: the Cairo context used to draw + * @width: the width of the @canvas + * @height: the height of the @canvas * * The #ClutterCanvas::draw signal is emitted each time a canvas is * invalidated. @@ -258,8 +260,10 @@ clutter_canvas_class_init (ClutterCanvasClass *klass) G_STRUCT_OFFSET (ClutterCanvasClass, draw), _clutter_boolean_handled_accumulator, NULL, clutter_cairo_context_draw_marshaller, - G_TYPE_BOOLEAN, 1, - CAIRO_GOBJECT_TYPE_CONTEXT); + G_TYPE_BOOLEAN, 3, + CAIRO_GOBJECT_TYPE_CONTEXT, + G_TYPE_INT, + G_TYPE_INT); gobject_class->set_property = clutter_canvas_set_property; gobject_class->get_property = clutter_canvas_get_property; @@ -372,7 +376,9 @@ clutter_canvas_emit_draw (ClutterCanvas *self) self->priv->cr = cr = cairo_create (surface); - g_signal_emit (self, canvas_signals[DRAW], 0, cr, &res); + g_signal_emit (self, canvas_signals[DRAW], 0, + cr, priv->width, priv->height, + &res); self->priv->cr = NULL; cairo_destroy (cr); diff --git a/clutter/clutter-canvas.h b/clutter/clutter-canvas.h index 02ed0d6bb..26cc8d372 100644 --- a/clutter/clutter-canvas.h +++ b/clutter/clutter-canvas.h @@ -73,7 +73,9 @@ struct _ClutterCanvasClass /*< public >*/ gboolean (* draw) (ClutterCanvas *canvas, - cairo_t *cr); + cairo_t *cr, + int width, + int height); /*< private >*/ gpointer _padding[16]; diff --git a/clutter/clutter-content.c b/clutter/clutter-content.c index c4046205c..26d8f2672 100644 --- a/clutter/clutter-content.c +++ b/clutter/clutter-content.c @@ -173,6 +173,8 @@ clutter_content_invalidate (ClutterContent *content) g_return_if_fail (CLUTTER_IS_CONTENT (content)); + CLUTTER_CONTENT_GET_IFACE (content)->invalidate (content); + actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors); if (actors == NULL) return; @@ -186,8 +188,6 @@ clutter_content_invalidate (ClutterContent *content) clutter_actor_queue_redraw (actor); } - - CLUTTER_CONTENT_GET_IFACE (content)->invalidate (content); } /*< private > diff --git a/clutter/clutter-marshal.list b/clutter/clutter-marshal.list index 8f9e0f853..509aa0bb1 100644 --- a/clutter/clutter-marshal.list +++ b/clutter/clutter-marshal.list @@ -1,4 +1,5 @@ BOOLEAN:BOXED +BOOLEAN:BOXED,INT,INT BOOLEAN:OBJECT,ENUM BOOLEAN:STRING,UINT,FLAGS BOOLEAN:OBJECT diff --git a/tests/interactive/test-canvas.c b/tests/interactive/test-canvas.c index 61038ef31..18d7f164b 100644 --- a/tests/interactive/test-canvas.c +++ b/tests/interactive/test-canvas.c @@ -5,9 +5,10 @@ static gboolean draw_clock (ClutterCanvas *canvas, - cairo_t *cr) + cairo_t *cr, + int width, + int height) { - float width, height; GDateTime *now; float hours, minutes, seconds; ClutterColor color; @@ -31,9 +32,6 @@ draw_clock (ClutterCanvas *canvas, cairo_set_operator (cr, CAIRO_OPERATOR_OVER); /* scale the modelview to the size of the surface */ - clutter_content_get_preferred_size (CLUTTER_CONTENT (canvas), - &width, - &height); cairo_scale (cr, width, height); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); @@ -108,6 +106,9 @@ test_canvas_main (int argc, char *argv[]) clutter_actor_set_content (actor, canvas); clutter_actor_add_child (stage, actor); + /* the actor now owns the canvas */ + g_object_unref (canvas); + /* bind the size of the actor to that of the stage */ clutter_actor_add_constraint (actor, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0));