Skip to content

Commit

Permalink
Add option to add outputs as choice boxes.
Browse files Browse the repository at this point in the history
Alternative to emersion#60
  • Loading branch information
tmccombs committed Aug 24, 2020
1 parent c1854a7 commit 99d5119
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 99d5119

Please sign in to comment.