From d061c309656b477dc9adbaf5813e99861d77520e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 24 Oct 2018 19:05:34 +0200 Subject: [PATCH] Replace Ctrl by Meta for volume shortcuts on MacOS Ctrl+UP and Ctrl+DOWN are already used by the window manager on MacOS. Use Cmd key instead (like on VLC). --- README.md | 4 ++-- app/src/input_manager.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 28e76e24..661bf5e6 100644 --- a/README.md +++ b/README.md @@ -134,8 +134,8 @@ scrcpy -f | click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | | click on `APP_SWITCH` | `Ctrl`+`s` | | click on `MENU` | `Ctrl`+`m` | - | click on `VOLUME_UP` | `Ctrl`+`↑` _(up)_ | - | click on `VOLUME_DOWN` | `Ctrl`+`↓` _(down)_ | + | click on `VOLUME_UP` | `Ctrl`+`↑` _(up)_ (`Cmd`+`↑` on MacOS) | + | click on `VOLUME_DOWN` | `Ctrl`+`↓` _(down)_ (`Cmd`+`↓` on MacOS) | | click on `POWER` | `Ctrl`+`p` | | turn screen on | _Right-click²_ | | paste computer clipboard to device | `Ctrl`+`v` | diff --git a/app/src/input_manager.c b/app/src/input_manager.c index b6a2b650..21b7c407 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -200,13 +200,21 @@ void input_manager_process_key(struct input_manager *input_manager, } return; case SDLK_DOWN: +#ifdef __APPLE__ + if (!ctrl && meta) { +#else if (ctrl && !meta) { +#endif // forward repeated events action_volume_down(input_manager->controller, action); } return; case SDLK_UP: +#ifdef __APPLE__ + if (!ctrl && meta) { +#else if (ctrl && !meta) { +#endif // forward repeated events action_volume_up(input_manager->controller, action); }