diff options
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; | |||
84 | static cairo_surface_t *select_image(struct swaylock_state *state, | 84 | static cairo_surface_t *select_image(struct swaylock_state *state, |
85 | struct swaylock_surface *surface); | 85 | struct swaylock_surface *surface); |
86 | 86 | ||
87 | static bool surface_is_opaque(struct swaylock_surface *surface) { | ||
88 | if (surface->image) { | ||
89 | return cairo_surface_get_content(surface->image) == CAIRO_CONTENT_COLOR; | ||
90 | } | ||
91 | return (surface->state->args.color & 0xff) == 0xff; | ||
92 | } | ||
93 | |||
87 | static void create_layer_surface(struct swaylock_surface *surface) { | 94 | static void create_layer_surface(struct swaylock_surface *surface) { |
88 | struct swaylock_state *state = surface->state; | 95 | struct swaylock_state *state = surface->state; |
89 | 96 | ||
@@ -108,6 +115,17 @@ static void create_layer_surface(struct swaylock_surface *surface) { | |||
108 | surface->layer_surface, true); | 115 | surface->layer_surface, true); |
109 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, | 116 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, |
110 | &layer_surface_listener, surface); | 117 | &layer_surface_listener, surface); |
118 | |||
119 | if (surface_is_opaque(surface) && | ||
120 | surface->state->args.mode != BACKGROUND_MODE_CENTER && | ||
121 | surface->state->args.mode != BACKGROUND_MODE_FIT) { | ||
122 | struct wl_region *region = | ||
123 | wl_compositor_create_region(surface->state->compositor); | ||
124 | wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX); | ||
125 | wl_surface_set_opaque_region(surface->surface, region); | ||
126 | wl_region_destroy(region); | ||
127 | } | ||
128 | |||
111 | wl_surface_commit(surface->surface); | 129 | wl_surface_commit(surface->surface); |
112 | } | 130 | } |
113 | 131 | ||