Index: apps/gui/gwps-common.c =================================================================== --- apps/gui/gwps-common.c (revision 19584) +++ apps/gui/gwps-common.c (working copy) @@ -1918,7 +1918,7 @@ ypos = (line * string_height); - if (scroll && ((left_width > scroll_width) || + if (scroll && ((left_width > scroll_width) || (center_width > scroll_width) || (right_width > scroll_width))) { @@ -1956,7 +1956,11 @@ } } } - +#ifdef HAVE_LCD_ENABLE +/*on targets that can disable the LCD, we set a flag that tells if LCD updates + have been disabled*/ +int updates_disabled=0; +#endif /* Refresh the WPS according to refresh_mode. */ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset, @@ -1980,6 +1984,7 @@ align.right = NULL; bool update_line, new_subline_refresh; + bool caption = false; #ifdef HAVE_LCD_BITMAP gui_wps_statusbar_draw(gwps, true); @@ -2021,6 +2026,82 @@ return false; } +#ifdef HAVE_BACKLIGHT + if (global_settings.caption_backlight && state->id3) + { + /* turn on backlight n seconds before track ends, and turn it off n + seconds into the new track. n == backlight_timeout, or 5s */ + int n = global_settings.backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + { + backlight_on(); + caption = true; + } + } +#endif +#ifdef HAVE_REMOTE_LCD + if (global_settings.remote_caption_backlight && state->id3) + { + /* turn on remote backlight n seconds before track ends, and turn it + off n seconds into the new track. n == remote_backlight_timeout, + or 5s */ + int n = global_settings.remote_backlight_timeout * 1000; + + if ( n < 1000 ) + n = 5000; /* use 5s if backlight is always on or off */ + + if (((state->id3->elapsed < 1000) || + ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && + (state->paused == false)) + { + remote_backlight_on(); + caption = true; + } + } +#endif + + /* For some targets, the display is unreadable if the backlight is off. + * If so, only render the WPS if the backlight is (about to be) turned + * on. + */ +#ifdef HAVE_LCD_ENABLE + if (!(caption || is_backlight_on(false) +#if defined(HAVE_REMOTE_LCD) + || is_remote_backlight_on() +#endif + )) + { + if(!updates_disabled){ + updates_disabled=1; + + /*set the reset flag on all alternating text fields so they're + properly reset when updates are resumed */ + for (v = 0; v < data->num_viewports; v++){ + for (line = data->viewports[v].first_line; + line <= data->viewports[v].last_line; line++) + { + gwps->data->lines[line].curr_subline = SUBLINE_RESET; + + } + } + + + } + return true; + } + else + { + updates_disabled=0; + } + +#endif + state->ff_rewind_count = ffwd_offset; /* disable any viewports which are conditionally displayed */ @@ -2065,8 +2146,8 @@ { display->clear_viewport(); } - - for (line = data->viewports[v].first_line; + + for (line = data->viewports[v].first_line; line <= data->viewports[v].last_line; line++) { memset(linebuf, 0, sizeof(linebuf)); @@ -2126,7 +2207,7 @@ } #endif - if (update_line && + if (update_line && /* conditionals clear the line which means if the %Vd is put into the default viewport there will be a blank line. To get around this we dont allow any actual drawing to happen in the @@ -2166,40 +2247,6 @@ display->update(); -#ifdef HAVE_BACKLIGHT - if (global_settings.caption_backlight && state->id3) - { - /* turn on backlight n seconds before track ends, and turn it off n - seconds into the new track. n == backlight_timeout, or 5s */ - int n = global_settings.backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((state->id3->elapsed < 1000) || - ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - backlight_on(); - } -#endif -#ifdef HAVE_REMOTE_LCD - if (global_settings.remote_caption_backlight && state->id3) - { - /* turn on remote backlight n seconds before track ends, and turn it - off n seconds into the new track. n == remote_backlight_timeout, - or 5s */ - int n = global_settings.remote_backlight_timeout * 1000; - - if ( n < 1000 ) - n = 5000; /* use 5s if backlight is always on or off */ - - if (((state->id3->elapsed < 1000) || - ((state->id3->length - state->id3->elapsed) < (unsigned)n)) && - (state->paused == false)) - remote_backlight_on(); - } -#endif - return true; }