mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 06:39:39 +00:00
Forward Ctrl to the device
Now that Meta is used for scrcpy shortcuts, Ctrl can be forwarded to the device. This allows to trigger Android shortcuts. Fixes #555 <https://github.com/Genymobile/scrcpy/issues/555>
This commit is contained in:
parent
f650b0195f
commit
26cadf1022
2 changed files with 9 additions and 3 deletions
|
@ -92,6 +92,8 @@ convert_keycode(SDL_Keycode from, enum android_keycode *to, uint16_t mod,
|
||||||
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
|
MAP(SDLK_LEFT, AKEYCODE_DPAD_LEFT);
|
||||||
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
|
MAP(SDLK_DOWN, AKEYCODE_DPAD_DOWN);
|
||||||
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
|
MAP(SDLK_UP, AKEYCODE_DPAD_UP);
|
||||||
|
MAP(SDLK_LCTRL, AKEYCODE_CTRL_LEFT);
|
||||||
|
MAP(SDLK_RCTRL, AKEYCODE_CTRL_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mod & (KMOD_NUM | KMOD_SHIFT))) {
|
if (!(mod & (KMOD_NUM | KMOD_SHIFT))) {
|
||||||
|
|
|
@ -263,9 +263,8 @@ input_manager_process_key(struct input_manager *im,
|
||||||
bool alt = event->keysym.mod & (KMOD_LALT | KMOD_RALT);
|
bool alt = event->keysym.mod & (KMOD_LALT | KMOD_RALT);
|
||||||
bool meta = event->keysym.mod & (KMOD_LGUI | KMOD_RGUI);
|
bool meta = event->keysym.mod & (KMOD_LGUI | KMOD_RGUI);
|
||||||
|
|
||||||
if (alt || ctrl) {
|
if (alt) {
|
||||||
// No shortcuts involve Alt or Ctrl, and they are not forwarded to the
|
// No shortcuts involve Alt, and it is not forwarded to the device
|
||||||
// device
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +272,11 @@ input_manager_process_key(struct input_manager *im,
|
||||||
|
|
||||||
// Capture all Meta events
|
// Capture all Meta events
|
||||||
if (meta) {
|
if (meta) {
|
||||||
|
if (ctrl) {
|
||||||
|
// No shortcuts involve Ctrl+Meta
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Keycode keycode = event->keysym.sym;
|
SDL_Keycode keycode = event->keysym.sym;
|
||||||
bool down = event->type == SDL_KEYDOWN;
|
bool down = event->type == SDL_KEYDOWN;
|
||||||
int action = down ? ACTION_DOWN : ACTION_UP;
|
int action = down ? ACTION_DOWN : ACTION_UP;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue