From f1fadef923ef8b1278bf2e380ab639f32c0cf79b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 3 Jul 2018 18:14:46 +1000 Subject: [PATCH] Use pixman_region32_contains_rectangle --- sway/desktop/output.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sway/desktop/output.c b/sway/desktop/output.c index a6b2ebc21..fa85d260a 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -930,16 +930,13 @@ bool output_has_opaque_lockscreen(struct sway_output *output, if (wlr_surface->resource->client != seat->exclusive_client) { continue; } - int nrects; - pixman_box32_t *rects = - pixman_region32_rectangles(&wlr_surface->current->opaque, &nrects); - for (int i = 0; i < nrects; ++i) { - pixman_box32_t *rect = &rects[i]; - if (rect->x1 <= 0 && rect->y1 <= 0 && - rect->x2 >= output->swayc->current.swayc_width && - rect->y2 >= output->swayc->current.swayc_height) { - return true; - } + pixman_box32_t output_box = { + .x2 = output->swayc->current.swayc_width, + .y2 = output->swayc->current.swayc_height, + }; + if (pixman_region32_contains_rectangle(&wlr_surface->current->opaque, + &output_box)) { + return true; } } return false;