Revert r23599 and r23600 and fix the early usb problem at the root. The the viewportmanager and custom statusbar was initialized too late.

Now, call it earlier and remove parts of it that caused the need to call it later. Removing that is OK since it's done again on settings loading.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23603 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-11-10 20:13:24 +00:00
parent 422fcbe35d
commit c5b4482ee2
5 changed files with 31 additions and 37 deletions

View file

@ -129,7 +129,7 @@ struct usb_screen_vps_t
#ifdef HAVE_LCD_BITMAP
static void usb_screen_fix_viewports(struct screen *screen,
struct usb_screen_vps_t *usb_screen_vps, bool early_usb)
struct usb_screen_vps_t *usb_screen_vps)
{
int logo_width, logo_height;
struct viewport *parent = &usb_screen_vps->parent;
@ -148,15 +148,10 @@ static void usb_screen_fix_viewports(struct screen *screen,
logo_height = BMPHEIGHT_usblogo;
}
if (!early_usb)
{
viewport_set_defaults(parent, screen->screen_type);
if (parent->width < logo_width || parent->height < logo_height)
viewport_set_fullscreen(parent, screen->screen_type);
}
else
viewport_set_defaults(parent, screen->screen_type);
if (parent->width < logo_width || parent->height < logo_height)
viewport_set_fullscreen(parent, screen->screen_type);
*logo = *parent;
logo->x = parent->x + parent->width - logo_width;
logo->y = parent->y + (parent->height - logo_height) / 2;
@ -182,7 +177,7 @@ static void usb_screen_fix_viewports(struct screen *screen,
}
#endif
static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar, bool early_usb)
static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar)
{
int i;
int usb_bars = VP_SB_ALLSCREENS; /* force statusbars */
@ -241,14 +236,13 @@ static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar, bool ea
usb_bars |= VP_SB_IGNORE_SETTING(i);
}
if (!early_usb)
viewportmanager_set_statusbar(usb_bars);
viewportmanager_set_statusbar(usb_bars);
}
void gui_usb_screen_run(bool early_usb)
void gui_usb_screen_run(void)
{
int i;
int old_bars = early_usb ? 0 : viewportmanager_get_statusbar();
int old_bars = viewportmanager_get_statusbar();
struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS];
#if defined HAVE_TOUCHSCREEN
enum touchscreen_mode old_mode = touchscreen_get_mode();
@ -273,13 +267,13 @@ void gui_usb_screen_run(bool early_usb)
screen->set_viewport(NULL);
#ifdef HAVE_LCD_BITMAP
usb_screen_fix_viewports(screen, &usb_screen_vps_ar[i], early_usb);
usb_screen_fix_viewports(screen, &usb_screen_vps_ar[i]);
#endif
}
while (1)
{
usb_screens_draw(usb_screen_vps_ar, early_usb);
usb_screens_draw(usb_screen_vps_ar);
#ifdef SIMULATOR
if (button_get_w_tmo(HZ/2))
break;
@ -321,11 +315,9 @@ void gui_usb_screen_run(bool early_usb)
{
screens[i].backlight_on();
}
if (!early_usb)
{
viewportmanager_set_statusbar(old_bars);
send_event(GUI_EVENT_REFRESH, NULL);
}
viewportmanager_set_statusbar(old_bars);
send_event(GUI_EVENT_REFRESH, NULL);
}
#endif /* !defined(USB_NONE) */

View file

@ -21,7 +21,7 @@
#ifndef _USB_SCREEN_H_
#define _USB_SCREEN_H_
extern void gui_usb_screen_run(bool early_usb);
extern void gui_usb_screen_run(void);
#endif

View file

@ -104,12 +104,7 @@ static bool showing_bars(enum screen_type screen)
void viewportmanager_init(void)
{
#ifdef HAVE_LCD_BITMAP
int retval, i;
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggled);
retval = viewport_init_ui_vp();
FOR_NB_SCREENS(i)
ui_vp_info.active[i] = retval & BIT_N(i);
ui_vp_info.vp = custom_vp;
#endif
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
}

View file

@ -142,7 +142,8 @@ int main(void)
list_init();
#endif
tree_gui_init();
viewportmanager_init();
/* Keep the order of this 3
* Must be done before any code uses the multi-screen API */
#ifdef HAVE_USBSTACK
/* All threads should be created and public queues registered by now */
usb_start_monitoring();
@ -318,13 +319,16 @@ static void init(void)
#ifdef DEBUG
debug_init();
#endif
/* Must be done before any code uses the multi-screen API */
/* Keep the order of this 3 (viewportmanager handles statusbars)
* Must be done before any code uses the multi-screen API */
gui_syncstatusbar_init(&statusbars);
sb_skin_init();
viewportmanager_init();
gui_sync_wps_init();
storage_init();
settings_reset();
settings_load(SETTINGS_ALL);
gui_sync_wps_init();
sb_skin_init();
settings_apply(true);
init_dircache(true);
init_dircache(false);
@ -443,8 +447,13 @@ static void init(void)
radio_init();
#endif
/* Must be done before any code uses the multi-screen API */
/* Keep the order of this 3 (viewportmanager handles statusbars)
* Must be done before any code uses the multi-screen API */
gui_syncstatusbar_init(&statusbars);
sb_skin_init();
viewportmanager_init();
gui_sync_wps_init();
#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
/* charger_inserted() can't be used here because power_thread()
@ -496,7 +505,7 @@ static void init(void)
(mmc_remove_request() == SYS_HOTSWAP_EXTRACTED))
#endif
{
gui_usb_screen_run(true);
gui_usb_screen_run();
mounted = true; /* mounting done @ end of USB mode */
}
#ifdef HAVE_USB_POWER
@ -521,7 +530,7 @@ static void init(void)
lcd_update();
while(button_get(true) != SYS_USB_CONNECTED) {};
gui_usb_screen_run(true);
gui_usb_screen_run();
system_reboot();
}
}
@ -551,8 +560,6 @@ static void init(void)
#endif
}
gui_sync_wps_init();
sb_skin_init();
settings_apply(true);
init_dircache(false);
#ifdef HAVE_TAGCACHE

View file

@ -581,7 +581,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
check_bootfile(false); /* gets initial size */
#endif
#endif
gui_usb_screen_run(false);
gui_usb_screen_run();
#ifdef BOOTFILE
#if !defined(USB_NONE) && !defined(USB_HANDLED_BY_OF)
check_bootfile(true);