diff --git a/apps/gui/usb_screen.c b/apps/gui/usb_screen.c index 29d88daf06..d3baa5b0ba 100644 --- a/apps/gui/usb_screen.c +++ b/apps/gui/usb_screen.c @@ -128,9 +128,10 @@ struct usb_screen_vps_t }; #ifdef HAVE_LCD_BITMAP -static void usb_screen_fix_viewports(struct screen *screen, +static bool usb_screen_fix_viewports(struct screen *screen, struct usb_screen_vps_t *usb_screen_vps) { + bool theme_needs_undo = false; int logo_width, logo_height; struct viewport *parent = &usb_screen_vps->parent; struct viewport *logo = &usb_screen_vps->logo; @@ -150,7 +151,10 @@ static void usb_screen_fix_viewports(struct screen *screen, viewport_set_defaults(parent, screen->screen_type); if (parent->width < logo_width || parent->height < logo_height) + { + theme_needs_undo = true; viewportmanager_theme_enable(screen->screen_type, false, parent); + } *logo = *parent; logo->x = parent->x + parent->width - logo_width; @@ -174,6 +178,7 @@ static void usb_screen_fix_viewports(struct screen *screen, } } #endif + return theme_needs_undo; } #endif @@ -240,6 +245,7 @@ static void usb_screens_draw(struct usb_screen_vps_t *usb_screen_vps_ar) void gui_usb_screen_run(void) { int i; + bool screen_theme_needs_undo[NB_SCREENS]; struct usb_screen_vps_t usb_screen_vps_ar[NB_SCREENS]; #if defined HAVE_TOUCHSCREEN enum touchscreen_mode old_mode = touchscreen_get_mode(); @@ -264,7 +270,7 @@ void gui_usb_screen_run(void) screen->set_viewport(NULL); #ifdef HAVE_LCD_BITMAP - usb_screen_fix_viewports(screen, &usb_screen_vps_ar[i]); + screen_theme_needs_undo[i] = usb_screen_fix_viewports(screen, &usb_screen_vps_ar[i]); #endif } @@ -311,7 +317,8 @@ void gui_usb_screen_run(void) FOR_NB_SCREENS(i) { screens[i].backlight_on(); - viewportmanager_theme_undo(i); + if(screen_theme_needs_undo[i]) + viewportmanager_theme_undo(i); } }