Skip to content

Display and control your Android device

Use positive options names internally

Romain Vimontc8a6783494b1
diff --git a/app/src/main.c b/app/src/main.c
index 2bdfb916..24f6b05a 100644
--- a/app/src/main.c
+++ b/app/src/main.c
@@ -455,8 +455,8 @@ main(int argc, char *argv[]) {
.show_touches = args.show_touches,
.fullscreen = args.fullscreen,
.always_on_top = args.always_on_top,
- .no_control = args.no_control,
- .no_display = args.no_display,
+ .control = !args.no_control,
+ .display = !args.no_display,
};
int res = scrcpy(&options) ? 0 : 1;
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index 0264561b..7a067134 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -294,10 +294,7 @@ scrcpy(const struct scrcpy_options *options) {
bool controller_initialized = false;
bool controller_started = false;
- bool display = !options->no_display;
- bool control = !options->no_control;
-
- if (!sdl_init_and_configure(display)) {
+ if (!sdl_init_and_configure(options->display)) {
goto end;
}
@@ -316,13 +313,13 @@ scrcpy(const struct scrcpy_options *options) {
}
struct decoder *dec = NULL;
- if (display) {
+ if (options->display) {
if (!video_buffer_init(&video_buffer)) {
goto end;
}
video_buffer_initialized = true;
- if (control) {
+ if (options->control) {
if (!file_handler_init(&file_handler, server.serial)) {
goto end;
}
@@ -356,8 +353,8 @@ scrcpy(const struct scrcpy_options *options) {
}
stream_started = true;
- if (display) {
- if (control) {
+ if (options->display) {
+ if (options->control) {
if (!controller_init(&controller, server.control_socket)) {
goto end;
}
@@ -382,7 +379,7 @@ scrcpy(const struct scrcpy_options *options) {
show_touches_waited = true;
}
- ret = event_loop(display, control);
+ ret = event_loop(options->display, options->control);
LOGD("quit...");
screen_destroy(&screen);
diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h
index 114c12a4..52bd14cc 100644
--- a/app/src/scrcpy.h
+++ b/app/src/scrcpy.h
@@ -16,8 +16,8 @@ struct scrcpy_options {
bool show_touches;
bool fullscreen;
bool always_on_top;
- bool no_control;
- bool no_display;
+ bool control;
+ bool display;
};
bool