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:
parent
db6644f1f9
commit
163cd36ccc
4 changed files with 18 additions and 17 deletions
|
@ -168,8 +168,8 @@ scrcpy -r file.mkv
|
||||||
To disable mirroring while recording:
|
To disable mirroring while recording:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --no-window --record file.mp4
|
scrcpy --no-display --record file.mp4
|
||||||
scrcpy -nr file.mkv
|
scrcpy -Nr file.mkv
|
||||||
# interrupt recording with Ctrl+C
|
# interrupt recording with Ctrl+C
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct args {
|
||||||
const char *record_filename;
|
const char *record_filename;
|
||||||
enum recorder_format record_format;
|
enum recorder_format record_format;
|
||||||
SDL_bool fullscreen;
|
SDL_bool fullscreen;
|
||||||
SDL_bool no_window;
|
SDL_bool no_display;
|
||||||
SDL_bool help;
|
SDL_bool help;
|
||||||
SDL_bool version;
|
SDL_bool version;
|
||||||
SDL_bool show_touches;
|
SDL_bool show_touches;
|
||||||
|
@ -58,8 +58,9 @@ static void usage(const char *arg0) {
|
||||||
" is preserved.\n"
|
" is preserved.\n"
|
||||||
" Default is %d%s.\n"
|
" Default is %d%s.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -n, --no-window\n"
|
" -N, --no-display\n"
|
||||||
" Do not show window (only when screen recording is enabled).\n"
|
" Do not display device (only when screen recording is\n"
|
||||||
|
" enabled).\n"
|
||||||
"\n"
|
"\n"
|
||||||
" -p, --port port\n"
|
" -p, --port port\n"
|
||||||
" Set the TCP port the client listens on.\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'},
|
{"fullscreen", no_argument, NULL, 'f'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{"max-size", required_argument, NULL, 'm'},
|
{"max-size", required_argument, NULL, 'm'},
|
||||||
{"no-window", no_argument, NULL, 'n'},
|
{"no-display", no_argument, NULL, 'N'},
|
||||||
{"port", required_argument, NULL, 'p'},
|
{"port", required_argument, NULL, 'p'},
|
||||||
{"record", required_argument, NULL, 'r'},
|
{"record", required_argument, NULL, 'r'},
|
||||||
{"record-format", required_argument, NULL, 'f'},
|
{"record-format", required_argument, NULL, 'f'},
|
||||||
|
@ -286,7 +287,7 @@ parse_args(struct args *args, int argc, char *argv[]) {
|
||||||
{NULL, 0, NULL, 0 },
|
{NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
int c;
|
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) {
|
NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -313,8 +314,8 @@ parse_args(struct args *args, int argc, char *argv[]) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'N':
|
||||||
args->no_window = SDL_TRUE;
|
args->no_display = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (!parse_port(optarg, &args->port)) {
|
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) {
|
if (args->no_display && !args->record_filename) {
|
||||||
LOGE("-n/--no-window requires screen recording (-r/--record)");
|
LOGE("-N/--no-display requires screen recording (-r/--record)");
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->no_window && args->fullscreen) {
|
if (args->no_display && args->fullscreen) {
|
||||||
LOGE("-f/--fullscreen-window is incompatible with -n/--no-window");
|
LOGE("-f/--fullscreen-window is incompatible with -N/--no-display");
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +396,7 @@ main(int argc, char *argv[]) {
|
||||||
.max_size = DEFAULT_MAX_SIZE,
|
.max_size = DEFAULT_MAX_SIZE,
|
||||||
.bit_rate = DEFAULT_BIT_RATE,
|
.bit_rate = DEFAULT_BIT_RATE,
|
||||||
.always_on_top = SDL_FALSE,
|
.always_on_top = SDL_FALSE,
|
||||||
.no_window = SDL_FALSE,
|
.no_display = SDL_FALSE,
|
||||||
};
|
};
|
||||||
if (!parse_args(&args, argc, argv)) {
|
if (!parse_args(&args, argc, argv)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -434,7 +435,7 @@ main(int argc, char *argv[]) {
|
||||||
.show_touches = args.show_touches,
|
.show_touches = args.show_touches,
|
||||||
.fullscreen = args.fullscreen,
|
.fullscreen = args.fullscreen,
|
||||||
.always_on_top = args.always_on_top,
|
.always_on_top = args.always_on_top,
|
||||||
.no_window = args.no_window,
|
.no_display = args.no_display,
|
||||||
};
|
};
|
||||||
int res = scrcpy(&options) ? 0 : 1;
|
int res = scrcpy(&options) ? 0 : 1;
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ scrcpy(const struct scrcpy_options *options) {
|
||||||
goto finally_destroy_server;
|
goto finally_destroy_server;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool display = !options->no_window;
|
SDL_bool display = !options->no_display;
|
||||||
|
|
||||||
struct decoder *dec = NULL;
|
struct decoder *dec = NULL;
|
||||||
if (display) {
|
if (display) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ struct scrcpy_options {
|
||||||
SDL_bool show_touches;
|
SDL_bool show_touches;
|
||||||
SDL_bool fullscreen;
|
SDL_bool fullscreen;
|
||||||
SDL_bool always_on_top;
|
SDL_bool always_on_top;
|
||||||
SDL_bool no_window;
|
SDL_bool no_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
SDL_bool
|
SDL_bool
|
||||||
|
|
Loading…
Reference in a new issue