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
This commit is contained in:
parent
e74cc6d9da
commit
8b9fdb540c
11 changed files with 28 additions and 38 deletions
|
@ -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 @@ static inline int get_next_context(const struct button_mapping *items, int i)
|
|||
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 @@ static int get_action_worker(int context, int timeout,
|
|||
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);
|
||||
|
|
|
@ -49,7 +49,7 @@ enum {
|
|||
enum {
|
||||
GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1),
|
||||
GUI_EVENT_STATUSBAR_TOGGLE,
|
||||
GUI_EVENT_FOURHERTZ,
|
||||
GUI_EVENT_ACTIONUPDATE,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -272,6 +272,7 @@ static bool dbg_audio_thread(void)
|
|||
lcd_update();
|
||||
}
|
||||
viewportmanager_set_statusbar(true);
|
||||
lcd_setfont(FONT_UI);
|
||||
return false;
|
||||
}
|
||||
#endif /* !SIMULATOR */
|
||||
|
@ -399,6 +400,7 @@ static bool dbg_buffering_thread(void)
|
|||
|
||||
tick_remove_task(dbg_audio_task);
|
||||
viewportmanager_set_statusbar(true);
|
||||
lcd_setfont(FONT_UI);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -693,6 +695,7 @@ static bool dbg_hw_info(void)
|
|||
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 @@ static bool dbg_spdif(void)
|
|||
#endif
|
||||
|
||||
viewportmanager_set_statusbar(true);
|
||||
lcd_setfont(FONT_UI);
|
||||
return false;
|
||||
}
|
||||
#endif /* CPU_COLDFIRE */
|
||||
|
@ -1072,6 +1076,7 @@ bool dbg_ports(void)
|
|||
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 @@ bool dbg_ports(void)
|
|||
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 @@ extern unsigned char serbuf[];
|
|||
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 @@ extern unsigned char serbuf[];
|
|||
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 @@ bool dbg_ports(void)
|
|||
}
|
||||
}
|
||||
viewportmanager_set_statusbar(true);
|
||||
lcd_setfont(FONT_UI);
|
||||
return false;
|
||||
}
|
||||
#endif /* !HAVE_LCD_BITMAP */
|
||||
|
@ -1449,11 +1459,13 @@ static bool dbg_pcf(void)
|
|||
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 @@ static bool dbg_cpufreq(void)
|
|||
|
||||
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 @@ static bool view_battery(void)
|
|||
|
||||
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 @@ static bool cpu_boost_log(void)
|
|||
}
|
||||
}
|
||||
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 @@ static bool dbg_scrollwheel(void)
|
|||
lcd_update();
|
||||
}
|
||||
viewportmanager_set_statusbar(true);
|
||||
lcd_setfont(FONT_UI);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -211,8 +211,6 @@ long gui_wps_show(void)
|
|||
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. */
|
||||
|
||||
|
|
|
@ -643,9 +643,6 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
|
|||
|
||||
switch (action)
|
||||
{
|
||||
case SYS_FOURHERTZ:
|
||||
default_event_handler(action);
|
||||
return true;
|
||||
case ACTION_REDRAW:
|
||||
gui_synclist_draw(lists);
|
||||
return true;
|
||||
|
|
|
@ -92,12 +92,12 @@ bool viewportmanager_set_statusbar(bool enabled)
|
|||
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;
|
||||
|
|
|
@ -167,9 +167,6 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
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);
|
||||
|
|
11
apps/main.c
11
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 @@ static void app_main(void)
|
|||
#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);
|
||||
|
|
|
@ -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 @@ bool eq_menu_graphical(void)
|
|||
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 @@ bool eq_menu_graphical(void)
|
|||
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 @@ bool eq_menu_graphical(void)
|
|||
screens[i].clear_display();
|
||||
screens[i].set_viewport(NULL);
|
||||
}
|
||||
|
||||
viewportmanager_set_statusbar(barsenabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -906,9 +906,6 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
|||
{
|
||||
switch(event)
|
||||
{
|
||||
case SYS_FOURHERTZ:
|
||||
send_event(GUI_EVENT_FOURHERTZ, NULL);
|
||||
break;
|
||||
case SYS_BATTERY_UPDATE:
|
||||
if(global_settings.talk_battery_level)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue