aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-03 17:29:23 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-07 00:03:49 +1000
commit839c3a550043fd38096a15ff8dcd7de1a084efdc (patch)
tree45d1e8f64e98b4efcd2db6372f97ce74d0032a8d /sway/desktop/output.c
parentDon't send frame done to surfaces behind lockscreen (diff)
downloadsway-839c3a550043fd38096a15ff8dcd7de1a084efdc.tar.gz
sway-839c3a550043fd38096a15ff8dcd7de1a084efdc.tar.zst
sway-839c3a550043fd38096a15ff8dcd7de1a084efdc.zip
Use opaque region to determine if frame done should be sent
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 52bd1666..a6b2ebc2 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -915,6 +915,36 @@ static struct sway_container *output_get_active_workspace(
915 return workspace; 915 return workspace;
916} 916}
917 917
918bool output_has_opaque_lockscreen(struct sway_output *output,
919 struct sway_seat *seat) {
920 if (!seat->exclusive_client) {
921 return false;
922 }
923
924 struct wlr_layer_surface *wlr_layer_surface;
925 wl_list_for_each(wlr_layer_surface, &server.layer_shell->surfaces, link) {
926 if (wlr_layer_surface->output != output->wlr_output) {
927 continue;
928 }
929 struct wlr_surface *wlr_surface = wlr_layer_surface->surface;
930 if (wlr_surface->resource->client != seat->exclusive_client) {
931 continue;
932 }
933 int nrects;
934 pixman_box32_t *rects =
935 pixman_region32_rectangles(&wlr_surface->current->opaque, &nrects);
936 for (int i = 0; i < nrects; ++i) {
937 pixman_box32_t *rect = &rects[i];
938 if (rect->x1 <= 0 && rect->y1 <= 0 &&
939 rect->x2 >= output->swayc->current.swayc_width &&
940 rect->y2 >= output->swayc->current.swayc_height) {
941 return true;
942 }
943 }
944 }
945 return false;
946}
947
918static void render_output(struct sway_output *output, struct timespec *when, 948static void render_output(struct sway_output *output, struct timespec *when,
919 pixman_region32_t *damage) { 949 pixman_region32_t *damage) {
920 struct wlr_output *wlr_output = output->wlr_output; 950 struct wlr_output *wlr_output = output->wlr_output;
@@ -950,7 +980,7 @@ static void render_output(struct sway_output *output, struct timespec *when,
950 struct sway_view *fullscreen_view = workspace->current.ws_fullscreen; 980 struct sway_view *fullscreen_view = workspace->current.ws_fullscreen;
951 struct sway_seat *seat = input_manager_current_seat(input_manager); 981 struct sway_seat *seat = input_manager_current_seat(input_manager);
952 982
953 if (seat->exclusive_client && seat->focused_layer) { 983 if (output_has_opaque_lockscreen(output, seat)) {
954 float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; 984 float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
955 985
956 int nrects; 986 int nrects;
@@ -1103,7 +1133,8 @@ static void send_frame_done(struct sway_output *output, struct timespec *when) {
1103 struct send_frame_done_data data = { 1133 struct send_frame_done_data data = {
1104 .output = output, 1134 .output = output,
1105 .when = when, 1135 .when = when,
1106 .exclusive_client = seat->exclusive_client, 1136 .exclusive_client = output_has_opaque_lockscreen(output, seat) ?
1137 seat->exclusive_client : NULL,
1107 }; 1138 };
1108 1139
1109 struct sway_container *workspace = output_get_active_workspace(output); 1140 struct sway_container *workspace = output_get_active_workspace(output);