Detect opaque lockscreen when using a solid color

This commit is contained in:
Ryan Dwyer 2018-07-07 00:17:08 +10:00
parent 58b2c8ed14
commit 3b842f4eed
2 changed files with 7 additions and 4 deletions

View file

@ -934,7 +934,7 @@ bool output_has_opaque_lockscreen(struct sway_output *output,
.x2 = output->swayc->current.swayc_width, .x2 = output->swayc->current.swayc_width,
.y2 = output->swayc->current.swayc_height, .y2 = output->swayc->current.swayc_height,
}; };
if (pixman_region32_contains_rectangle(&wlr_surface->current->opaque, if (pixman_region32_contains_rectangle(&wlr_surface->current.opaque,
&output_box)) { &output_box)) {
return true; return true;
} }

View file

@ -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, static cairo_surface_t *select_image(struct swaylock_state *state,
struct swaylock_surface *surface); struct swaylock_surface *surface);
static bool image_is_opaque(cairo_surface_t *image) { static bool surface_is_opaque(struct swaylock_surface *surface) {
return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR; 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) { 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, zwlr_layer_surface_v1_add_listener(surface->layer_surface,
&layer_surface_listener, 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_CENTER &&
surface->state->args.mode != BACKGROUND_MODE_FIT) { surface->state->args.mode != BACKGROUND_MODE_FIT) {
struct wl_region *region = struct wl_region *region =