make sure plugin reset backlight setting before exit. do code polish.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24076 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-12-18 14:17:28 +00:00
parent 3e2aba0c3e
commit dc010201a5
9 changed files with 73 additions and 71 deletions

View file

@ -136,7 +136,7 @@ enum {
#define BJACK_LEFT BUTTON_LEFT
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define BJACK_SELECT_NAME "PLAY"
#define BJACK_SELECT_NAME "SELECT"
#define BJACK_STAY_NAME "REC"
#define BJACK_RESUME_NAME "DOWN"
#define BJACK_QUIT_NAME "POWER"

View file

@ -278,5 +278,3 @@ enum plugin_status plugin_start(const void* parameter)
}
}
}

View file

@ -676,7 +676,7 @@ static void play_game()
{
int old_x = robot.x;
int old_y = robot.y;
int input = 0; /* Not sure what a reasonable initial value is */
int input = BUTTON_NONE;
#ifdef __PLUGINLIB_ACTIONS_H__
const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
#endif

View file

@ -468,6 +468,7 @@ enum plugin_status plugin_start(const void* parameter)
int button = 0;
int quit = 0;
int stop = 0;
int usb = 0;
int pattern = 0;
char *pgrid;
char *pnext_grid;
@ -490,7 +491,6 @@ enum plugin_status plugin_start(const void* parameter)
init_grid(pgrid);
if( parameter == NULL )
{
setup_grid(pgrid, pattern++);
@ -544,6 +544,11 @@ enum plugin_status plugin_start(const void* parameter)
stop = 1;
break;
default:
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
stop = 1;
quit = 1;
usb = 1;
}
break;
}
rb->yield();
@ -562,12 +567,12 @@ enum plugin_status plugin_start(const void* parameter)
break;
case ROCKLIFE_QUIT:
/* quit plugin */
quit=true;
return PLUGIN_OK;
quit = 1;
break;
default:
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
return PLUGIN_USB_CONNECTED;
quit = 1;
usb = 1;
}
break;
}
@ -575,5 +580,5 @@ enum plugin_status plugin_start(const void* parameter)
}
backlight_use_settings(); /* backlight control in lib/helper.c */
return PLUGIN_OK;
return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
}

View file

@ -482,8 +482,6 @@ int plugin_main(void)
#endif
case(STARFIELD_QUIT):
case(SYS_USB_CONNECTED):
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c*/
return PLUGIN_OK;
break;
}
@ -502,6 +500,9 @@ enum plugin_status plugin_start(const void* parameter)
ret = plugin_main();
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c*/
return ret;
}

View file

@ -86,7 +86,7 @@ char* _do_action(int action, char* str, int line)
break;
case ACTION_REMOVE:
if (line > line_count)
return 0;
return NULL;
len = rb->strlen(&buffer[c])+1;
rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len);
char_count -= len;
@ -225,7 +225,7 @@ enum {
};
int do_item_menu(int cur_sel, char* copy_buffer)
{
int ret = 0;
int ret = MENU_RET_NO_UPDATE;
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
"Cut/Delete", "Copy",
"Insert Above", "Insert Below",

View file

@ -1,12 +1,11 @@
/***************************************************************************
*
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* $Id$
*
* Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner
*
@ -432,7 +431,6 @@ struct preferences {
} scroll_mode;
int autoscroll_speed;
};
struct preferences prefs;