diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c index 9671d7c4dc..4a41a26c7d 100644 --- a/apps/gui/skin_engine/wps_parser.c +++ b/apps/gui/skin_engine/wps_parser.c @@ -625,9 +625,6 @@ static int parse_viewport(const char *wps_bufptr, struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp; /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ - /* Set the defaults for fields not user-specified */ - vp->drawmode = DRMODE_SOLID; - if (!(ptr = viewport_parse_viewport(vp, screen, ptr, '|'))) return WPS_ERROR_INVALID_PARAM; diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index a2c4351d03..2819d36625 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -168,6 +168,12 @@ void viewportmanager_statusbar_changed(void* data) viewportmanager_set_statusbar(statusbar_enabled); } +#ifdef HAVE_LCD_COLOR +#define ARG_STRING (depth == 2 ? "dddddgg":"dddddcc") +#else +#define ARG_STRING "dddddcc" +#endif + #ifdef HAVE_LCD_BITMAP const char* viewport_parse_viewport(struct viewport *vp, enum screen_type screen, @@ -191,31 +197,25 @@ const char* viewport_parse_viewport(struct viewport *vp, /* Work out the depth of this display */ depth = screens[screen].depth; -#ifdef HAVE_LCD_COLOR - if (depth == 16) - { - if (!(ptr = parse_list("dddddcc", &set, separator, ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern))) - return VP_ERROR; - } - else -#endif -#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) - if (depth == 2) { - if (!(ptr = parse_list("dddddgg", &set, separator, ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern))) - return VP_ERROR; - } - else -#endif #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) if (depth == 1) { - if (!(ptr = parse_list("ddddd", &set, separator, ptr, &vp->x, &vp->y, &vp->width, - &vp->height, &vp->font))) + if (!(ptr = parse_list("ddddd", &set, separator, ptr, + &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) return VP_ERROR; } else +#endif +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + if (depth >= 2) + { + if (!(ptr = parse_list(ARG_STRING, &set, separator, ptr, + &vp->x, &vp->y, &vp->width, &vp->height, &vp->font, + &vp->fg_pattern,&vp->bg_pattern))) + return VP_ERROR; + } + else +#undef ARG_STRING #endif {} @@ -254,7 +254,8 @@ const char* viewport_parse_viewport(struct viewport *vp, || !LIST_VALUE_PARSED(set, PL_FONT) ) vp->font = FONT_UI; - + + /* Set the defaults for fields not user-specified */ vp->drawmode = DRMODE_SOLID; return ptr;