Use positive options names internally

For clarity, store the flag resulting of the command-line options
--no-control and --no-display into "control" and "display".
This commit is contained in:
Romain Vimont 2019-06-04 21:49:26 +02:00
parent 5b56900e2b
commit c8a6783494
3 changed files with 10 additions and 13 deletions

View file

@ -455,8 +455,8 @@ main(int argc, char *argv[]) {
.show_touches = args.show_touches, .show_touches = args.show_touches,
.fullscreen = args.fullscreen, .fullscreen = args.fullscreen,
.always_on_top = args.always_on_top, .always_on_top = args.always_on_top,
.no_control = args.no_control, .control = !args.no_control,
.no_display = args.no_display, .display = !args.no_display,
}; };
int res = scrcpy(&options) ? 0 : 1; int res = scrcpy(&options) ? 0 : 1;

View file

@ -294,10 +294,7 @@ scrcpy(const struct scrcpy_options *options) {
bool controller_initialized = false; bool controller_initialized = false;
bool controller_started = false; bool controller_started = false;
bool display = !options->no_display; if (!sdl_init_and_configure(options->display)) {
bool control = !options->no_control;
if (!sdl_init_and_configure(display)) {
goto end; goto end;
} }
@ -316,13 +313,13 @@ scrcpy(const struct scrcpy_options *options) {
} }
struct decoder *dec = NULL; struct decoder *dec = NULL;
if (display) { if (options->display) {
if (!video_buffer_init(&video_buffer)) { if (!video_buffer_init(&video_buffer)) {
goto end; goto end;
} }
video_buffer_initialized = true; video_buffer_initialized = true;
if (control) { if (options->control) {
if (!file_handler_init(&file_handler, server.serial)) { if (!file_handler_init(&file_handler, server.serial)) {
goto end; goto end;
} }
@ -356,8 +353,8 @@ scrcpy(const struct scrcpy_options *options) {
} }
stream_started = true; stream_started = true;
if (display) { if (options->display) {
if (control) { if (options->control) {
if (!controller_init(&controller, server.control_socket)) { if (!controller_init(&controller, server.control_socket)) {
goto end; goto end;
} }
@ -382,7 +379,7 @@ scrcpy(const struct scrcpy_options *options) {
show_touches_waited = true; show_touches_waited = true;
} }
ret = event_loop(display, control); ret = event_loop(options->display, options->control);
LOGD("quit..."); LOGD("quit...");
screen_destroy(&screen); screen_destroy(&screen);

View file

@ -16,8 +16,8 @@ struct scrcpy_options {
bool show_touches; bool show_touches;
bool fullscreen; bool fullscreen;
bool always_on_top; bool always_on_top;
bool no_control; bool control;
bool no_display; bool display;
}; };
bool bool