From b0077c93fee96ea7a85c6f2f4953c0958ad0b92c Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Fri, 24 Jan 2020 20:19:57 +0000 Subject: [PATCH] Use output name for output selection --- src/main.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main.c b/src/main.c index fea5401..06f2293 100644 --- a/src/main.c +++ b/src/main.c @@ -538,7 +538,7 @@ int wayvnc_usage(FILE* stream, int rc) "\n" " -C,--config= Select a config file.\n" " -c,--frame-capturing=screencopy|dmabuf Select frame capturing backend.\n" -" -o,--output= Select output to capture.\n" +" -o,--output= Select output to capture.\n" " -k,--keyboard= Select keyboard layout.\n" " -s,--seat= Select seat by name.\n" " -h,--help Get help (this text).\n" @@ -558,7 +558,7 @@ int main(int argc, char* argv[]) const char* address = NULL; int port = 0; - int output_id = -1; + const char* output_name = NULL; enum frame_capture_backend_type fcbackend = FRAME_CAPTURE_BACKEND_NONE; const char* seat_name = NULL; @@ -593,7 +593,7 @@ int main(int argc, char* argv[]) } break; case 'o': - output_id = atoi(optarg); + output_name = optarg; break; case 'k': self.kb_layout = optarg; @@ -641,15 +641,9 @@ int main(int argc, char* argv[]) return 1; } - printf("Outputs:\n"); - struct output* out; - wl_list_for_each(out, &self.outputs, link) - printf("%"PRIu32": Make: %s. Model: %s\n", out->id, out->make, - out->model); - - if (output_id >= 0) { - out = output_find_by_id(&self.outputs, output_id); + if (output_name) { + out = output_find_by_name(&self.outputs, output_name); if (!out) { log_error("No such output\n"); goto failure;