diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2018-07-03 17:29:23 +1000 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2018-07-03 17:29:23 +1000 |
| commit | 179c316fb2411940ff175914892806c99ca1f8db (patch) | |
| tree | 45d1e8f64e98b4efcd2db6372f97ce74d0032a8d /swaylock | |
| parent | 252c6e714aaf3b47dc785cd60b16981b2fdc0b52 (diff) | |
Use opaque region to determine if frame done should be sent
Diffstat (limited to 'swaylock')
| -rw-r--r-- | swaylock/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index f31ed679..a7a68e9b 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -111,12 +111,27 @@ static void create_layer_surface(struct swaylock_surface *surface) { wl_surface_commit(surface->surface); } +static bool image_is_opaque(cairo_surface_t *image) { + return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR; +} + static void layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *layer_surface, uint32_t serial, uint32_t width, uint32_t height) { struct swaylock_surface *surface = data; surface->width = width; surface->height = height; + + if (image_is_opaque(surface->image) && + surface->state->args.mode != BACKGROUND_MODE_CENTER && + surface->state->args.mode != BACKGROUND_MODE_FIT) { + struct wl_region *region = + wl_compositor_create_region(surface->state->compositor); + wl_region_add(region, 0, 0, width, height); + wl_surface_set_opaque_region(surface->surface, region); + wl_region_destroy(region); + } + zwlr_layer_surface_v1_ack_configure(layer_surface, serial); render_frame(surface); } |
