Index: apps/gui/gwps-common.c
===================================================================
--- apps/gui/gwps-common.c	(révision 13054)
+++ apps/gui/gwps-common.c	(copie de travail)
@@ -535,6 +535,7 @@
     gwps->display->fillrect(data->img[n].x, data->img[n].y,
                             data->img[n].bm.width, data->img[n].bm.height);
     gwps->display->set_drawmode(DRMODE_SOLID);
+    data->img[n].displayed = false;
 }
 
 static void wps_draw_image(struct gui_wps *gwps, int n)
@@ -560,6 +561,7 @@
                                     data->img[n].bm.height);
     }
 #endif
+    data->img[n].displayed = true;
 }
 
 static void wps_display_images(struct gui_wps *gwps)
@@ -1337,12 +1339,12 @@
     }
 
 #ifdef HAVE_LCD_BITMAP
-    /* clear all pictures in the conditional */
+    /* mark all pictures in the conditional as needing to be cleared */
     int i;
-    for (i=0; i < MAX_IMAGES; i++)
+    for (i = 0; i < MAX_IMAGES; i++)
     {
         if (data->img[i].cond_index == cond_index)
-            clear_image_pos(gwps, i);
+            data->img[i].clear = true;
     }
 #endif
 
@@ -1403,7 +1405,10 @@
                 struct gui_img *img = data->img;
                 int n = data->tokens[i].value.i;
                 if (n >= 0 && n < MAX_IMAGES && img[n].loaded)
+                {
                     img[n].display = true;
+                    img[n].clear = false;
+                }
                 break;
             }
 #endif
@@ -1794,6 +1799,7 @@
     for (i = 0; i < MAX_IMAGES; i++)
     {
         data->img[i].display = false;
+        data->img[i].clear = false;
     }
 #endif
 
@@ -1833,8 +1839,9 @@
         flags = data->line_type[line][data->curr_subline[line]];
 
         if (refresh_mode == WPS_REFRESH_ALL || flags & refresh_mode
-            || new_subline_refresh)
+            || new_subline_refresh || data->force_refresh[line])
         {
+            data->force_refresh[line] = false;
             /* get_line tells us if we need to update the line */
             update_line = get_line(gwps, line, data->curr_subline[line],
                                    &align, linebuf, sizeof(linebuf));
@@ -1885,6 +1892,24 @@
 
         if (update_line)
         {
+#ifdef HAVE_LCD_BITMAP
+            /* clear pictures that are marked to be cleared
+               and force an update on the lines that they used to hide */
+            for (i = 0; i < MAX_IMAGES; i++)
+            {
+                if (data->img[i].displayed && data->img[i].clear)
+                {
+                    clear_image_pos(gwps, i);
+                    int h = font_get(FONT_UI)->height;
+                    int l;
+                    for (l = data->img[i].y / h; l <= (data->img[i].y + data->img[i].bm.height) / h; l++)
+                    {
+                        data->force_refresh[l] = true;
+                        DEBUGF("force refresh of line %d\n", l);
+                    }
+                }
+            }
+#endif
             /* calculate alignment and draw the strings */
             write_line(display, &align, line, flags & WPS_REFRESH_SCROLL);
         }
Index: apps/gui/gwps.h
===================================================================
--- apps/gui/gwps.h	(révision 13054)
+++ apps/gui/gwps.h	(copie de travail)
@@ -47,8 +47,10 @@
     int x;                  /* x-pos */
     int y;                  /* y-pos */
     bool loaded;            /* load state */
+    bool clear;             /* is to be cleared */
     bool display;           /* is to be displayed */
     bool always_display;    /* not using the preload/display mechanism */
+    bool displayed;         /* is currently displayed */
 
     /* the index of the conditional the image is in */
     unsigned short cond_index;
@@ -280,6 +282,7 @@
     long subline_expire_time[WPS_MAX_LINES];
     short curr_subline[WPS_MAX_LINES];
     unsigned char num_sublines[WPS_MAX_LINES];
+    bool force_refresh[WPS_MAX_LINES];
 
     struct wps_token tokens[WPS_MAX_TOKENS];
     unsigned short num_tokens;
