diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-23 21:00:04 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2011-06-23 21:00:04 -0400 |
commit | b8a983395da84fea468ebccc1e65a684e3b9a4b0 (patch) | |
tree | 9cd8b805e3c367cbfc238d31a68eef1d0542612a | |
parent | 8b72f604788ef3c596695aede5f773a401b2e0df (diff) |
compositor: Add helper to damage surface below
-rw-r--r-- | compositor/compositor.c | 25 | ||||
-rw-r--r-- | compositor/compositor.h | 3 | ||||
-rw-r--r-- | compositor/shell.c | 2 |
3 files changed, 25 insertions, 5 deletions
diff --git a/compositor/compositor.c b/compositor/compositor.c index 018be23..99b2946 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -285,6 +285,23 @@ wlsc_surface_damage(struct wlsc_surface *surface) surface->width, surface->height); } +WL_EXPORT void +wlsc_surface_damage_below(struct wlsc_surface *surface) +{ + struct wlsc_surface *below; + + if (surface->link.next == &surface->compositor->surface_list) + return; + + below = container_of(surface->link.next, struct wlsc_surface, link); + + pixman_region32_union_rect(&below->damage, + &below->damage, + surface->x, surface->y, + surface->width, surface->height); + wlsc_compositor_schedule_repaint(surface->compositor); +} + WL_EXPORT uint32_t wlsc_compositor_get_time(void) { @@ -302,7 +319,7 @@ destroy_surface(struct wl_resource *resource, struct wl_client *client) container_of(resource, struct wlsc_surface, surface.resource); struct wlsc_compositor *compositor = surface->compositor; - wlsc_surface_damage(surface); + wlsc_surface_damage_below(surface); wl_list_remove(&surface->link); if (surface->saved_texture == 0) @@ -951,7 +968,7 @@ surface_attach(struct wl_client *client, * surface. Anything covered by the new surface will be * damaged by the client. */ if (es->buffer) - wlsc_surface_damage(es); + wlsc_surface_damage_below(es); buffer->busy_count++; wlsc_buffer_post_release(es->buffer); @@ -995,7 +1012,7 @@ static void wlsc_input_device_attach(struct wlsc_input_device *device, int x, int y, int width, int height) { - wlsc_surface_damage(device->sprite); + wlsc_surface_damage_below(device->sprite); device->hotspot_x = x; device->hotspot_y = y; @@ -1236,7 +1253,7 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y) time, x, y, sx, sy); } - wlsc_surface_damage(wd->sprite); + wlsc_surface_damage_below(wd->sprite); wd->sprite->x = device->x - wd->hotspot_x; wd->sprite->y = device->y - wd->hotspot_y; diff --git a/compositor/compositor.h b/compositor/compositor.h index 643ca1d..e2cf9ef 100644 --- a/compositor/compositor.h +++ b/compositor/compositor.h @@ -326,6 +326,9 @@ void wlsc_surface_damage(struct wlsc_surface *surface); void +wlsc_surface_damage_below(struct wlsc_surface *surface); + +void wlsc_surface_damage_rectangle(struct wlsc_surface *surface, int32_t x, int32_t y, int32_t width, int32_t height); diff --git a/compositor/shell.c b/compositor/shell.c index 388ccac..b1e780c 100644 --- a/compositor/shell.c +++ b/compositor/shell.c @@ -46,7 +46,7 @@ move_grab_motion(struct wl_grab *grab, struct wlsc_move_grab *move = (struct wlsc_move_grab *) grab; struct wlsc_surface *es = move->surface; - wlsc_surface_damage(es); + wlsc_surface_damage_below(es); es->x = x + move->dx; es->y = y + move->dy; wlsc_surface_assign_output(es); |