mirror of
https://github.com/Genymobile/scrcpy
synced 2025-08-31 14:25:56 +00:00
Implement device screen off while mirroring
Add two shortcuts: - Ctrl+o to turn the device screen off while mirroring - Ctrl+Shift+o to turn it back on On power on (either via the POWER key or BACK while screen is off), both the device screen and the mirror are turned on. <https://github.com/Genymobile/scrcpy/issues/175>
This commit is contained in:
@@ -159,6 +159,18 @@ set_device_clipboard(struct controller *controller) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_screen_power_mode(struct controller *controller,
|
||||
enum screen_power_mode mode) {
|
||||
struct control_msg msg;
|
||||
msg.type = CONTROL_MSG_TYPE_SET_SCREEN_POWER_MODE;
|
||||
msg.set_screen_power_mode.mode = mode;
|
||||
|
||||
if (!controller_push_msg(controller, &msg)) {
|
||||
LOGW("Cannot request 'set screen power mode'");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
switch_fps_counter_state(struct video_buffer *vb) {
|
||||
mutex_lock(vb->mutex);
|
||||
@@ -263,6 +275,14 @@ input_manager_process_key(struct input_manager *input_manager,
|
||||
action_power(input_manager->controller, action);
|
||||
}
|
||||
return;
|
||||
case SDLK_o:
|
||||
if (control && ctrl && !meta && event->type == SDL_KEYDOWN) {
|
||||
enum screen_power_mode mode = shift
|
||||
? SCREEN_POWER_MODE_NORMAL
|
||||
: SCREEN_POWER_MODE_OFF;
|
||||
set_screen_power_mode(input_manager->controller, mode);
|
||||
}
|
||||
return;
|
||||
case SDLK_DOWN:
|
||||
#ifdef __APPLE__
|
||||
if (control && !ctrl && meta && !shift) {
|
||||
|
Reference in New Issue
Block a user