summaryrefslogtreecommitdiffstats
path: root/swaylock/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaylock/main.c')
-rw-r--r--swaylock/main.c15
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) {
111 wl_surface_commit(surface->surface); 111 wl_surface_commit(surface->surface);
112} 112}
113 113
114static bool image_is_opaque(cairo_surface_t *image) {
115 return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR;
116}
117
114static void layer_surface_configure(void *data, 118static void layer_surface_configure(void *data,
115 struct zwlr_layer_surface_v1 *layer_surface, 119 struct zwlr_layer_surface_v1 *layer_surface,
116 uint32_t serial, uint32_t width, uint32_t height) { 120 uint32_t serial, uint32_t width, uint32_t height) {
117 struct swaylock_surface *surface = data; 121 struct swaylock_surface *surface = data;
118 surface->width = width; 122 surface->width = width;
119 surface->height = height; 123 surface->height = height;
124
125 if (image_is_opaque(surface->image) &&
126 surface->state->args.mode != BACKGROUND_MODE_CENTER &&
127 surface->state->args.mode != BACKGROUND_MODE_FIT) {
128 struct wl_region *region =
129 wl_compositor_create_region(surface->state->compositor);
130 wl_region_add(region, 0, 0, width, height);
131 wl_surface_set_opaque_region(surface->surface, region);
132 wl_region_destroy(region);
133 }
134
120 zwlr_layer_surface_v1_ack_configure(layer_surface, serial); 135 zwlr_layer_surface_v1_ack_configure(layer_surface, serial);
121 render_frame(surface); 136 render_frame(surface);
122} 137}