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 | xkb_switch_layout: fix relative layout switches (diff) | |
download | sway-519038a7e903caae731007b276f5666a341498e9.tar.gz sway-519038a7e903caae731007b276f5666a341498e9.tar.zst sway-519038a7e903caae731007b276f5666a341498e9.zip |
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, | |||
1056 | wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); | 1056 | wlr_renderer_clear(renderer, (float[]){1, 1, 0, 1}); |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | if (server.session_lock.locked) { | ||
1060 | float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; | ||
1061 | if (server.session_lock.lock == NULL) { | ||
1062 | // abandoned lock -> red BG | ||
1063 | clear_color[0] = 1.f; | ||
1064 | } | ||
1065 | int nrects; | ||
1066 | pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects); | ||
1067 | for (int i = 0; i < nrects; ++i) { | ||
1068 | scissor_output(wlr_output, &rects[i]); | ||
1069 | wlr_renderer_clear(renderer, clear_color); | ||
1070 | } | ||
1071 | |||
1072 | if (server.session_lock.lock != NULL) { | ||
1073 | struct render_data data = { | ||
1074 | .damage = damage, | ||
1075 | .alpha = 1.0f, | ||
1076 | }; | ||
1077 | |||
1078 | struct wlr_session_lock_surface_v1 *lock_surface; | ||
1079 | wl_list_for_each(lock_surface, &server.session_lock.lock->surfaces, link) { | ||
1080 | if (lock_surface->output != wlr_output) { | ||
1081 | continue; | ||
1082 | } | ||
1083 | if (!lock_surface->mapped) { | ||
1084 | continue; | ||
1085 | } | ||
1086 | |||
1087 | output_surface_for_each_surface(output, lock_surface->surface, | ||
1088 | 0.0, 0.0, render_surface_iterator, &data); | ||
1089 | } | ||
1090 | } | ||
1091 | goto renderer_end; | ||
1092 | } | ||
1093 | |||
1059 | if (output_has_opaque_overlay_layer_surface(output)) { | 1094 | if (output_has_opaque_overlay_layer_surface(output)) { |
1060 | goto render_overlay; | 1095 | goto render_overlay; |
1061 | } | 1096 | } |