Add option to turn device screen off

In addition to the shortcut (Ctrl+o) to turn the device screen off, add
a command-line argument to turn it off on start.
This commit is contained in:
Romain Vimont
2019-06-05 00:55:46 +02:00
parent 7f07b13446
commit 8e66b33000
4 changed files with 35 additions and 6 deletions

View File

@@ -375,6 +375,16 @@ scrcpy(const struct scrcpy_options *options) {
goto end;
}
if (options->turn_screen_off) {
struct control_msg msg;
msg.type = CONTROL_MSG_TYPE_SET_SCREEN_POWER_MODE;
msg.set_screen_power_mode.mode = SCREEN_POWER_MODE_OFF;
if (!controller_push_msg(&controller, &msg)) {
LOGW("Cannot request 'set screen power mode'");
}
}
if (options->fullscreen) {
screen_switch_fullscreen(&screen);
}