From 301c52b6031f97370af76b009c434696111d567d Mon Sep 17 00:00:00 2001 From: Andy Rich Date: Tue, 20 Mar 2018 18:04:40 -0700 Subject: [PATCH 1/3] Add support for CTRL+S to send hardware "shake" to device w/readme --- README.md | 1 + app/src/inputmanager.c | 7 +++++++ app/src/main.c | 3 +++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 5be9a8a7..8ca43de9 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,7 @@ To run without installing: | click on `HOME` | `Ctrl`+`h` \| _Middle-click_ | | click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | | click on `APP_SWITCH` | `Ctrl`+`m` | + | click on `MENU` | `Ctrl`+`s` | | click on `VOLUME_UP` | `Ctrl`+`+` | | click on `VOLUME_DOWN` | `Ctrl`+`-` | | click on `POWER` | `Ctrl`+`p` | diff --git a/app/src/inputmanager.c b/app/src/inputmanager.c index 19830685..93c519fc 100644 --- a/app/src/inputmanager.c +++ b/app/src/inputmanager.c @@ -78,6 +78,10 @@ static inline void action_volume_down(struct controller *controller) { send_keycode(controller, AKEYCODE_VOLUME_DOWN, "VOLUME_DOWN"); } +static inline void action_shake(struct controller *controller) { + send_keycode(controller, AKEYCODE_MENU, "SHAKE"); +} + // turn the screen on if it was off, press BACK otherwise static void press_back_or_turn_screen_on(struct controller *controller) { struct control_event control_event; @@ -179,6 +183,9 @@ void input_manager_process_key(struct input_manager *input_manager, case SDLK_m: action_app_switch(input_manager->controller); return; + case SDLK_s: + action_shake(input_manager->controller); + return; case SDLK_p: action_power(input_manager->controller); return; diff --git a/app/src/main.c b/app/src/main.c index 60ce023e..2b1f2c92 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -73,6 +73,9 @@ static void usage(const char *arg0) { " Ctrl+m\n" " click on APP_SWITCH\n" "\n" + " Ctrl+s\n" + " click on MENU\n" + "\n" " Ctrl+'+'\n" " click on VOLUME_UP\n" "\n" From 35e9a64c34ff26fe302f814d1987a66dc348cda3 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 23 Mar 2018 10:07:48 +0100 Subject: [PATCH 2/3] Rename "shake" to "menu" The action sends AKEYCODE_MENU, so just name it "menu". See . --- app/src/inputmanager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/inputmanager.c b/app/src/inputmanager.c index 93c519fc..35d9cbee 100644 --- a/app/src/inputmanager.c +++ b/app/src/inputmanager.c @@ -78,8 +78,8 @@ static inline void action_volume_down(struct controller *controller) { send_keycode(controller, AKEYCODE_VOLUME_DOWN, "VOLUME_DOWN"); } -static inline void action_shake(struct controller *controller) { - send_keycode(controller, AKEYCODE_MENU, "SHAKE"); +static inline void action_menu(struct controller *controller) { + send_keycode(controller, AKEYCODE_MENU, "MENU"); } // turn the screen on if it was off, press BACK otherwise @@ -184,7 +184,7 @@ void input_manager_process_key(struct input_manager *input_manager, action_app_switch(input_manager->controller); return; case SDLK_s: - action_shake(input_manager->controller); + action_menu(input_manager->controller); return; case SDLK_p: action_power(input_manager->controller); From 88ee6bc928e82a407a976665b1401cf23c3879df Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 23 Mar 2018 10:10:24 +0100 Subject: [PATCH 3/3] Swap MENU and APP_SWITCH shortcuts Ctrl+s was mapped to MENU, while Ctrl+m was mapped to APP_SWITCH. To avoid confusion, swap the shortcuts: - Ctrl+m like _M_enu - Ctrl+s like _S_witch --- README.md | 4 ++-- app/src/inputmanager.c | 4 ++-- app/src/main.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ca43de9..7e902b10 100644 --- a/README.md +++ b/README.md @@ -257,8 +257,8 @@ To run without installing: | resize window to remove black borders | `Ctrl`+`x` \| _Double-click¹_ | | click on `HOME` | `Ctrl`+`h` \| _Middle-click_ | | click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | - | click on `APP_SWITCH` | `Ctrl`+`m` | - | click on `MENU` | `Ctrl`+`s` | + | click on `APP_SWITCH` | `Ctrl`+`s` | + | click on `MENU` | `Ctrl`+`m` | | click on `VOLUME_UP` | `Ctrl`+`+` | | click on `VOLUME_DOWN` | `Ctrl`+`-` | | click on `POWER` | `Ctrl`+`p` | diff --git a/app/src/inputmanager.c b/app/src/inputmanager.c index 35d9cbee..a0ffb87c 100644 --- a/app/src/inputmanager.c +++ b/app/src/inputmanager.c @@ -180,10 +180,10 @@ void input_manager_process_key(struct input_manager *input_manager, case SDLK_BACKSPACE: action_back(input_manager->controller); return; - case SDLK_m: + case SDLK_s: action_app_switch(input_manager->controller); return; - case SDLK_s: + case SDLK_m: action_menu(input_manager->controller); return; case SDLK_p: diff --git a/app/src/main.c b/app/src/main.c index 2b1f2c92..740801b3 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -70,10 +70,10 @@ static void usage(const char *arg0) { " Right-click (when screen is on)\n" " click on BACK\n" "\n" - " Ctrl+m\n" + " Ctrl+s\n" " click on APP_SWITCH\n" "\n" - " Ctrl+s\n" + " Ctrl+m\n" " click on MENU\n" "\n" " Ctrl+'+'\n"