aboutsummaryrefslogtreecommitdiff
path: root/swaylock/main.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-07-07 00:17:08 +1000
committerFurkan Sahin <furkan-dev@proton.me>2018-07-07 00:17:08 +1000
commit3e345707d8d10fbafd41b4a7458356c8cfd8141c (patch)
tree235dd57784778409413e911064bf830cf40c0689 /swaylock/main.c
parentf644fbaf56dea4f70d0e53c1a7036b8ef6ea4d07 (diff)
Detect opaque lockscreen when using a solid color
Diffstat (limited to 'swaylock/main.c')
-rw-r--r--swaylock/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index a2a8a36e..1c0cef2b 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -84,8 +84,11 @@ 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 image_is_opaque(cairo_surface_t *image) {
- return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR;
+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) {
@@ -113,7 +116,7 @@ static void create_layer_surface(struct swaylock_surface *surface) {
zwlr_layer_surface_v1_add_listener(surface->layer_surface,
&layer_surface_listener, surface);
- if (image_is_opaque(surface->image) &&
+ if (surface_is_opaque(surface) &&
surface->state->args.mode != BACKGROUND_MODE_CENTER &&
surface->state->args.mode != BACKGROUND_MODE_FIT) {
struct wl_region *region =