remove the need for action_signalscreenchange().

Fixes problems with targets where the ACTION_STD_CANCEL event is a combo


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13956 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-07-22 06:05:53 +00:00
parent 9d756e2760
commit f7675a244b
27 changed files with 12 additions and 98 deletions

View File

@ -29,8 +29,8 @@
#include "debug.h"
#include "splash.h"
static bool ignore_until_release = false;
static int last_button = BUTTON_NONE;
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
work on startup */
static int last_action = ACTION_NONE;
static bool repeated = false;
@ -104,6 +104,7 @@ static int get_action_worker(int context, int timeout,
int button;
int i=0;
int ret = ACTION_UNKNOWN;
static int last_context = CONTEXT_STD;
if (timeout == TIMEOUT_NOBLOCK)
button = button_get(false);
@ -117,14 +118,18 @@ static int get_action_worker(int context, int timeout,
return button;
}
if (ignore_until_release == true)
if ((context != last_context) && ((last_button&BUTTON_REL) == 0))
{
if (button&BUTTON_REL)
{
ignore_until_release = false;
last_button = button;
last_action = ACTION_NONE;
}
/* eat all buttons until the previous button was |BUTTON_REL
(also eat the |BUTTON_REL button) */
return ACTION_NONE; /* "safest" return value */
}
last_context = context;
#ifndef HAS_BUTTON_HOLD
screen_has_lock = ((context&ALLOW_SOFTLOCK)==ALLOW_SOFTLOCK);
@ -182,7 +187,6 @@ static int get_action_worker(int context, int timeout,
{
unlock_combo = button;
keys_locked = true;
action_signalscreenchange();
gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON_PLAYER));
button_clear_queue();
@ -214,22 +218,11 @@ int get_custom_action(int context,int timeout,
bool action_userabort(int timeout)
{
action_signalscreenchange();
int action = get_action_worker(CONTEXT_STD,timeout,NULL);
bool ret = (action == ACTION_STD_CANCEL);
action_signalscreenchange();
return ret;
}
void action_signalscreenchange(void)
{
if ((last_button != BUTTON_NONE) &&
!(last_button&BUTTON_REL))
{
ignore_until_release = true;
}
last_button = BUTTON_NONE;
}
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void)
{
@ -247,7 +240,5 @@ int get_action_statuscode(int *button)
ret |= ACTION_REMOTE;
if (repeated)
ret |= ACTION_REPEAT;
if (ignore_until_release)
ret |= ACTION_IGNORING;
return ret;
}

View File

@ -237,8 +237,6 @@ int get_custom_action(int context,int timeout,
const struct button_mapping* (*get_context_map)(int));
/* use if one of the standard CONTEXT_ mappings will work (ALL the core should be using this! */
int get_action(int context, int timeout);
/* call this whenever you leave your button loop */
void action_signalscreenchange(void);
/* call this if you need to check for ACTION_STD_CANCEL only (i.e user abort! */
bool action_userabort(int timeout);
@ -253,8 +251,6 @@ bool is_keys_locked(void);
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);

View File

@ -159,7 +159,6 @@ bool alarm_screen(void)
break;
}
}
action_signalscreenchange();
return false;
}

View File

@ -406,7 +406,6 @@ bool bookmark_autoload(const char* file)
return bookmark_load(global_bookmark_file_name, true);
}
action_signalscreenchange();
return false;
}
}
@ -622,7 +621,6 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK),
Icon_Bookmark);
gui_syncstatusbar_draw(&statusbars, true);
action_signalscreenchange();
while (!exit)
{
@ -638,7 +636,6 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
/* No more bookmarks, delete file and exit */
gui_syncsplash(HZ, str(LANG_BOOKMARK_LOAD_EMPTY));
remove(bookmark_file_name);
action_signalscreenchange();
return NULL;
}
@ -710,7 +707,6 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
case ACTION_STD_OK:
if (item >= 0)
{
action_signalscreenchange();
return bookmarks->items[item - bookmarks->start];
}
@ -741,7 +737,6 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
}
}
action_signalscreenchange();
return NULL;
}

