2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-09-01 06:45:40 +00:00

Add shortcut to rotate screen

On Ctrl+r, disable auto-rotation (if enabled), set the screen rotation
and re-enable auto-rotation (if it was enabled).

Closes #11 <https://github.com/Genymobile/scrcpy/issues/11>
This commit is contained in:
Romain Vimont
2019-12-04 19:55:28 +01:00
parent bdd05b4a16
commit eb0f339271
13 changed files with 157 additions and 6 deletions

View File

@@ -211,6 +211,16 @@ clipboard_paste(struct controller *controller) {
}
}
static void
rotate_device(struct controller *controller) {
struct control_msg msg;
msg.type = CONTROL_MSG_TYPE_ROTATE_DEVICE;
if (!controller_push_msg(controller, &msg)) {
LOGW("Could not request device rotation");
}
}
void
input_manager_process_text_input(struct input_manager *im,
const SDL_TextInputEvent *event) {
@@ -388,6 +398,11 @@ input_manager_process_key(struct input_manager *im,
}
}
return;
case SDLK_r:
if (control && cmd && !shift && !repeat && down) {
rotate_device(controller);
}
return;
}
return;