summaryrefslogtreecommitdiff
path: root/clients/nested.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2013-09-08 20:24:14 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-12-04 16:34:07 -0800
commit28557663335c6a50655e8b43f58cee360a1d14fc (patch)
treeddd085b58a0f5c6b3e25584a838cc8fdc74fd9f7 /clients/nested.c
parent15a8d340fdadd4897dfcb102d6d7e3e097ad6d98 (diff)
downloadweston-28557663335c6a50655e8b43f58cee360a1d14fc.tar.gz
nested: Add damage tracking to the nested compositor example
The nested compositor example now responds to damage requests and tracks them in the pending buffer state. This isn't currently used for anything and it is immediately discarded when the surface is commited but it will be used later when the example is converted to use subsurfaces.
Diffstat (limited to 'clients/nested.c')
-rw-r--r--clients/nested.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clients/nested.c b/clients/nested.c
index 23be0e31..b2f59499 100644
--- a/clients/nested.c
+++ b/clients/nested.c
@@ -95,6 +95,9 @@ struct nested_surface {
/* wl_surface.frame */
struct wl_list frame_callback_list;
+
+ /* wl_surface.damage */
+ pixman_region32_t damage;
} pending;
};
@@ -371,6 +374,8 @@ destroy_surface(struct wl_resource *resource)
nested_buffer_reference(&surface->buffer_ref, NULL);
+ pixman_region32_fini(&surface->pending.damage);
+
wl_list_remove(&surface->link);
free(surface);
@@ -472,6 +477,11 @@ surface_damage(struct wl_client *client,
struct wl_resource *resource,
int32_t x, int32_t y, int32_t width, int32_t height)
{
+ struct nested_surface *surface = wl_resource_get_user_data(resource);
+
+ pixman_region32_union_rect(&surface->pending.damage,
+ &surface->pending.damage,
+ x, y, width, height);
}
static void
@@ -522,6 +532,13 @@ surface_set_input_region(struct wl_client *client,
}
static void
+empty_region(pixman_region32_t *region)
+{
+ pixman_region32_fini(region);
+ pixman_region32_init(region);
+}
+
+static void
surface_commit(struct wl_client *client, struct wl_resource *resource)
{
struct nested_surface *surface = wl_resource_get_user_data(resource);
@@ -537,6 +554,9 @@ surface_commit(struct wl_client *client, struct wl_resource *resource)
}
surface->pending.newly_attached = 0;
+ /* wl_surface.damage */
+ empty_region(&surface->pending.damage);
+
/* wl_surface.frame */
wl_list_insert_list(&nested->frame_callback_list,
&surface->pending.frame_callback_list);
@@ -591,6 +611,7 @@ compositor_create_surface(struct wl_client *client,
wl_list_init(&surface->pending.frame_callback_list);
surface->pending.buffer_destroy_listener.notify =
surface_handle_pending_buffer_destroy;
+ pixman_region32_init(&surface->pending.damage);
display_acquire_window_surface(nested->display,
nested->window, NULL);