View File

@ -316,7 +316,6 @@ void browse_cuesheet(struct cuesheet *cue)
done = true;
}
}
action_signalscreenchange();
}
bool display_cuesheet_content(char* filename)

View File

@ -152,7 +152,6 @@ static bool dbg_list(struct action_callback_info *info)
gui_synclist_set_nb_items(&lists, info->count*info->selection_size);
if (info->dbg_getname != dbg_menu_getname)
gui_synclist_hide_selection_marker(&lists, true);
action_signalscreenchange();
if (info->action_callback)
info->action_callback(ACTION_REDRAW, info);
@ -174,7 +173,6 @@ static bool dbg_list(struct action_callback_info *info)
else if(default_event_handler(action) == SYS_USB_CONNECTED)
return true;
}
action_signalscreenchange();
return false;
}
/*---------------------------------------------------*/
@ -402,7 +400,6 @@ static bool dbg_audio_thread(void)
tick_remove_task(dbg_audio_task);
action_signalscreenchange();
return false;
}
#endif /* CONFIG_CODEC */
@ -734,7 +731,6 @@ static bool dbg_hw_info(void)
switch(button)
{
case ACTION_STD_CANCEL:
action_signalscreenchange();
return false;
case ACTION_SETTINGS_DEC:
@ -1392,7 +1388,6 @@ bool dbg_ports(void)
switch(button)
{
case ACTION_STD_CANCEL:
action_signalscreenchange();
return false;
case ACTION_SETTINGS_DEC:
@ -1456,7 +1451,6 @@ static bool dbg_cpufreq(void)
break;
case ACTION_STD_CANCEL:
action_signalscreenchange();
return false;
}
}
@ -1651,7 +1645,6 @@ static bool view_battery(void)
break;
case ACTION_STD_CANCEL:
action_signalscreenchange();
return false;
}
}
@ -2136,7 +2129,6 @@ static bool dbg_lcd_power_off(void)
break;
case ACTION_STD_OK:
case ACTION_STD_CANCEL:
action_signalscreenchange();
return false;
default:
sleep(HZ/10);
@ -2214,7 +2206,6 @@ static bool cpu_boost_log(void)
}
lcd_update();
done = false;
action_signalscreenchange();
while (!done)
{
switch(get_action(CONTEXT_STD,TIMEOUT_BLOCK))
@ -2233,7 +2224,6 @@ static bool cpu_boost_log(void)
}
get_action(CONTEXT_STD,TIMEOUT_BLOCK);
lcd_setfont(FONT_UI);
action_signalscreenchange();
return false;
}
#endif

View File

@ -408,6 +408,5 @@ bool set_color(struct screen *display, char *title, unsigned *color,
}
}
action_signalscreenchange();
return false;
}

View File

@ -282,7 +282,6 @@ bool ffwd_rew(int button)
if (!exit)
button = get_action(CONTEXT_WPS,TIMEOUT_BLOCK);
}
action_signalscreenchange();
return usb;
}

View File

