summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-01-11 00:08:05 +0000
committerNeil Roberts <neil@linux.intel.com>2012-03-01 11:41:51 +0000
commitc1aac36d35638b00691f20b538289eae9a7cf68a (patch)
tree3d9070257283e3fd985ccee8dc790d3694353f5e
parentb89af8efa3931bb0cb5a7c5c6a01823ab5d6be78 (diff)
downloadclutter-c1aac36d35638b00691f20b538289eae9a7cf68a.tar.gz
wayland-surface: Adds queue-damage-redraw signal
This adds a signal that's emitted whenever a wayland surface is damaged that allows sub-classes to override the default handler to change how clipped redraws are queued if the sub-class doesn't simply draw a rectangle. The signal can also be used just to track damage. Reviewed-by: Neil Roberts <neil@linux.intel.com> Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
-rw-r--r--clutter/wayland/clutter-wayland-surface.c50
-rw-r--r--clutter/wayland/clutter-wayland-surface.h7
2 files changed, 50 insertions, 7 deletions
diff --git a/clutter/wayland/clutter-wayland-surface.c b/clutter/wayland/clutter-wayland-surface.c
index 7ba809d6a..b1934ce95 100644
--- a/clutter/wayland/clutter-wayland-surface.c
+++ b/clutter/wayland/clutter-wayland-surface.c
@@ -62,14 +62,14 @@ enum
static GParamSpec *obj_props[PROP_LAST];
-#if 0
enum
{
+ QUEUE_DAMAGE_REDRAW,
+
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
-#endif
struct _ClutterWaylandSurfacePrivate
{
@@ -243,10 +243,9 @@ clutter_wayland_surface_set_surface (ClutterWaylandSurface *self,
{
free_pipeline (self);
free_surface_buffers (self);
- clutter_wayland_surface_queue_damage_redraw (self,
- 0, 0,
- priv->width,
- priv->height);
+ g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW],
+ 0,
+ 0, 0, priv->width, priv->height);
}
priv->surface = surface;
@@ -449,6 +448,41 @@ clutter_wayland_surface_class_init (ClutterWaylandSurfaceClass *klass)
CLUTTER_PARAM_READWRITE);
obj_props[PROP_COGL_TEXTURE] = pspec;
g_object_class_install_property (object_class, PROP_COGL_TEXTURE, pspec);
+
+ /**
+ * ClutterWaylandSurface::queue-damage-redraw
+ * @texture: the object which received the signal
+ * @x: The top left x position of the damage region
+ * @y: The top left y position of the damage region
+ * @width: The width of the damage region
+ * @height: The height of the damage region
+ *
+ * ::queue-damage-redraw is emitted to notify that some sub-region
+ * of the texture has been changed. This usually means a redraw
+ * needs to be queued for the actor.
+ *
+ * The default handler will queue a clipped redraw in response to
+ * the damage, using the assumption that the pixmap is being painted
+ * to a rectangle covering the transformed allocation of the actor.
+ * If you sub-class and change the paint method so this isn't true
+ * then you must also provide your own damage signal handler to
+ * queue a redraw that blocks this default behaviour.
+ *
+ * Since: 1.10
+ */
+ signals[QUEUE_DAMAGE_REDRAW] =
+ g_signal_new (g_intern_static_string ("queue-damage-redraw"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ClutterWaylandSurfaceClass, queue_damage_redraw),
+ NULL, NULL,
+ _clutter_marshal_VOID__INT_INT_INT_INT,
+ G_TYPE_NONE, 4,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_INT);
+ klass->queue_damage_redraw = clutter_wayland_surface_queue_damage_redraw;
}
/**
@@ -588,7 +622,9 @@ clutter_wayland_surface_damage_buffer (ClutterWaylandSurface *self,
wl_shm_buffer_get_data (buffer));
}
- clutter_wayland_surface_queue_damage_redraw (self, x, y, width, height);
+ g_signal_emit (self, signals[QUEUE_DAMAGE_REDRAW],
+ 0,
+ x, y, width, height);
}
CoglTexture *
diff --git a/clutter/wayland/clutter-wayland-surface.h b/clutter/wayland/clutter-wayland-surface.h
index 54e457231..e5f64a127 100644
--- a/clutter/wayland/clutter-wayland-surface.h
+++ b/clutter/wayland/clutter-wayland-surface.h
@@ -74,6 +74,13 @@ struct _ClutterWaylandSurfaceClass
{
/*< private >*/
ClutterActorClass parent_class;
+
+ /*< public >*/
+ void (*queue_damage_redraw) (ClutterWaylandSurface *texture,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
};
GType clutter_wayland_surface_get_type (void) G_GNUC_CONST;