2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-08-31 06:15:25 +00:00

Add shortcuts for COPY and CUT

Send COPY and CUT on MOD+c and MOD+x (only supported for Android >= 7).

The shortcuts Ctrl+c and Ctrl+x should generally also work (even before
Android 7), but the active Android app may use them for other actions
instead.
This commit is contained in:
Romain Vimont
2020-07-17 00:00:42 +02:00
parent 8f64a5984b
commit 56a115b5c5
4 changed files with 38 additions and 1 deletions

View File

@@ -129,6 +129,16 @@ action_menu(struct controller *controller, int actions) {
send_keycode(controller, AKEYCODE_MENU, actions, "MENU");
}
static inline void
action_copy(struct controller *controller, int actions) {
send_keycode(controller, AKEYCODE_COPY, actions, "COPY");
}
static inline void
action_cut(struct controller *controller, int actions) {
send_keycode(controller, AKEYCODE_CUT, actions, "CUT");
}
// turn the screen on if it was off, press BACK otherwise
static void
press_back_or_turn_screen_on(struct controller *controller) {
@@ -382,6 +392,16 @@ input_manager_process_key(struct input_manager *im,
rotate_client_right(im->screen);
}
return;
case SDLK_c:
if (control && !shift && !repeat) {
action_copy(controller, action);
}
return;
case SDLK_x:
if (control && !shift && !repeat) {
action_cut(controller, action);
}
return;
case SDLK_v:
if (control && !repeat && down) {
if (shift) {