@ -101,8 +101,6 @@ long gui_wps_show(void)
bool update_track = false;
int i;
long last_left = 0, last_right = 0;
action_signalscreenchange();
wps_state_init();
@ -242,7 +240,6 @@ long gui_wps_show(void)
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
show_remote_main_backdrop();
#endif
action_signalscreenchange();
if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS)
== ONPLAY_MAINMENU)
return GO_TO_ROOT;
@ -268,7 +265,6 @@ long gui_wps_show(void)
#endif
FOR_NB_SCREENS(i)
gui_wps[i].display->stop_scroll();
action_signalscreenchange();
return GO_TO_PREVIOUS_BROWSER;
break;
@ -562,7 +558,6 @@ long gui_wps_show(void)
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
show_remote_main_backdrop();
#endif
action_signalscreenchange();
if (1 == pitch_screen())
return SYS_USB_CONNECTED;
#if LCD_DEPTH > 1
@ -668,7 +663,6 @@ long gui_wps_show(void)
}
if (exit) {
action_signalscreenchange();
#ifdef HAVE_LCD_CHARCELLS
status_set_record(false);
status_set_audio(false);

View File

@ -364,7 +364,6 @@ bool option_screen(struct settings_list *setting, bool use_temp_var)
gui_synclist_limit_scroll(&lists, true);
gui_synclist_draw(&lists);
action_signalscreenchange();
/* talk the item */
option_talk(setting, *variable);
while (!done)
@ -436,7 +435,6 @@ bool option_screen(struct settings_list *setting, bool use_temp_var)
settings_save();
}
action_signalscreenchange();
return false;
}

View File

@ -172,7 +172,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
bool can_quit=false;
gui_syncquickscreen_draw(qs);
gui_syncstatusbar_draw(&statusbars, true);
action_signalscreenchange();
while (true) {
button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK);
if(default_event_handler(button) == SYS_USB_CONNECTED)
@ -195,7 +194,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
gui_syncstatusbar_draw(&statusbars, false);
}
action_signalscreenchange();
return false;
}

View File

@ -111,7 +111,6 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message,
gui_yesno_set_display(&(yn[i]), &(screens[i]));
gui_yesno_draw(&(yn[i]));
}
action_signalscreenchange();
while (result==-1)
{
button = get_action(CONTEXT_YESNOSCREEN,TIMEOUT_BLOCK);
@ -130,7 +129,6 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message,
result = YESNO_NO;
}
}
action_signalscreenchange();
FOR_NB_SCREENS(i)
result_displayed=gui_yesno_draw_result(&(yn[i]), result);
if(result_displayed)

View File

@ -297,8 +297,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
talk_menu_item(menu, &lists);
action_signalscreenchange();
/* load the callback, and only reload it if menu changes */
get_menu_callback(menu, &menu_callback);
gui_synclist_draw(&lists);
@ -428,7 +426,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
{
int return_value;
talk_item = true;
action_signalscreenchange();
if (temp->flags&MENU_FUNC_USEPARAM)
return_value = temp->function->function_w_param(
temp->function->param);
@ -458,7 +455,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
case MT_RETURN_ID:
if (in_stringlist)
{
action_signalscreenchange();
done = true;
ret = selected;
}
@ -510,7 +506,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected)
if (redraw_lists)
gui_synclist_draw(&lists);
}
action_signalscreenchange();
if (start_selected)
{
/* make sure the start_selected variable is set to

View File

@ -566,7 +566,6 @@ bool eq_menu_graphical(void)
}
}
action_signalscreenchange();
/* Reset screen settings */
FOR_NB_SCREENS(i) {
screens[i].setfont(FONT_UI);

View File

@ -119,10 +119,8 @@ static bool show_credits(void)
if (plugin_load(PLUGIN_DIR "/credits.rock",NULL) != PLUGIN_OK)
{
/* show the rockbox logo and version untill a button is pressed */
action_signalscreenchange();
show_logo();
get_action(CONTEXT_STD, TIMEOUT_BLOCK);
action_signalscreenchange();
}
return false;
}
@ -178,7 +176,7 @@ static bool show_info(void)
#endif
if (talk_menus_enabled())
{
{
/* say whatever is reasonable, no real connection to the screen */
bool enqueue = false; /* enqueue all but the first */
if (battery_level() >= 0)
@ -359,7 +357,6 @@ static bool show_info(void)
break;
}
}
action_signalscreenchange();
return false;
}
MENUITEM_FUNCTION(show_info_item, 0, ID2P(LANG_INFO_MENU),

View File

@ -791,7 +791,6 @@ bool rectrigger(void)
screens[i].setfont(FONT_UI);
screens[i].setmargins(old_x_margin[i], old_y_margin[i]);
}
action_signalscreenchange();
return retval;
}

