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.
This commit is contained in:
Romain Vimont 2019-03-02 22:46:46 +01:00
parent db6644f1f9
commit 163cd36ccc
4 changed files with 18 additions and 17 deletions

View file

@ -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
```

View file

@ -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;

View file

@ -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) {

View file

@ -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