From 19271de6c93ad322f53ecc44c8d7fff302e3adf4 Mon Sep 17 00:00:00 2001 From: Philipp Sandhaus Date: Tue, 4 Sep 2018 15:55:20 +0200 Subject: [PATCH 1/2] Added new command line paramter to start in fullscreen --- app/src/main.c | 11 ++++++++++- app/src/scrcpy.c | 5 +++++ app/src/scrcpy.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main.c b/app/src/main.c index 1317da79a6..446c9333a5 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -14,6 +14,7 @@ struct args { SDL_bool help; SDL_bool version; SDL_bool show_touches; + SDL_bool fullscreen; Uint16 port; Uint16 max_size; Uint32 bit_rate; @@ -57,6 +58,9 @@ static void usage(const char *arg0) { " Enable \"show touches\" on start, disable on quit.\n" " It only shows physical touches (not clicks from scrcpy).\n" "\n" + " -f, --fullscreen\n" + " Start the app in fullscreen.\n" + "\n" " -v, --version\n" " Print the version of scrcpy.\n" "\n" @@ -205,11 +209,12 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { {"port", required_argument, NULL, 'p'}, {"serial", required_argument, NULL, 's'}, {"show-touches", no_argument, NULL, 't'}, + {"fullscreen", no_argument, NULL, 'f'}, {"version", no_argument, NULL, 'v'}, {NULL, 0, NULL, 0 }, }; int c; - while ((c = getopt_long(argc, argv, "b:c:hm:p:s:tv", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "b:c:hm:p:s:tfv", long_options, NULL)) != -1) { switch (c) { case 'b': if (!parse_bit_rate(optarg, &args->bit_rate)) { @@ -238,6 +243,9 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) { case 't': args->show_touches = SDL_TRUE; break; + case 'f': + args->fullscreen = SDL_TRUE; + break; case 'v': args->version = SDL_TRUE; break; @@ -305,6 +313,7 @@ int main(int argc, char *argv[]) { .max_size = args.max_size, .bit_rate = args.bit_rate, .show_touches = args.show_touches, + .fullscreen = args.fullscreen, }; int res = scrcpy(&options) ? 0 : 1; diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 23de498447..12f7b9735b 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -210,6 +210,11 @@ SDL_bool scrcpy(const struct scrcpy_options *options) { wait_show_touches(proc_show_touches); show_touches_waited = SDL_TRUE; } + + if (options->fullscreen) { + + screen_switch_fullscreen(input_manager.screen); + } ret = event_loop(); LOGD("quit..."); diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 7ddabf2877..f64d4c0203 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -10,6 +10,7 @@ struct scrcpy_options { Uint16 max_size; Uint32 bit_rate; SDL_bool show_touches; + SDL_bool fullscreen; }; SDL_bool scrcpy(const struct scrcpy_options *options); From 1035653d4a09a723132f1d1c3e645231ca172b5e Mon Sep 17 00:00:00 2001 From: Philipp Sandhaus Date: Tue, 4 Sep 2018 16:02:14 +0200 Subject: [PATCH 2/2] Removed extra line --- app/src/scrcpy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 12f7b9735b..7c897424d0 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -212,7 +212,6 @@ SDL_bool scrcpy(const struct scrcpy_options *options) { } if (options->fullscreen) { - screen_switch_fullscreen(input_manager.screen); }