This commit is contained in:
Philipp Sandhaus 2018-09-04 14:02:37 +00:00 committed by GitHub
commit 68d728858f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View file

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

View file

@ -210,6 +210,10 @@ 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...");

View file

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