bugfix: redraw yes/no screen after a full skin update
This fixes a bug reported on IRC: 1. Set 'bookmark on stop' to 'ask' 2. Play a track from the file browser 3. Stop playback, yes/no screen briefly flashes then disappears. The screen still handles input correctly but the prompt will not be displayed on the LCD. Long story short, get_action() can cause the skin engine to do a full redraw which cleared the screen and erased the prompt. There is a special event, GUI_EVENT_NEED_UI_UPDATE, which the list code uses to avoid precisely this problem. Hooking up a handler for this event and redrawing the yes/no prompt fixes the bug. Change-Id: If3c26655540c13b488b3a11bd46e1d60d4111469
This commit is contained in:
parent
6322e66219
commit
c11ed99cb4
|
@ -28,6 +28,7 @@
|
|||
#include "talk.h"
|
||||
#include "settings.h"
|
||||
#include "viewport.h"
|
||||
#include "appevents.h"
|
||||
|
||||
|
||||
struct gui_yesno
|
||||
|
@ -142,6 +143,16 @@ static bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result)
|
|||
return(true);
|
||||
}
|
||||
|
||||
static void gui_yesno_ui_update(unsigned short id, void *event_data, void *user_data)
|
||||
{
|
||||
(void)id;
|
||||
(void)event_data;
|
||||
|
||||
struct gui_yesno* yn = (struct gui_yesno*)user_data;
|
||||
FOR_NB_SCREENS(i)
|
||||
gui_yesno_draw(&yn[i]);
|
||||
}
|
||||
|
||||
enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
||||
const struct text_message * yes_message,
|
||||
const struct text_message * no_message)
|
||||
|
@ -166,7 +177,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
/* switch to point mode because that's more intuitive */
|
||||
enum touchscreen_mode tsm = touchscreen_get_mode();
|
||||
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
||||
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
||||
#endif
|
||||
|
||||
|
@ -174,6 +185,10 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
action_wait_for_release();
|
||||
button_clear_queue();
|
||||
|
||||
/* hook into UI update events to avoid the dialog disappearing
|
||||
* in case the skin decides to do a full refresh */
|
||||
add_event_ex(GUI_EVENT_NEED_UI_UPDATE, false, gui_yesno_ui_update, &yn[0]);
|
||||
|
||||
while (result==-1)
|
||||
{
|
||||
/* Repeat the question every 5secs (more or less) */
|
||||
|
@ -218,22 +233,14 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
continue;
|
||||
default:
|
||||
if(default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
/* restore old touchscreen mode */
|
||||
touchscreen_set_mode(tsm);
|
||||
#endif
|
||||
return YESNO_USB;
|
||||
result = YESNO_USB;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = YESNO_NO;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
/* restore old touchscreen mode */
|
||||
touchscreen_set_mode(tsm);
|
||||
#endif
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
result_displayed=gui_yesno_draw_result(&(yn[i]), result);
|
||||
|
||||
|
@ -252,7 +259,12 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
|||
viewportmanager_theme_undo(i, true);
|
||||
}
|
||||
|
||||
return(result);
|
||||
exit:
|
||||
remove_event_ex(GUI_EVENT_NEED_UI_UPDATE, gui_yesno_ui_update, &yn[0]);
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
touchscreen_set_mode(old_mode);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue