redo how the statusbar updates are done. send the EVENT_GUI_ACTIONUPDATE event every time get_action() is called. The event wont be as realiable (timewise) as before, but seems to work better
This also fixes FS#9761.
Also set the lcd font back to the ui font from the debug screens which use sysfont


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19681 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/action.c b/apps/action.c
index c2a6e47..d98bf13 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "lang.h"
 
+#include "appevents.h"
 #include "button.h"
 #include "action.h"
 #include "kernel.h"
@@ -104,10 +105,6 @@
    Timeout can be TIMEOUT_NOBLOCK to return immediatly
                   TIMEOUT_BLOCK   to wait for a button press
    Any number >0   to wait that many ticks for a press
-
-   This function will likely return SYS_FOURHERTZ which should be passed to the
-   default_event_handler(). If this doesnt happen parts of the GUI may not be
-   redrawn correctly
  */
 static int get_action_worker(int context, int timeout,
                              const struct button_mapping* (*get_context_map)(int) )
@@ -117,6 +114,9 @@
     int i=0;
     int ret = ACTION_UNKNOWN;
     static int last_context = CONTEXT_STD;
+    
+    
+    send_event(GUI_EVENT_ACTIONUPDATE, NULL);
 
     if (timeout == TIMEOUT_NOBLOCK)
         button = button_get(false);
diff --git a/apps/appevents.h b/apps/appevents.h
index 48d578d..8cbc301 100644
--- a/apps/appevents.h
+++ b/apps/appevents.h
@@ -49,7 +49,7 @@
 enum {
     GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1),
     GUI_EVENT_STATUSBAR_TOGGLE,
-    GUI_EVENT_FOURHERTZ,
+    GUI_EVENT_ACTIONUPDATE,
 };
 
 #endif
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 92eb245..6f7887a 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -272,6 +272,7 @@
         lcd_update();
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif /* !SIMULATOR */
@@ -399,6 +400,7 @@
 
     tick_remove_task(dbg_audio_task);
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
 
     return false;
 }
@@ -693,6 +695,7 @@
     return __dbg_hw_info();
 #endif /* CONFIG_CPU */
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #else /* !HAVE_LCD_BITMAP */
@@ -988,6 +991,7 @@
 #endif
 
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif /* CPU_COLDFIRE */
@@ -1072,6 +1076,7 @@
         if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
         {
             viewportmanager_set_statusbar(true);
+            lcd_setfont(FONT_UI);
             return false;
         }
     }
@@ -1159,6 +1164,7 @@
         if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
         {
             viewportmanager_set_statusbar(true);
+            lcd_setfont(FONT_UI);
             return false;
         }
     }
@@ -1270,6 +1276,7 @@
         if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
         {
             viewportmanager_set_statusbar(true);
+            lcd_setfont(FONT_UI);
             return false;
         }
     }
@@ -1313,10 +1320,12 @@
         if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
         {
             viewportmanager_set_statusbar(true);
+            lcd_setfont(FONT_UI);
             return false;
         }
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
 #else
     return __dbg_ports();
 #endif /* CPU */
@@ -1397,6 +1406,7 @@
         }
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif /* !HAVE_LCD_BITMAP */
@@ -1449,11 +1459,13 @@
         if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
         {
             viewportmanager_set_statusbar(true);
+            lcd_setfont(FONT_UI);
             return false;
         }
     }
 
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif
@@ -1502,10 +1514,12 @@
 
             case ACTION_STD_CANCEL:
                 viewportmanager_set_statusbar(true);
+                lcd_setfont(FONT_UI);
                 return false;
         }
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif /* HAVE_ADJUSTABLE_CPU_FREQ */
@@ -1840,10 +1854,12 @@
 
             case ACTION_STD_CANCEL:
                 viewportmanager_set_statusbar(true);
+                lcd_setfont(FONT_UI);
                 return false;
         }
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 
@@ -2505,8 +2521,8 @@
         }
     }
     get_action(CONTEXT_STD,TIMEOUT_BLOCK);
-    lcd_setfont(FONT_UI);
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif
@@ -2556,6 +2572,7 @@
         lcd_update();
     }
     viewportmanager_set_statusbar(true);
+    lcd_setfont(FONT_UI);
     return false;
 }
 #endif
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 1f90077..c1e7606 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -211,8 +211,6 @@
                 if (button != ACTION_NONE) {
                     break;
                 }
