Forward Right-Ctrl to the device
Only capture Left-Ctrl for scrcpy shortcuts, so that Right-Ctrl can be forwarded to the device. Fixes #555 <https://github.com/Genymobile/scrcpy/issues/555>
This commit is contained in:
parent
0e4a6f462b
commit
3bdc45925f
45
README.md
45
README.md
@ -560,30 +560,33 @@ Also see [issue #14].
|
|||||||
|
|
||||||
## Shortcuts
|
## Shortcuts
|
||||||
|
|
||||||
|
`LCtrl` is the left `Ctrl` key (the right `Ctrl` key is forwarded to the
|
||||||
|
device).
|
||||||
|
|
||||||
| Action | Shortcut | Shortcut (macOS)
|
| Action | Shortcut | Shortcut (macOS)
|
||||||
| ------------------------------------------- |:----------------------------- |:-----------------------------
|
| ------------------------------------------- |:----------------------------- |:-----------------------------
|
||||||
| Switch fullscreen mode | `Ctrl`+`f` | `Cmd`+`f`
|
| Switch fullscreen mode | `LCtrl`+`f` | `Cmd`+`f`
|
||||||
| Rotate display left | `Ctrl`+`←` _(left)_ | `Cmd`+`←` _(left)_
|
| Rotate display left | `LCtrl`+`←` _(left)_ | `Cmd`+`←` _(left)_
|
||||||
| Rotate display right | `Ctrl`+`→` _(right)_ | `Cmd`+`→` _(right)_
|
| Rotate display right | `LCtrl`+`→` _(right)_ | `Cmd`+`→` _(right)_
|
||||||
| Resize window to 1:1 (pixel-perfect) | `Ctrl`+`g` | `Cmd`+`g`
|
| Resize window to 1:1 (pixel-perfect) | `LCtrl`+`g` | `Cmd`+`g`
|
||||||
| Resize window to remove black borders | `Ctrl`+`x` \| _Double-click¹_ | `Cmd`+`x` \| _Double-click¹_
|
| Resize window to remove black borders | `LCtrl`+`x` \| _Double-click¹_ | `Cmd`+`x` \| _Double-click¹_
|
||||||
| Click on `HOME` | `Ctrl`+`h` \| _Middle-click_ | `Ctrl`+`h` \| _Middle-click_
|
| Click on `HOME` | `LCtrl`+`h` \| _Middle-click_ | `Ctrl`+`h` \| _Middle-click_
|
||||||
| Click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | `Cmd`+`b` \| _Right-click²_
|
| Click on `BACK` | `LCtrl`+`b` \| _Right-click²_ | `Cmd`+`b` \| _Right-click²_
|
||||||
| Click on `APP_SWITCH` | `Ctrl`+`s` | `Cmd`+`s`
|
| Click on `APP_SWITCH` | `LCtrl`+`s` | `Cmd`+`s`
|
||||||
| Click on `MENU` | `Ctrl`+`m` | `Ctrl`+`m`
|
| Click on `MENU` | `LCtrl`+`m` | `Ctrl`+`m`
|
||||||
| Click on `VOLUME_UP` | `Ctrl`+`↑` _(up)_ | `Cmd`+`↑` _(up)_
|
| Click on `VOLUME_UP` | `LCtrl`+`↑` _(up)_ | `Cmd`+`↑` _(up)_
|
||||||
| Click on `VOLUME_DOWN` | `Ctrl`+`↓` _(down)_ | `Cmd`+`↓` _(down)_
|
| Click on `VOLUME_DOWN` | `LCtrl`+`↓` _(down)_ | `Cmd`+`↓` _(down)_
|
||||||
| Click on `POWER` | `Ctrl`+`p` | `Cmd`+`p`
|
| Click on `POWER` | `LCtrl`+`p` | `Cmd`+`p`
|
||||||
| Power on | _Right-click²_ | _Right-click²_
|
| Power on | _Right-click²_ | _Right-click²_
|
||||||
| Turn device screen off (keep mirroring) | `Ctrl`+`o` | `Cmd`+`o`
|
| Turn device screen off (keep mirroring) | `LCtrl`+`o` | `Cmd`+`o`
|
||||||
| Turn device screen on | `Ctrl`+`Shift`+`o` | `Cmd`+`Shift`+`o`
|
| Turn device screen on | `LCtrl`+`Shift`+`o` | `Cmd`+`Shift`+`o`
|
||||||
| Rotate device screen | `Ctrl`+`r` | `Cmd`+`r`
|
| Rotate device screen | `LCtrl`+`r` | `Cmd`+`r`
|
||||||
| Expand notification panel | `Ctrl`+`n` | `Cmd`+`n`
|
| Expand notification panel | `LCtrl`+`n` | `Cmd`+`n`
|
||||||
| Collapse notification panel | `Ctrl`+`Shift`+`n` | `Cmd`+`Shift`+`n`
|
| Collapse notification panel | `LCtrl`+`Shift`+`n` | `Cmd`+`Shift`+`n`
|
||||||
| Copy device clipboard to computer | `Ctrl`+`c` | `Cmd`+`c`
|
| Copy device clipboard to computer | `LCtrl`+`c` | `Cmd`+`c`
|
||||||
| Paste computer clipboard to device | `Ctrl`+`v` | `Cmd`+`v`
|
| Paste computer clipboard to device | `LCtrl`+`v` | `Cmd`+`v`
|
||||||
| Copy computer clipboard to device and paste | `Ctrl`+`Shift`+`v` | `Cmd`+`Shift`+`v`
|
| Copy computer clipboard to device and paste | `LCtrl`+`Shift`+`v` | `Cmd`+`Shift`+`v`
|
||||||
| Enable/disable FPS counter (on stdout) | `Ctrl`+`i` | `Cmd`+`i`
|
| Enable/disable FPS counter (on stdout) | `LCtrl`+`i` | `Cmd`+`i`
|
||||||
|
|
||||||
_¹Double-click on black borders to remove them._
|
_¹Double-click on black borders to remove them._
|
||||||
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
||||||
|
44
app/scrcpy.1
44
app/scrcpy.1
@ -203,52 +203,54 @@ Default is 0 (automatic).\n
|
|||||||
|
|
||||||
.SH SHORTCUTS
|
.SH SHORTCUTS
|
||||||
|
|
||||||
|
\fBLCtrl\fR is the left Ctrl key (the right Ctrl key is forwarded to the device).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+f
|
.B LCtrl+f
|
||||||
Switch fullscreen mode
|
Switch fullscreen mode
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Left
|
.B LCtrl+Left
|
||||||
Rotate display left
|
Rotate display left
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Right
|
.B LCtrl+Right
|
||||||
Rotate display right
|
Rotate display right
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+g
|
.B LCtrl+g
|
||||||
Resize window to 1:1 (pixel\-perfect)
|
Resize window to 1:1 (pixel\-perfect)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+x, Double\-click on black borders
|
.B LCtrl+x, Double\-click on black borders
|
||||||
Resize window to remove black borders
|
Resize window to remove black borders
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+h, Home, Middle\-click
|
.B LCtrl+h, Home, Middle\-click
|
||||||
Click on HOME
|
Click on HOME
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+b, Ctrl+Backspace, Right\-click (when screen is on)
|
.B LCtrl+b, Ctrl+Backspace, Right\-click (when screen is on)
|
||||||
Click on BACK
|
Click on BACK
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+s
|
.B LCtrl+s
|
||||||
Click on APP_SWITCH
|
Click on APP_SWITCH
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+m
|
.B LCtrl+m
|
||||||
Click on MENU
|
Click on MENU
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Up
|
.B LCtrl+Up
|
||||||
Click on VOLUME_UP
|
Click on VOLUME_UP
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Down
|
.B LCtrl+Down
|
||||||
Click on VOLUME_DOWN
|
Click on VOLUME_DOWN
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+p
|
.B LCtrl+p
|
||||||
Click on POWER (turn screen on/off)
|
Click on POWER (turn screen on/off)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@ -256,39 +258,39 @@ Click on POWER (turn screen on/off)
|
|||||||
Turn screen on
|
Turn screen on
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+o
|
.B LCtrl+o
|
||||||
Turn device screen off (keep mirroring)
|
Turn device screen off (keep mirroring)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Shift+o
|
.B LCtrl+Shift+o
|
||||||
Turn device screen on
|
Turn device screen on
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+r
|
.B LCtrl+r
|
||||||
Rotate device screen
|
Rotate device screen
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+n
|
.B LCtrl+n
|
||||||
Expand notification panel
|
Expand notification panel
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Shift+n
|
.B LCtrl+Shift+n
|
||||||
Collapse notification panel
|
Collapse notification panel
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+c
|
.B LCtrl+c
|
||||||
Copy device clipboard to computer
|
Copy device clipboard to computer
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+v
|
.B LCtrl+v
|
||||||
Paste computer clipboard to device
|
Paste computer clipboard to device
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+Shift+v
|
.B LCtrl+Shift+v
|
||||||
Copy computer clipboard to device (and paste if the device runs Android >= 7)
|
Copy computer clipboard to device (and paste if the device runs Android >= 7)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl+i
|
.B LCtrl+i
|
||||||
Enable/disable FPS counter (print frames/second in logs)
|
Enable/disable FPS counter (print frames/second in logs)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
@ -15,7 +15,7 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
# define CTRL_OR_CMD "Cmd"
|
# define CTRL_OR_CMD "Cmd"
|
||||||
#else
|
#else
|
||||||
# define CTRL_OR_CMD "Ctrl"
|
# define CTRL_OR_CMD "LCtrl"
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s [options]\n"
|
"Usage: %s [options]\n"
|
||||||
@ -186,6 +186,9 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
"\n"
|
"\n"
|
||||||
"Shortcuts:\n"
|
"Shortcuts:\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
" LCtrl is the left Ctrl key (the right Ctrl key is forwarded to\n"
|
||||||
|
" the device).\n"
|
||||||
|
"\n"
|
||||||
" " CTRL_OR_CMD "+f\n"
|
" " CTRL_OR_CMD "+f\n"
|
||||||
" Switch fullscreen mode\n"
|
" Switch fullscreen mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -202,7 +205,7 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
" Double-click on black borders\n"
|
" Double-click on black borders\n"
|
||||||
" Resize window to remove black borders\n"
|
" Resize window to remove black borders\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Ctrl+h\n"
|
" LCtrl+h\n"
|
||||||
" Middle-click\n"
|
" Middle-click\n"
|
||||||
" Click on HOME\n"
|
" Click on HOME\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -214,7 +217,7 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
" " CTRL_OR_CMD "+s\n"
|
" " CTRL_OR_CMD "+s\n"
|
||||||
" Click on APP_SWITCH\n"
|
" Click on APP_SWITCH\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Ctrl+m\n"
|
" LCtrl+m\n"
|
||||||
" Click on MENU\n"
|
" Click on MENU\n"
|
||||||
"\n"
|
"\n"
|
||||||
" " CTRL_OR_CMD "+Up\n"
|
" " CTRL_OR_CMD "+Up\n"
|
||||||
|
@ -92,6 +92,7 @@ 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_RCTRL, AKEYCODE_CTRL_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mod & (KMOD_NUM | KMOD_SHIFT))) {
|
if (!(mod & (KMOD_NUM | KMOD_SHIFT))) {
|
||||||
|
@ -259,7 +259,8 @@ input_manager_process_key(struct input_manager *im,
|
|||||||
// control: indicates the state of the command-line option --no-control
|
// control: indicates the state of the command-line option --no-control
|
||||||
// ctrl: the Ctrl key
|
// ctrl: the Ctrl key
|
||||||
|
|
||||||
bool ctrl = event->keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
|
// Only capture Left-Ctrl, Right-Ctrl is forwarded to the device
|
||||||
|
bool ctrl = event->keysym.mod & KMOD_LCTRL;
|
||||||
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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user