Add a function to get the actual button that was pressed (and some
status codes) instead of the action. Use this to figure out which screen to do prev/next page on in the lists git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12580 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
598629c3bf
commit
ca701bf62e
4 changed files with 59 additions and 26 deletions
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
static bool ignore_until_release = false;
|
static bool ignore_until_release = false;
|
||||||
static int last_button = BUTTON_NONE;
|
static int last_button = BUTTON_NONE;
|
||||||
|
static int last_action = ACTION_NONE;
|
||||||
|
static bool repeated = false;
|
||||||
|
|
||||||
/* software keylock stuff */
|
/* software keylock stuff */
|
||||||
#ifndef HAS_BUTTON_HOLD
|
#ifndef HAS_BUTTON_HOLD
|
||||||
|
@ -107,7 +109,6 @@ static int get_action_worker(int context, int timeout,
|
||||||
else
|
else
|
||||||
button = button_get_w_tmo(timeout);
|
button = button_get_w_tmo(timeout);
|
||||||
|
|
||||||
|
|
||||||
if (button == BUTTON_NONE || button&SYS_EVENT)
|
if (button == BUTTON_NONE || button&SYS_EVENT)
|
||||||
{
|
{
|
||||||
return button;
|
return button;
|
||||||
|
@ -185,6 +186,11 @@ static int get_action_worker(int context, int timeout,
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (ret == last_action)
|
||||||
|
repeated = true;
|
||||||
|
else
|
||||||
|
repeated = false;
|
||||||
|
|
||||||
last_button = button;
|
last_button = button;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -224,3 +230,18 @@ bool is_keys_locked(void)
|
||||||
return (screen_has_lock && (keys_locked == true));
|
return (screen_has_lock && (keys_locked == true));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int get_action_statuscode(int *button)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
if (button)
|
||||||
|
*button = last_button;
|
||||||
|
|
||||||
|
if (last_button&BUTTON_REMOTE)
|
||||||
|
ret |= ACTION_REMOTE;
|
||||||
|
if (repeated)
|
||||||
|
ret |= ACTION_REPEAT;
|
||||||
|
if (ignore_until_release)
|
||||||
|
ret |= ACTION_IGNORING;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -123,8 +123,6 @@ enum {
|
||||||
/* list and tree page up/down */
|
/* list and tree page up/down */
|
||||||
ACTION_LISTTREE_PGUP,/* optional */
|
ACTION_LISTTREE_PGUP,/* optional */
|
||||||
ACTION_LISTTREE_PGDOWN,/* optional */
|
ACTION_LISTTREE_PGDOWN,/* optional */
|
||||||
ACTION_LISTTREE_RC_PGUP,/* optional */
|
|
||||||
ACTION_LISTTREE_RC_PGDOWN,/* optional */
|
|
||||||
|
|
||||||
/* tree */
|
/* tree */
|
||||||
ACTION_TREE_ROOT_INIT,
|
ACTION_TREE_ROOT_INIT,
|
||||||
|
@ -248,4 +246,15 @@ const struct button_mapping* get_context_mapping(int context);
|
||||||
#ifndef HAS_BUTTON_HOLD
|
#ifndef HAS_BUTTON_HOLD
|
||||||
bool is_keys_locked(void);
|
bool is_keys_locked(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* returns the status code variable from action.c for the button just pressed
|
||||||
|
If button != NULL it will be set to the actual button code */
|
||||||
|
#define ACTION_REMOTE 0x1 /* remote was pressed */
|
||||||
|
#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
|
||||||
|
#define ACTION_IGNORING 0x4 /* action_signalscreenchange() was called \
|
||||||
|
waiting for BUTTON_REL */
|
||||||
|
int get_action_statuscode(int *button);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -886,29 +886,32 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists,
|
||||||
* on the screen for which the user pressed the key since for example, remote
|
* on the screen for which the user pressed the key since for example, remote
|
||||||
* and main screen doesn't have the same number of lines */
|
* and main screen doesn't have the same number of lines */
|
||||||
case ACTION_LISTTREE_PGUP:
|
case ACTION_LISTTREE_PGUP:
|
||||||
gui_synclist_select_previous_page(lists, SCREEN_MAIN);
|
{
|
||||||
gui_synclist_draw(lists);
|
int screen =
|
||||||
yield();
|
#if BUTTON_REMOTE
|
||||||
return ACTION_STD_NEXT;
|
get_action_statuscode(NULL)&ACTION_REMOTE ?
|
||||||
|
SCREEN_REMOTE :
|
||||||
case ACTION_LISTTREE_PGDOWN:
|
|
||||||
gui_synclist_select_next_page(lists, SCREEN_MAIN);
|
|
||||||
gui_synclist_draw(lists);
|
|
||||||
yield();
|
|
||||||
return ACTION_STD_PREV;
|
|
||||||
#ifdef REMOTE_BUTTON
|
|
||||||
case ACTION_LISTTREE_RC_PGUP:
|
|
||||||
gui_synclist_select_previous_page(lists, SCREEN_REMOTE);
|
|
||||||
gui_synclist_draw(lists);
|
|
||||||
yield();
|
|
||||||
return ACTION_STD_NEXT;
|
|
||||||
|
|
||||||
case ACTION_LISTTREE_RC_PGDOWN:
|
|
||||||
gui_synclist_select_next_page(lists, SCREEN_REMOTE);
|
|
||||||
gui_synclist_draw(lists);
|
|
||||||
yield();
|
|
||||||
return ACTION_STD_PREV;
|
|
||||||
#endif
|
#endif
|
||||||
|
SCREEN_MAIN;
|
||||||
|
gui_synclist_select_previous_page(lists, screen);
|
||||||
|
gui_synclist_draw(lists);
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
return ACTION_STD_NEXT;
|
||||||
|
|
||||||
|
case ACTION_LISTTREE_PGDOWN:
|
||||||
|
{
|
||||||
|
int screen =
|
||||||
|
#if BUTTON_REMOTE
|
||||||
|
get_action_statuscode(NULL)&ACTION_REMOTE ?
|
||||||
|
SCREEN_REMOTE :
|
||||||
|
#endif
|
||||||
|
SCREEN_MAIN;
|
||||||
|
gui_synclist_select_next_page(lists, screen);
|
||||||
|
gui_synclist_draw(lists);
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
return ACTION_STD_PREV;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,7 +725,7 @@ static const struct button_mapping button_context_menu_remote[] = {
|
||||||
{ ACTION_MENU_STOP, BUTTON_RC_STOP, BUTTON_NONE },
|
{ ACTION_MENU_STOP, BUTTON_RC_STOP, BUTTON_NONE },
|
||||||
{ ACTION_MENU_WPS, BUTTON_RC_ON, BUTTON_NONE },
|
{ ACTION_MENU_WPS, BUTTON_RC_ON, BUTTON_NONE },
|
||||||
|
|
||||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* the actual used tables */
|
/* the actual used tables */
|
||||||
|
|
Loading…
Reference in a new issue