View File

@ -312,7 +312,6 @@ static int display_playlists(char* playlist, bool view)
break;
}
}
action_signalscreenchange();
return result;
}

View File

@ -571,7 +571,6 @@ bool playlist_viewer_ex(char* filename)
gui_synclist_select_item(&playlist_lists, viewer.selected_track);
gui_synclist_set_title(&playlist_lists, str(LANG_PLAYLIST_MENU), Icon_Playlist);
gui_synclist_draw(&playlist_lists);
action_signalscreenchange();
while (!exit)
{
int track;
@ -719,7 +718,6 @@ bool playlist_viewer_ex(char* filename)
exit:
if (viewer.playlist)
playlist_close(viewer.playlist);
action_signalscreenchange();
return ret;
}
@ -804,7 +802,6 @@ bool search_playlist(void)
break;
}
}
action_signalscreenchange();
return ret;
}

View File

@ -411,7 +411,6 @@ static const struct plugin_api rockbox_api = {
/* action handling */
get_custom_action,
get_action,
action_signalscreenchange,
action_userabort,
/* power */
@ -515,7 +514,6 @@ int plugin_load(const char* plugin, void* parameter)
if (!p)
p = plugin;
action_signalscreenchange();
if (pfn_tsr_exit != NULL) /* if we have a resident old plugin: */
{
@ -611,7 +609,6 @@ int plugin_load(const char* plugin, void* parameter)
rc = hdr->entry_point((struct plugin_api*) &rockbox_api, parameter);
/* explicitly casting the pointer here to avoid touching every plugin. */
action_signalscreenchange();
button_clear_queue();
#ifdef HAVE_LCD_BITMAP

View File

@ -112,12 +112,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 63
#define PLUGIN_API_VERSION 64
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 63
#define PLUGIN_MIN_API_VERSION 64
/* plugin return codes */
enum plugin_status {
@ -520,7 +520,6 @@ struct plugin_api {
int (*get_custom_action)(int context,int timeout,
const struct button_mapping* (*get_context_map)(int));
int (*get_action)(int context, int timeout);
void (*action_signalscreenchange)(void);
bool (*action_userabort)(int timeout);
/* power */

View File

@ -95,7 +95,6 @@ int menu_show(int m)
int key;
rb->gui_synclist_draw(&(menus[m].synclist));
rb->action_signalscreenchange();
rb->gui_syncstatusbar_draw(rb->statusbars, true);
while (!exit) {
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
@ -111,7 +110,6 @@ int menu_show(int m)
rb->gui_synclist_do_button(&(menus[m].synclist), key,LIST_WRAP_UNLESS_HELD);
switch( key ) {
case ACTION_STD_OK:
rb->action_signalscreenchange();
return rb->gui_synclist_get_sel_pos(&(menus[m].synclist));
@ -127,7 +125,6 @@ int menu_show(int m)
}
rb->gui_syncstatusbar_draw(rb->statusbars, false);
}
rb->action_signalscreenchange();
return MENU_SELECTED_EXIT;
}

View File

@ -295,7 +295,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
}
}
rb->global_settings->statusbar = prev_show_statusbar;
rb->action_signalscreenchange();
return PLUGIN_OK;
}

View File

@ -513,7 +513,6 @@ int kbd_input(char* text, int buflen)
if (talk_menus_enabled()) /* voice UI? */
talk_spell(text, true); /* spell initial text */
action_signalscreenchange();
while (!done)
{
@ -755,7 +754,6 @@ int kbd_input(char* text, int buflen)
#ifdef HAS_BUTTONBAR
global_settings.buttonbar=buttonbar_config;
#endif
action_signalscreenchange();
return -1;
break;
@ -1188,7 +1186,6 @@ int kbd_input(char* text, int buflen)
cur_blink = true;
}
}
action_signalscreenchange();
#ifdef HAS_BUTTONBAR
global_settings.buttonbar = buttonbar_config;