-                else if (button == SYS_FOURHERTZ)
-                    default_event_handler(button);
                 peak_meter_peek();
                 sleep(0);   /* Sleep until end of current tick. */
 
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 662496d..04bd7e4 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -643,9 +643,6 @@
 
     switch (action)
     {
-        case SYS_FOURHERTZ:
-            default_event_handler(action);
-            return true;
         case ACTION_REDRAW:
             gui_synclist_draw(lists);
             return true;
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 9a0657d..76fb36b 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -92,12 +92,12 @@
     bool old = statusbar_enabled;
     if (enabled && global_settings.statusbar)
     {
-        add_event(GUI_EVENT_FOURHERTZ, false, viewportmanager_draw_statusbars);
+        add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars);
         gui_syncstatusbar_draw(&statusbars, true);
     }
     else
     {
-        remove_event(GUI_EVENT_FOURHERTZ, viewportmanager_draw_statusbars);
+        remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_draw_statusbars);
     }
     statusbar_enabled = enabled;
     return old;
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index 1e597f2..756d267 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -167,9 +167,6 @@
             case SYS_CHARGER_DISCONNECTED:
                 /* ignore some SYS events that can happen */
                 continue;
-            case SYS_FOURHERTZ: /* make sure this one works as expected */
-                default_event_handler(button);
-                break;
             default:
                 if(default_event_handler(button) == SYS_USB_CONNECTED)
                     return(YESNO_USB);
diff --git a/apps/main.c b/apps/main.c
index d473e66..4e66a85 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -120,16 +120,6 @@
 const char appsversion[]=APPSVERSION;
 
 static void init(void);
-
-static void fourhertz_tick_task(void)
-{
-    static long last_fire = 0;
-    if (TIME_AFTER(current_tick, last_fire+HZ/4))
-    {
-        queue_post(&button_queue, SYS_FOURHERTZ, 0);
-        last_fire = current_tick;
-    }
-}
         
 #ifdef SIMULATOR
 void app_main(void)
@@ -148,7 +138,6 @@
 #ifdef HAVE_TOUCHSCREEN
     touchscreen_set_mode(TOUCHSCREEN_BUTTON);
 #endif
-    tick_add_task(fourhertz_tick_task);
     viewportmanager_set_statusbar(true);
     add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, 
               viewportmanager_statusbar_changed);
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 77b6e6f..28df083 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -49,6 +49,7 @@
 #include "gui/scrollbar.h"
 #include "eq_menu.h"
 #include "menu_common.h"
+#include "viewport.h"
 
 /*
  * Utility functions
@@ -391,6 +392,7 @@
     enum eq_type current_type;
     char buf[24];
     int i, w, h, height, start_item, nb_eq_sliders[NB_SCREENS];
+    bool barsenabled = viewportmanager_set_statusbar(false);
 
 
     FOR_NB_SCREENS(i) {
@@ -553,12 +555,6 @@
             exit_request = true;
             result = false;
             break;
-        case SYS_FOURHERTZ:
-            /* eat this for the time being. this whole screen needs to be converted
-             * to viewports, so when that happens this message can be handled 
-             * properly.
-             */
-            break;
         default:
             if(default_event_handler(button) == SYS_USB_CONNECTED) {
                 exit_request = true;
@@ -580,7 +576,7 @@
         screens[i].clear_display();
         screens[i].set_viewport(NULL);
     }
-
+    viewportmanager_set_statusbar(barsenabled);
     return result;
 }
 
diff --git a/apps/misc.c b/apps/misc.c
index 894b0c2..1410d47 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -906,9 +906,6 @@
 {
     switch(event)
     {
-        case SYS_FOURHERTZ:
-            send_event(GUI_EVENT_FOURHERTZ, NULL);
-            break;
         case SYS_BATTERY_UPDATE:
             if(global_settings.talk_battery_level)
             {
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index 5cebb29..29cf8f2 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -80,7 +80,6 @@
 #define SYS_CAR_ADAPTER_RESUME    MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1)
 #define SYS_IAP_PERIODIC	  MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2)
 #define SYS_IAP_HANDLEPKT	  MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3)
-#define SYS_FOURHERTZ             MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 4)
 
 #define IS_SYSEVENT(ev)           ((ev & SYS_EVENT) == SYS_EVENT)