From ff061b4f30c54dedc5073a588c6c697477b805db Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 7 Nov 2019 09:58:06 +0100 Subject: [PATCH] Deprecate short options for advanced features The short options will be removed in the future (and may be reused for other features). --- README.md | 2 -- app/src/main.c | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ebf593a1..f0717c2a 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,6 @@ This is useful for example to mirror only one eye of the Oculus Go: ```bash scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0) -scrcpy -c 1224:1440:0:0 # short version ``` If `--max-size` is also specified, resizing is applied after cropping. @@ -226,7 +225,6 @@ The window of app can always be above others by: ```bash scrcpy --always-on-top -scrcpy -T # short version ``` diff --git a/app/src/main.c b/app/src/main.c index cd03f195..1d5beb64 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -297,13 +297,16 @@ guess_record_format(const char *filename) { #define OPT_RENDER_EXPIRED_FRAMES 1000 #define OPT_WINDOW_TITLE 1001 #define OPT_PUSH_TARGET 1002 +#define OPT_ALWAYS_ON_TOP 1003 +#define OPT_CROP 1004 +#define OPT_RECORD_FORMAT 1005 static bool parse_args(struct args *args, int argc, char *argv[]) { static const struct option long_options[] = { - {"always-on-top", no_argument, NULL, 'T'}, + {"always-on-top", no_argument, NULL, OPT_ALWAYS_ON_TOP}, {"bit-rate", required_argument, NULL, 'b'}, - {"crop", required_argument, NULL, 'c'}, + {"crop", required_argument, NULL, OPT_CROP}, {"fullscreen", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"max-size", required_argument, NULL, 'm'}, @@ -312,7 +315,7 @@ parse_args(struct args *args, int argc, char *argv[]) { {"port", required_argument, NULL, 'p'}, {"push-target", required_argument, NULL, OPT_PUSH_TARGET}, {"record", required_argument, NULL, 'r'}, - {"record-format", required_argument, NULL, 'F'}, + {"record-format", required_argument, NULL, OPT_RECORD_FORMAT}, {"render-expired-frames", no_argument, NULL, OPT_RENDER_EXPIRED_FRAMES}, {"serial", required_argument, NULL, 's'}, @@ -336,12 +339,18 @@ parse_args(struct args *args, int argc, char *argv[]) { } break; case 'c': + LOGW("Deprecated option -c. Use --crop instead."); + // fall through + case OPT_CROP: opts->crop = optarg; break; case 'f': opts->fullscreen = true; break; case 'F': + LOGW("Deprecated option -F. Use --record-format instead."); + // fall through + case OPT_RECORD_FORMAT: if (!parse_record_format(optarg, &opts->record_format)) { return false; } @@ -378,6 +387,9 @@ parse_args(struct args *args, int argc, char *argv[]) { opts->show_touches = true; break; case 'T': + LOGW("Deprecated option -T. Use --always-on-top instead."); + // fall through + case OPT_ALWAYS_ON_TOP: opts->always_on_top = true; break; case 'v':