diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-07-06 08:35:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-06 08:35:02 -0700 |
commit | 55c54bb63b82ee75e1893b48b3ce18f7317c6199 (patch) | |
tree | 5543062b41b496e6caabf355c545eb3f7f5c044f /swaylock/main.c | |
parent | b8ee88344a5e2869fd3ce04762eda305dc5bf62e (diff) | |
parent | 464d4d58892597f31da3fcdbcfcd7928643a9ec3 (diff) | |
download | sway-55c54bb63b82ee75e1893b48b3ce18f7317c6199.tar.xz |
Merge pull request #2182 from RyanDwyer/lockscreen-performance
Don't send frame done to surfaces behind lockscreen
Diffstat (limited to 'swaylock/main.c')
-rw-r--r-- | swaylock/main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index f31ed679..1c0cef2b 100644 --- a/swaylock/main.c +++ b/swaylock/main.c @@ -84,6 +84,13 @@ static const struct zwlr_layer_surface_v1_listener layer_surface_listener; static cairo_surface_t *select_image(struct swaylock_state *state, struct swaylock_surface *surface); +static bool surface_is_opaque(struct swaylock_surface *surface) { + if (surface->image) { + return cairo_surface_get_content(surface->image) == CAIRO_CONTENT_COLOR; + } + return (surface->state->args.color & 0xff) == 0xff; +} + static void create_layer_surface(struct swaylock_surface *surface) { struct swaylock_state *state = surface->state; @@ -108,6 +115,17 @@ static void create_layer_surface(struct swaylock_surface *surface) { surface->layer_surface, true); zwlr_layer_surface_v1_add_listener(surface->layer_surface, &layer_surface_listener, surface); + + if (surface_is_opaque(surface) && + 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, INT32_MAX, INT32_MAX); + wl_surface_set_opaque_region(surface->surface, region); + wl_region_destroy(region); + } + wl_surface_commit(surface->surface); } |