Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new command line parameter to start in fullscreen #252

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion app/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions app/src/scrcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down
1 change: 1 addition & 0 deletions app/src/scrcpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down