diff options
author | Daniel De Graaf <code@danieldg.net> | 2022-03-08 21:14:26 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-04-29 09:06:36 +0200 |
commit | 519038a7e903caae731007b276f5666a341498e9 (patch) | |
tree | b62cb6728503c5e0940c08bb8cb30b81aab9e830 /sway/desktop/render.c | |
parent | 70d30ac72b93c19813f6574025fb4723845ed6a4 (diff) |
Implement ext-session-lock-v1
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 02397c05..ed9ad490 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -1056,6 +1056,41 @@ void output_render(struct sway_output *output, struct timespec *when, wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); } + if (server.session_lock.locked) { + float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; + if (server.session_lock.lock == NULL) { + // abandoned lock -> red BG + clear_color[0] = 1.f; + } + int nrects; + pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects); + for (int i = 0; i < nrects; ++i) { + scissor_output(wlr_output, &rects[i]); + wlr_renderer_clear(renderer, clear_color); + } + + if (server.session_lock.lock != NULL) { + struct render_data data = { + .damage = damage, + .alpha = 1.0f, + }; + + struct wlr_session_lock_surface_v1 *lock_surface; + wl_list_for_each(lock_surface, &server.session_lock.lock->surfaces, link) { + if (lock_surface->output != wlr_output) { + continue; + } + if (!lock_surface->mapped) { + continue; + } + + output_surface_for_each_surface(output, lock_surface->surface, + 0.0, 0.0, render_surface_iterator, &data); + } + } + goto renderer_end; + } + if (output_has_opaque_overlay_layer_surface(output)) { goto render_overlay; } |