summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/action.c23
-rw-r--r--apps/action.h13
-rw-r--r--apps/gui/list.c37
-rw-r--r--apps/keymaps/keymap-h1x0_h3x0.c2
4 files changed, 54 insertions, 21 deletions
diff --git a/apps/action.c b/apps/action.c
index 30eccb8d81..7667e4dd12 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -31,6 +31,8 @@
31 31
32static bool ignore_until_release = false; 32static bool ignore_until_release = false;
33static int last_button = BUTTON_NONE; 33static int last_button = BUTTON_NONE;
34static int last_action = ACTION_NONE;
35static bool repeated = false;
34 36
35/* software keylock stuff */ 37/* software keylock stuff */
36#ifndef HAS_BUTTON_HOLD 38#ifndef HAS_BUTTON_HOLD
@@ -107,7 +109,6 @@ static int get_action_worker(int context, int timeout,
107 else 109 else
108 button = button_get_w_tmo(timeout); 110 button = button_get_w_tmo(timeout);
109 111
110
111 if (button == BUTTON_NONE || button&SYS_EVENT) 112 if (button == BUTTON_NONE || button&SYS_EVENT)
112 { 113 {
113 return button; 114 return button;
@@ -185,6 +186,11 @@ static int get_action_worker(int context, int timeout,
185 return ACTION_REDRAW; 186 return ACTION_REDRAW;
186 } 187 }
187#endif 188#endif
189 if (ret == last_action)
190 repeated = true;
191 else
192 repeated = false;
193
188 last_button = button; 194 last_button = button;
189 return ret; 195 return ret;
190} 196}
@@ -224,3 +230,18 @@ bool is_keys_locked(void)
224 return (screen_has_lock && (keys_locked == true)); 230 return (screen_has_lock && (keys_locked == true));
225} 231}
226#endif 232#endif
233
234int get_action_statuscode(int *button)
235{
236 int ret = 0;
237 if (button)
238 *button = last_button;
239
240 if (last_button&BUTTON_REMOTE)
241 ret |= ACTION_REMOTE;
242 if (repeated)
243 ret |= ACTION_REPEAT;
244 if (ignore_until_release)
245 ret |= ACTION_IGNORING;
246 return ret;
247}
diff --git a/apps/action.h b/apps/action.h
index c1026d8885..7f476a8a88 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -123,8 +123,6 @@ enum {
123 /* list and tree page up/down */ 123 /* list and tree page up/down */
124 ACTION_LISTTREE_PGUP,/* optional */ 124 ACTION_LISTTREE_PGUP,/* optional */
125 ACTION_LISTTREE_PGDOWN,/* optional */ 125 ACTION_LISTTREE_PGDOWN,/* optional */
126 ACTION_LISTTREE_RC_PGUP,/* optional */
127 ACTION_LISTTREE_RC_PGDOWN,/* optional */
128 126
129 /* tree */ 127 /* tree */
130 ACTION_TREE_ROOT_INIT, 128 ACTION_TREE_ROOT_INIT,
@@ -248,4 +246,15 @@ const struct button_mapping* get_context_mapping(int context);
248#ifndef HAS_BUTTON_HOLD 246#ifndef HAS_BUTTON_HOLD
249bool is_keys_locked(void); 247bool is_keys_locked(void);
250#endif 248#endif
249
250/* returns the status code variable from action.c for the button just pressed
251 If button != NULL it will be set to the actual button code */
252#define ACTION_REMOTE 0x1 /* remote was pressed */
253#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
254#define ACTION_IGNORING 0x4 /* action_signalscreenchange() was called \
255 waiting for BUTTON_REL */
256int get_action_statuscode(int *button);
257
258
259
251#endif 260#endif
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 286e6f9e59..94915391ee 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -886,29 +886,32 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists,
886 * on the screen for which the user pressed the key since for example, remote 886 * on the screen for which the user pressed the key since for example, remote
887 * and main screen doesn't have the same number of lines */ 887 * and main screen doesn't have the same number of lines */
888 case ACTION_LISTTREE_PGUP: 888 case ACTION_LISTTREE_PGUP:
889 gui_synclist_select_previous_page(lists, SCREEN_MAIN); 889 {
890 int screen =
891#if BUTTON_REMOTE
892 get_action_statuscode(NULL)&ACTION_REMOTE ?
893 SCREEN_REMOTE :
894#endif
895 SCREEN_MAIN;
896 gui_synclist_select_previous_page(lists, screen);
890 gui_synclist_draw(lists); 897 gui_synclist_draw(lists);
891 yield(); 898 yield();
899 }
892 return ACTION_STD_NEXT; 900 return ACTION_STD_NEXT;
893 901
894 case ACTION_LISTTREE_PGDOWN: 902 case ACTION_LISTTREE_PGDOWN:
895 gui_synclist_select_next_page(lists, SCREEN_MAIN); 903 {
896 gui_synclist_draw(lists); 904 int screen =
897 yield(); 905#if BUTTON_REMOTE
898 return ACTION_STD_PREV; 906 get_action_statuscode(NULL)&ACTION_REMOTE ?
899#ifdef REMOTE_BUTTON 907 SCREEN_REMOTE :
900 case ACTION_LISTTREE_RC_PGUP: 908#endif
901 gui_synclist_select_previous_page(lists, SCREEN_REMOTE); 909 SCREEN_MAIN;
902 gui_synclist_draw(lists); 910 gui_synclist_select_next_page(lists, screen);
903 yield();
904 return ACTION_STD_NEXT;
905
906 case ACTION_LISTTREE_RC_PGDOWN:
907 gui_synclist_select_next_page(lists, SCREEN_REMOTE);
908 gui_synclist_draw(lists); 911 gui_synclist_draw(lists);
909 yield(); 912 yield();
910 return ACTION_STD_PREV; 913 }
911#endif 914 return ACTION_STD_PREV;
912 } 915 }
913 return 0; 916 return 0;
914} 917}
diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c
index 7997270a3b..413406d8e7 100644
--- a/apps/keymaps/keymap-h1x0_h3x0.c
+++ b/apps/keymaps/keymap-h1x0_h3x0.c
@@ -725,7 +725,7 @@ static const struct button_mapping button_context_menu_remote[] = {
725 { ACTION_MENU_STOP, BUTTON_RC_STOP, BUTTON_NONE }, 725 { ACTION_MENU_STOP, BUTTON_RC_STOP, BUTTON_NONE },
726 { ACTION_MENU_WPS, BUTTON_RC_ON, BUTTON_NONE }, 726 { ACTION_MENU_WPS, BUTTON_RC_ON, BUTTON_NONE },
727 727
728 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 728 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE)
729}; 729};
730 730
731/* the actual used tables */ 731/* the actual used tables */