Add option to start in fullscreen
Signed-off-by: Romain Vimont <rom@rom1v.com>
This commit is contained in:
parent
34550311be
commit
af9808cf02
3 changed files with 15 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
||||||
struct args {
|
struct args {
|
||||||
const char *serial;
|
const char *serial;
|
||||||
const char *crop;
|
const char *crop;
|
||||||
|
SDL_bool fullscreen;
|
||||||
SDL_bool help;
|
SDL_bool help;
|
||||||
SDL_bool version;
|
SDL_bool version;
|
||||||
SDL_bool show_touches;
|
SDL_bool show_touches;
|
||||||
|
@ -36,6 +37,9 @@ static void usage(const char *arg0) {
|
||||||
" (typically, portrait for a phone, landscape for a tablet).\n"
|
" (typically, portrait for a phone, landscape for a tablet).\n"
|
||||||
" Any --max-size value is computed on the cropped size.\n"
|
" Any --max-size value is computed on the cropped size.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" -f, --fullscreen\n"
|
||||||
|
" Start in fullscreen.\n"
|
||||||
|
"\n"
|
||||||
" -h, --help\n"
|
" -h, --help\n"
|
||||||
" Print this help.\n"
|
" Print this help.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -200,6 +204,7 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) {
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{"bit-rate", required_argument, NULL, 'b'},
|
{"bit-rate", required_argument, NULL, 'b'},
|
||||||
{"crop", required_argument, NULL, 'c'},
|
{"crop", required_argument, NULL, 'c'},
|
||||||
|
{"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'},
|
||||||
{"port", required_argument, NULL, 'p'},
|
{"port", required_argument, NULL, 'p'},
|
||||||
|
@ -209,7 +214,7 @@ static SDL_bool 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:hm:p:s:tv", long_options, NULL)) != -1) {
|
while ((c = getopt_long(argc, argv, "b:c:fhm:p:s:tv", long_options, NULL)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (!parse_bit_rate(optarg, &args->bit_rate)) {
|
if (!parse_bit_rate(optarg, &args->bit_rate)) {
|
||||||
|
@ -219,6 +224,9 @@ static SDL_bool parse_args(struct args *args, int argc, char *argv[]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
args->crop = optarg;
|
args->crop = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'f':
|
||||||
|
args->fullscreen = SDL_TRUE;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
args->help = SDL_TRUE;
|
args->help = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -305,6 +313,7 @@ int main(int argc, char *argv[]) {
|
||||||
.max_size = args.max_size,
|
.max_size = args.max_size,
|
||||||
.bit_rate = args.bit_rate,
|
.bit_rate = args.bit_rate,
|
||||||
.show_touches = args.show_touches,
|
.show_touches = args.show_touches,
|
||||||
|
.fullscreen = args.fullscreen,
|
||||||
};
|
};
|
||||||
int res = scrcpy(&options) ? 0 : 1;
|
int res = scrcpy(&options) ? 0 : 1;
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,10 @@ SDL_bool scrcpy(const struct scrcpy_options *options) {
|
||||||
show_touches_waited = SDL_TRUE;
|
show_touches_waited = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options->fullscreen) {
|
||||||
|
screen_switch_fullscreen(&screen);
|
||||||
|
}
|
||||||
|
|
||||||
ret = event_loop();
|
ret = event_loop();
|
||||||
LOGD("quit...");
|
LOGD("quit...");
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct scrcpy_options {
|
||||||
Uint16 max_size;
|
Uint16 max_size;
|
||||||
Uint32 bit_rate;
|
Uint32 bit_rate;
|
||||||
SDL_bool show_touches;
|
SDL_bool show_touches;
|
||||||
|
SDL_bool fullscreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
SDL_bool scrcpy(const struct scrcpy_options *options);
|
SDL_bool scrcpy(const struct scrcpy_options *options);
|
||||||
|
|
Loading…
Reference in a new issue