View File

@ -1260,7 +1260,6 @@ static int handle_radio_presets(void)
gui_synclist_set_nb_items(&lists, num_presets);
gui_synclist_select_item(&lists, curr_preset<0 ? 0 : curr_preset);
action_signalscreenchange();
while (result == 0)
{
gui_synclist_draw(&lists);
@ -1293,7 +1292,6 @@ static int handle_radio_presets(void)
result = 2;
}
}
action_signalscreenchange();
return result - 1;
}
@ -1424,9 +1422,6 @@ static int fm_recording_screen(void)
int rec_source = global_settings.rec_source;
global_settings.rec_source = AUDIO_SRC_FMRADIO;
/* clearing queue seems to cure a spontaneous abort during record */
action_signalscreenchange();
ret = recording_screen(true);
/* safe to reset as changing sources is prohibited here */

View File

@ -411,7 +411,6 @@ static inline int load_screen(int screen)
old_previous = GO_TO_ROOT;
global_status.last_screen = (char)screen;
status_save();
action_signalscreenchange();
ret_val = items[screen].function(items[screen].param);
last_screen = screen;
if (ret_val == GO_TO_PREVIOUS)

View File

@ -367,7 +367,6 @@ int charging_screen(void)
#ifdef HAVE_LCD_CHARCELLS
logo_lock_patterns(false);
#endif
action_signalscreenchange();
return rc;
}
#endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */
@ -541,7 +540,6 @@ bool pitch_screen(void)
pcmbuf_set_low_latency(true);
#endif
action_signalscreenchange();
while (!exit)
{
FOR_NB_SCREENS(i)
@ -625,7 +623,6 @@ bool pitch_screen(void)
pcmbuf_set_low_latency(false);
#endif
lcd_setfont(FONT_UI);
action_signalscreenchange();
return 0;
}
#endif /* HAVE_PITCHSCREEN */
@ -1107,7 +1104,6 @@ bool set_time_screen(const char* title, struct tm *tm)
screens[i].setfont(FONT_UI);
gui_textarea_update_nblines(&screens[i]);
}
action_signalscreenchange();
return false;
}
#endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */
@ -1145,7 +1141,6 @@ bool shutdown_screen(void)
break;
}
}
action_signalscreenchange();
return false;
}
#endif
@ -1268,14 +1263,12 @@ bool browse_id3(void)
sizeof(id3_headers)/sizeof(id3_headers[0])*2);
gui_synclist_draw(&id3_lists);
gui_syncstatusbar_draw(&statusbars, true);
action_signalscreenchange();
while (true) {
gui_syncstatusbar_draw(&statusbars, false);
key = get_action(CONTEXT_LIST,HZ/2);
if(key!=ACTION_NONE && key!=ACTION_UNKNOWN
&& !gui_synclist_do_button(&id3_lists, key,LIST_WRAP_UNLESS_HELD))
{
action_signalscreenchange();
return(default_event_handler(key) == SYS_USB_CONNECTED);
}
}
@ -1314,7 +1307,6 @@ bool view_runtime(void)
#endif
gui_synclist_set_icon_callback(&lists, NULL);
gui_synclist_set_nb_items(&lists, 4);
action_signalscreenchange();
while(1)
{
#if CONFIG_CHARGING
@ -1350,7 +1342,6 @@ bool view_runtime(void)
if(default_event_handler(action) == SYS_USB_CONNECTED)
return true;
}
action_signalscreenchange();
return false;
}

View File

@ -608,7 +608,6 @@ static int dirbrowse()
if (last_cancel && TIME_BEFORE(current_tick, last_cancel+HZ/2))
{
last_cancel = 0;
action_signalscreenchange(); /* eat the cancel presses */
break;
}
else
@ -922,7 +921,6 @@ static int dirbrowse()
}
}
}
action_signalscreenchange();
return true;
}