Skip to content

Commit

Permalink
Forward Ctrl to the device
Browse files Browse the repository at this point in the history
Now that the scrcpy shortcut modifier is Alt by default (and can be
configured), forward Ctrl to the device.

This allows to trigger Android shortcuts.

Fixes #555 <#555>
  • Loading branch information
rom1v committed Jul 16, 2020
1 parent 19691d6 commit 4a09c66
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/event_converter.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ convert_keycode(SDL_Keycode from, enum android_keycode *to, uint16_t mod,
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
MAP(SDLK_LCTRL, AKEYCODE_CTRL_LEFT);
MAP(SDLK_RCTRL, AKEYCODE_CTRL_RIGHT);
}

if (!(mod & (KMOD_NUM | KMOD_SHIFT))) {
Expand All @@ -111,8 +113,8 @@ convert_keycode(SDL_Keycode from, enum android_keycode *to, uint16_t mod,
}
}

if (prefer_text) {
// do not forward alpha and space key events
if (prefer_text && !(mod & KMOD_CTRL)) {
// do not forward alpha and space key events (unless Ctrl is pressed)
return false;
}

Expand Down

0 comments on commit 4a09c66

Please sign in to comment.