Index: ../apps/gui/gwps-common.c =================================================================== --- ../apps/gui/gwps-common.c (revision 16104) +++ ../apps/gui/gwps-common.c (working copy) @@ -1858,33 +1858,30 @@ struct wps_data *data = gwps->data; struct screen *display = gwps->display; struct wps_state *state = gwps->state; + struct align_pos align; + int line, i; + bool caption = false; + /* to find out wether the peak meter is enabled we + assume it wasn't until we find a line that contains + the peak meter. We can't use peak_meter_enabled itself + because that would mean to turn off the meter thread + temporarily. (That shouldn't matter unless yield + or sleep is called but who knows...) + */ + bool enable_pm = false; + if(!gwps || !data || !state || !display) return false; - int line, i, subline_idx; - unsigned char flags; - char linebuf[MAX_PATH]; - - struct align_pos align; align.left = NULL; align.center = NULL; align.right = NULL; - bool update_line, new_subline_refresh; #ifdef HAVE_LCD_BITMAP gui_wps_statusbar_draw(gwps, true); - /* to find out wether the peak meter is enabled we - assume it wasn't until we find a line that contains - the peak meter. We can't use peak_meter_enabled itself - because that would mean to turn off the meter thread - temporarily. (That shouldn't matter unless yield - or sleep is called but who knows...) - */ - bool enable_pm = false; - /* Set images to not to be displayed */ for (i = 0; i < MAX_IMAGES; i++) { @@ -1915,12 +1912,73 @@ 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 models, the display is unreadable if the backlight is off. + * If so, only render the WPS if the backlight is (about to be) turned + * on. + */ +#if defined(HAVE_BACKLIGHT) && (defined(SANSA_E200)) + if (!(caption || is_backlight_on() +#if defined(HAVE_REMOTE_LCD) + || is_remote_backlight_on() +#endif + )) + { + display->stop_scroll(); + return true; + } +#endif + state->ff_rewind_count = ffwd_offset; for (line = 0; line < data->num_lines; line++) { + int subline_idx; + bool update_line = false; + bool new_subline_refresh; + char linebuf[MAX_PATH]; + unsigned char flags; + memset(linebuf, 0, sizeof(linebuf)); - update_line = false; /* get current subline for the line */ new_subline_refresh = update_curr_subline(gwps, line); @@ -2001,40 +2059,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; }