diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-07 00:17:08 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-07 00:17:08 +1000 |
commit | 3b842f4eed7276f44b0a9154976ecfeef07aa867 (patch) | |
tree | 235dd57784778409413e911064bf830cf40c0689 | |
parent | Use infinite opaque region in swaylock (diff) | |
download | sway-3b842f4eed7276f44b0a9154976ecfeef07aa867.tar.gz sway-3b842f4eed7276f44b0a9154976ecfeef07aa867.tar.zst sway-3b842f4eed7276f44b0a9154976ecfeef07aa867.zip |
Detect opaque lockscreen when using a solid color
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | swaylock/main.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index fa85d260..329632b6 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -934,7 +934,7 @@ bool output_has_opaque_lockscreen(struct sway_output *output, | |||
934 | .x2 = output->swayc->current.swayc_width, | 934 | .x2 = output->swayc->current.swayc_width, |
935 | .y2 = output->swayc->current.swayc_height, | 935 | .y2 = output->swayc->current.swayc_height, |
936 | }; | 936 | }; |
937 | if (pixman_region32_contains_rectangle(&wlr_surface->current->opaque, | 937 | if (pixman_region32_contains_rectangle(&wlr_surface->current.opaque, |
938 | &output_box)) { | 938 | &output_box)) { |
939 | return true; | 939 | return true; |
940 | } | 940 | } |
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; | |||
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 image_is_opaque(cairo_surface_t *image) { | 87 | static bool surface_is_opaque(struct swaylock_surface *surface) { |
88 | return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR; | 88 | if (surface->image) { |
89 | return cairo_surface_get_content(surface->image) == CAIRO_CONTENT_COLOR; | ||
90 | } | ||
91 | return (surface->state->args.color & 0xff) == 0xff; | ||
89 | } | 92 | } |
90 | 93 | ||
91 | static void create_layer_surface(struct swaylock_surface *surface) { | 94 | static void create_layer_surface(struct swaylock_surface *surface) { |
@@ -113,7 +116,7 @@ static void create_layer_surface(struct swaylock_surface *surface) { | |||
113 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, | 116 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, |
114 | &layer_surface_listener, surface); | 117 | &layer_surface_listener, surface); |
115 | 118 | ||
116 | if (image_is_opaque(surface->image) && | 119 | if (surface_is_opaque(surface) && |
117 | surface->state->args.mode != BACKGROUND_MODE_CENTER && | 120 | surface->state->args.mode != BACKGROUND_MODE_CENTER && |
118 | surface->state->args.mode != BACKGROUND_MODE_FIT) { | 121 | surface->state->args.mode != BACKGROUND_MODE_FIT) { |
119 | struct wl_region *region = | 122 | struct wl_region *region = |