From 163cd36ccc1257aac8201ff864b7d75ba939f70f Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 2 Mar 2019 22:46:46 +0100 Subject: [PATCH] Rename -n/--no-window to -N/--no-display The description of scrcpy is "Display and control your Android device". We want an option to disable display, another one to disable control. For naming consistency, name it --no-display. Also change the shortname to -N, so that we can use -n for --no-control later. --- README.md | 4 ++-- app/src/main.c | 27 ++++++++++++++------------- app/src/scrcpy.c | 2 +- app/src/scrcpy.h | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ed40f21a..a36c81f8 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,8 @@ scrcpy -r file.mkv To disable mirroring while recording: ```bash -scrcpy --no-window --record file.mp4 -scrcpy -nr file.mkv +scrcpy --no-display --record file.mp4 +scrcpy -Nr file.mkv # interrupt recording with Ctrl+C ``` diff --git a/app/src/main.c b/app/src/main.c index d7816c76..d39fcd77 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -16,7 +16,7 @@ struct args { const char *record_filename; enum recorder_format record_format; SDL_bool fullscreen; - SDL_bool no_window; + SDL_bool no_display; SDL_bool help; SDL_bool version; SDL_bool show_touches; @@ -58,8 +58,9 @@ static void usage(const char *arg0) { " is preserved.\n" " Default is %d%s.\n" "\n" - " -n, --no-window\n" - " Do not show window (only when screen recording is enabled).\n" + " -N, --no-display\n" + " Do not display device (only when screen recording is\n" + " enabled).\n" "\n" " -p, --port port\n" " Set the TCP port the client listens on.\n" @@ -276,7 +277,7 @@ parse_args(struct args *args, int argc, char *argv[]) { {"fullscreen", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"max-size", required_argument, NULL, 'm'}, - {"no-window", no_argument, NULL, 'n'}, + {"no-display", no_argument, NULL, 'N'}, {"port", required_argument, NULL, 'p'}, {"record", required_argument, NULL, 'r'}, {"record-format", required_argument, NULL, 'f'}, @@ -286,7 +287,7 @@ parse_args(struct args *args, int argc, char *argv[]) { {NULL, 0, NULL, 0 }, }; int c; - while ((c = getopt_long(argc, argv, "b:c:fF:hm:np:r:s:tTv", long_options, + while ((c = getopt_long(argc, argv, "b:c:fF:hm:Np:r:s:tTv", long_options, NULL)) != -1) { switch (c) { case 'b': @@ -313,8 +314,8 @@ parse_args(struct args *args, int argc, char *argv[]) { return SDL_FALSE; } break; - case 'n': - args->no_window = SDL_TRUE; + case 'N': + args->no_display = SDL_TRUE; break; case 'p': if (!parse_port(optarg, &args->port)) { @@ -342,13 +343,13 @@ parse_args(struct args *args, int argc, char *argv[]) { } } - if (args->no_window && !args->record_filename) { - LOGE("-n/--no-window requires screen recording (-r/--record)"); + if (args->no_display && !args->record_filename) { + LOGE("-N/--no-display requires screen recording (-r/--record)"); return SDL_FALSE; } - if (args->no_window && args->fullscreen) { - LOGE("-f/--fullscreen-window is incompatible with -n/--no-window"); + if (args->no_display && args->fullscreen) { + LOGE("-f/--fullscreen-window is incompatible with -N/--no-display"); return SDL_FALSE; } @@ -395,7 +396,7 @@ main(int argc, char *argv[]) { .max_size = DEFAULT_MAX_SIZE, .bit_rate = DEFAULT_BIT_RATE, .always_on_top = SDL_FALSE, - .no_window = SDL_FALSE, + .no_display = SDL_FALSE, }; if (!parse_args(&args, argc, argv)) { return 1; @@ -434,7 +435,7 @@ main(int argc, char *argv[]) { .show_touches = args.show_touches, .fullscreen = args.fullscreen, .always_on_top = args.always_on_top, - .no_window = args.no_window, + .no_display = args.no_display, }; int res = scrcpy(&options) ? 0 : 1; diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 03d24bc7..11349807 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -247,7 +247,7 @@ scrcpy(const struct scrcpy_options *options) { goto finally_destroy_server; } - SDL_bool display = !options->no_window; + SDL_bool display = !options->no_display; struct decoder *dec = NULL; if (display) { diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index ee3160cd..7f4fc313 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -15,7 +15,7 @@ struct scrcpy_options { SDL_bool show_touches; SDL_bool fullscreen; SDL_bool always_on_top; - SDL_bool no_window; + SDL_bool no_display; }; SDL_bool