From 99d51195a592f5749abe23bcba691822734c35e9 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Mon, 24 Aug 2020 01:17:12 -0600 Subject: [PATCH] Add option to add outputs as choice boxes. Alternative to #60 --- main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 6827be9..8ed5062 100644 --- a/main.c +++ b/main.c @@ -741,7 +741,8 @@ int main(int argc, char *argv[]) { int opt; char *format = "%x,%y %wx%h"; - while ((opt = getopt(argc, argv, "hdb:c:s:w:pf:")) != -1) { + bool output_boxes = false; + while ((opt = getopt(argc, argv, "hdb:c:s:w:pof:")) != -1) { switch (opt) { case 'h': printf("%s", usage); @@ -774,6 +775,9 @@ int main(int argc, char *argv[]) { case 'p': state.single_point = true; break; + case 'o': + output_boxes = true; + break; default: printf("%s", usage); return EXIT_FAILURE; @@ -901,6 +905,16 @@ int main(int argc, char *argv[]) { // second roundtrip for xdg-output wl_display_roundtrip(state.display); + if (output_boxes) { + struct slurp_output *box_output; + wl_list_for_each(box_output, &state.outputs, link) { + add_choice_box(&state, &box_output->logical_geometry); + struct slurp_box *new_box; + new_box = wl_container_of(state.boxes.prev, new_box, link); + new_box->label = strdup(new_box->label); // to avoid double free + } + } + struct slurp_seat *seat; wl_list_for_each(seat, &state.seats, link) { seat->cursor_surface =