From 56e6895fcd75a77862e1ee4c3e0f69dd41adfa42 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 18 Dec 2015 19:29:44 -0500 Subject: [PATCH] Implement compositor support for swaylock This makes swaylock more or less work. --- main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 4073da9..82b8873 100644 --- a/main.c +++ b/main.c @@ -108,7 +108,6 @@ int main(int argc, char **argv) { if (!window) { sway_abort("Failed to create surfaces."); } - lock_set_lock_surface(registry->swaylock, output->output, window->surface); list_add(surfaces, window); } @@ -217,7 +216,17 @@ int main(int argc, char **argv) { cairo_surface_destroy(image); - while (wl_display_dispatch(registry->display) != -1); + bool locked = false; + while (wl_display_dispatch(registry->display) != -1) { + if (!locked) { + for (i = 0; i < registry->outputs->length; ++i) { + struct output_state *output = registry->outputs->items[i]; + struct window *window = surfaces->items[i]; + lock_set_lock_surface(registry->swaylock, output->output, window->surface); + } + locked = true; + } + } for (i = 0; i < surfaces->length; ++i) { struct window *window = surfaces->items[i];