Map middle-click to HOME

Middle-click is useless in practice. Use it for HOME.
This commit is contained in:
Romain Vimont 2018-03-10 00:40:55 +01:00
parent 675704c71c
commit c87d94ee27
3 changed files with 27 additions and 19 deletions

View file

@ -188,22 +188,22 @@ To run without installing:
## Shortcuts ## Shortcuts
| Action | Shortcut | | Action | Shortcut |
| ------------------------------------- | -------------:| | -------------------------------------- |:---------------------------- |
| switch fullscreen mode | `Ctrl`+`f` | | switch fullscreen mode | `Ctrl`+`f` |
| resize window to 1:1 (pixel-perfect) | `Ctrl`+`g` | | resize window to 1:1 (pixel-perfect) | `Ctrl`+`g` |
| resize window to remove black borders | `Ctrl`+`x` | | resize window to remove black borders | `Ctrl`+`x` |
| click on `HOME` | `Ctrl`+`h` | | click on `HOME` | `Ctrl`+`h` \| _Middle-click_ |
| click on `BACK` | `Ctrl`+`b` | | click on `BACK` | `Ctrl`+`b` \| _Right-click¹_ |
| click on `APP_SWITCH` | `Ctrl`+`m` | | click on `APP_SWITCH` | `Ctrl`+`m` |
| click on `VOLUME_UP` | `Ctrl`+`+` | | click on `VOLUME_UP` | `Ctrl`+`+` |
| click on `VOLUME_DOWN` | `Ctrl`+`-` | | click on `VOLUME_DOWN` | `Ctrl`+`-` |
| click on `POWER` | `Ctrl`+`p` | | click on `POWER` | `Ctrl`+`p` |
| turn screen on or press BACK¹ | _Right-click_ | | turn screen on | _Right-click¹_ |
| paste computer clipboard to device | `Ctrl`+`v` | | paste computer clipboard to device | `Ctrl`+`v` |
| enable/disable FPS counter (on stdout) | `Ctrl`+`i` | | enable/disable FPS counter (on stdout) | `Ctrl`+`i` |
Press BACK if the screen is already on._ Right-click turns the screen on if it was off, presses BACK otherwise._
## Why _scrcpy_? ## Why _scrcpy_?

View file

@ -226,9 +226,15 @@ void input_manager_process_mouse_motion(struct input_manager *input_manager,
void input_manager_process_mouse_button(struct input_manager *input_manager, void input_manager_process_mouse_button(struct input_manager *input_manager,
const SDL_MouseButtonEvent *event) { const SDL_MouseButtonEvent *event) {
if (event->button == SDL_BUTTON_RIGHT && event->type == SDL_MOUSEBUTTONDOWN) { if (event->type == SDL_MOUSEBUTTONDOWN) {
press_back_or_turn_screen_on(input_manager->controller); if (event->button == SDL_BUTTON_RIGHT) {
return; press_back_or_turn_screen_on(input_manager->controller);
return;
}
if (event->button == SDL_BUTTON_MIDDLE) {
action_home(input_manager->controller);
return;
}
}; };
struct control_event control_event; struct control_event control_event;
if (mouse_button_from_sdl_to_android(event, input_manager->screen->frame_size, &control_event)) { if (mouse_button_from_sdl_to_android(event, input_manager->screen->frame_size, &control_event)) {

View file

@ -61,10 +61,12 @@ static void usage(const char *arg0) {
"\n" "\n"
" Ctrl+h\n" " Ctrl+h\n"
" Home\n" " Home\n"
" Middle-click\n"
" click on HOME\n" " click on HOME\n"
"\n" "\n"
" Ctrl+b\n" " Ctrl+b\n"
" Ctrl+Backspace\n" " Ctrl+Backspace\n"
" Right-click (when screen is on)\n"
" click on BACK\n" " click on BACK\n"
"\n" "\n"
" Ctrl+m\n" " Ctrl+m\n"
@ -79,7 +81,7 @@ static void usage(const char *arg0) {
" Ctrl+p\n" " Ctrl+p\n"
" click on POWER (turn screen on/off)\n" " click on POWER (turn screen on/off)\n"
"\n" "\n"
" Right-click\n" " Right-click (when screen is off)\n"
" turn screen on\n" " turn screen on\n"
"\n" "\n"
" Ctrl+v\n" " Ctrl+v\n"