diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-03 18:15:02 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-07 00:03:49 +1000 |
commit | 58b2c8ed142ded772382ae7811a217a5590b0c1c (patch) | |
tree | 05ea6e76c1c95e3369a86e70f30ed1b9d316e7b6 /swaylock | |
parent | Use pixman_region32_contains_rectangle (diff) | |
download | sway-58b2c8ed142ded772382ae7811a217a5590b0c1c.tar.gz sway-58b2c8ed142ded772382ae7811a217a5590b0c1c.tar.zst sway-58b2c8ed142ded772382ae7811a217a5590b0c1c.zip |
Use infinite opaque region in swaylock
Diffstat (limited to 'swaylock')
-rw-r--r-- | swaylock/main.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index a7a68e9b..a2a8a36e 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -84,6 +84,10 @@ 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) { | ||
88 | return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR; | ||
89 | } | ||
90 | |||
87 | static void create_layer_surface(struct swaylock_surface *surface) { | 91 | static void create_layer_surface(struct swaylock_surface *surface) { |
88 | struct swaylock_state *state = surface->state; | 92 | struct swaylock_state *state = surface->state; |
89 | 93 | ||
@@ -108,30 +112,26 @@ static void create_layer_surface(struct swaylock_surface *surface) { | |||
108 | surface->layer_surface, true); | 112 | surface->layer_surface, true); |
109 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, | 113 | zwlr_layer_surface_v1_add_listener(surface->layer_surface, |
110 | &layer_surface_listener, surface); | 114 | &layer_surface_listener, surface); |
111 | wl_surface_commit(surface->surface); | ||
112 | } | ||
113 | |||
114 | static bool image_is_opaque(cairo_surface_t *image) { | ||
115 | return cairo_surface_get_content(image) == CAIRO_CONTENT_COLOR; | ||
116 | } | ||
117 | |||
118 | static void layer_surface_configure(void *data, | ||
119 | struct zwlr_layer_surface_v1 *layer_surface, | ||
120 | uint32_t serial, uint32_t width, uint32_t height) { | ||
121 | struct swaylock_surface *surface = data; | ||
122 | surface->width = width; | ||
123 | surface->height = height; | ||
124 | 115 | ||
125 | if (image_is_opaque(surface->image) && | 116 | if (image_is_opaque(surface->image) && |
126 | surface->state->args.mode != BACKGROUND_MODE_CENTER && | 117 | surface->state->args.mode != BACKGROUND_MODE_CENTER && |
127 | surface->state->args.mode != BACKGROUND_MODE_FIT) { | 118 | surface->state->args.mode != BACKGROUND_MODE_FIT) { |
128 | struct wl_region *region = | 119 | struct wl_region *region = |
129 | wl_compositor_create_region(surface->state->compositor); | 120 | wl_compositor_create_region(surface->state->compositor); |
130 | wl_region_add(region, 0, 0, width, height); | 121 | wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX); |
131 | wl_surface_set_opaque_region(surface->surface, region); | 122 | wl_surface_set_opaque_region(surface->surface, region); |
132 | wl_region_destroy(region); | 123 | wl_region_destroy(region); |
133 | } | 124 | } |
134 | 125 | ||
126 | wl_surface_commit(surface->surface); | ||
127 | } | ||
128 | |||
129 | static void layer_surface_configure(void *data, | ||
130 | struct zwlr_layer_surface_v1 *layer_surface, | ||
131 | uint32_t serial, uint32_t width, uint32_t height) { | ||
132 | struct swaylock_surface *surface = data; | ||
133 | surface->width = width; | ||
134 | surface->height = height; | ||
135 | zwlr_layer_surface_v1_ack_configure(layer_surface, serial); | 135 | zwlr_layer_surface_v1_ack_configure(layer_surface, serial); |
136 | render_frame(surface); | 136 | render_frame(surface); |
137 | } | 137 | } |