Guest User

Untitled

a guest
Jul 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. diff --git a/apps/filetree.c b/apps/filetree.c
  2. index 945b9ac..6b56c80 100644
  3. --- a/apps/filetree.c
  4. +++ b/apps/filetree.c
  5. @@ -528,13 +528,9 @@ int ft_enter(struct tree_context* c)
  6. splash(0, ID2P(LANG_WAIT));
  7. if (!settings_load_config(buf,true))
  8. break;
  9. - /* do both steps seperately so that the redrawing after theme
  10. - * changing is independant of whether the theme has a custom ui
  11. - * vp or not */
  12. - send_event(GUI_EVENT_REFRESH, NULL);
  13. - /* for the statusbar */
  14. - send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
  15. - tree_drawlists();
  16. +
  17. + /* redraw the UI in case the user setting changed apparence */
  18. + send_event(GUI_EVENT_REFRESH, tree_drawlists);
  19. splash(HZ, ID2P(LANG_SETTINGS_LOADED));
  20. break;
  21.  
  22. diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
  23. index 460101a..4f33910 100644
  24. --- a/apps/gui/skin_engine/skin_display.c
  25. +++ b/apps/gui/skin_engine/skin_display.c
  26. @@ -58,26 +58,6 @@
  27.  
  28. static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode);
  29.  
  30. -
  31. -/* TODO: maybe move this whole function into wps.c instead ? */
  32. -bool gui_wps_display(struct gui_wps *gwps)
  33. -{
  34. - struct screen *display = gwps->display;
  35. -
  36. - /* Update the values in the first (default) viewport - in case the user
  37. - has modified the statusbar or colour settings */
  38. -#if LCD_DEPTH > 1
  39. - if (display->depth > 1)
  40. - {
  41. - struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, gwps->data)->vp;
  42. - vp->fg_pattern = display->get_foreground();
  43. - vp->bg_pattern = display->get_background();
  44. - }
  45. -#endif
  46. - display->backdrop_show(BACKDROP_SKIN_WPS);
  47. - return skin_redraw(gwps, WPS_REFRESH_ALL);
  48. -}
  49. -
  50. /* update a skinned screen, update_type is WPS_REFRESH_* values.
  51. * Usually it should only be WPS_REFRESH_NON_STATIC
  52. * A full update will be done if required (state.do_full_update == true)
  53. diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
  54. index 0a2630c..9a7cfbd 100644
  55. --- a/apps/gui/viewport.c
  56. +++ b/apps/gui/viewport.c
  57. @@ -70,6 +70,7 @@ static struct viewport custom_vp[NB_SCREENS];
  58.  
  59. /* callbacks for GUI_EVENT_* events */
  60. static void viewportmanager_ui_vp_changed(void *param);
  61. +static void viewportmanager_call_draw_func(void *param);
  62. static void statusbar_toggled(void* param);
  63. static unsigned viewport_init_ui_vp(void);
  64. #endif
  65. @@ -215,29 +216,47 @@ void viewportmanager_theme_changed(const int which)
  66. event_add |= (statusbar_position(i) == STATUSBAR_CUSTOM);
  67. }
  68.  
  69. + /* add one of those to ensure the draw function is called always */
  70. if (event_add)
  71. + {
  72. add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed);
  73. + remove_event(GUI_EVENT_REFRESH, viewportmanager_call_draw_func);
  74. + }
  75. else
  76. + {
  77. + add_event(GUI_EVENT_REFRESH, false, viewportmanager_call_draw_func);
  78. remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed);
  79. + }
  80.  
  81. send_event(GUI_EVENT_THEME_CHANGED, NULL);
  82. }
  83.  
  84. +/*
  85. + * simply calls a function that draws stuff, this exists to ensure the
  86. + * drawing function call in the GUI_EVENT_REFRESH event
  87. + *
  88. + * param should be 'void func(void)' */
  89. +static void viewportmanager_call_draw_func(void *param)
  90. +{
  91. + /* cast param to a function */
  92. + void (*draw_func)(void) = ((void(*)(void))param);
  93. + /* call the passed function which will redraw the content of
  94. + * the current screen */
  95. + if (draw_func != NULL)
  96. + draw_func();
  97. +}
  98. +
  99. static void viewportmanager_ui_vp_changed(void *param)
  100. {
  101. /* if the user changed the theme, we need to initiate a full redraw */
  102. int i;
  103. - /* cast param to a function */
  104. - void (*draw_func)(void) = ((void(*)(void))param);
  105. /* start with clearing the screen */
  106. FOR_NB_SCREENS(i)
  107. screens[i].clear_display();
  108. /* redraw the statusbar if it was enabled */
  109. send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
  110. - /* call the passed function which will redraw the content of
  111. - * the current screen */
  112. - if (draw_func != NULL)
  113. - draw_func();
  114. + /* call redraw function */
  115. + viewportmanager_call_draw_func(param);
  116. FOR_NB_SCREENS(i)
  117. screens[i].update();
  118. }
  119. diff --git a/apps/gui/wps.c b/apps/gui/wps.c
  120. index 9236f9f..85639f7 100644
  121. --- a/apps/gui/wps.c
  122. +++ b/apps/gui/wps.c
  123. @@ -582,6 +582,31 @@ static void gwps_leave_wps(void)
  124. send_event(GUI_EVENT_REFRESH, NULL);
  125. }
  126.  
  127. +/*
  128. + * display the wps on entering or restoring */
  129. +static void gwps_enter_wps(void)
  130. +{
  131. + int i;
  132. + FOR_NB_SCREENS(i)
  133. + {
  134. + struct gui_wps *gwps = &gui_wps[i];
  135. + struct screen *display = gwps->display;
  136. +
  137. + display->stop_scroll();
  138. + /* Update the values in the first (default) viewport - in case the user
  139. + has modified the statusbar or colour settings */
  140. +#if LCD_DEPTH > 1
  141. + if (display->depth > 1)
  142. + {
  143. + struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, gwps->data)->vp;
  144. + vp->fg_pattern = display->get_foreground();
  145. + vp->bg_pattern = display->get_background();
  146. + }
  147. +#endif
  148. + skin_update(gwps, WPS_REFRESH_ALL);
  149. + }
  150. +}
  151. +
  152. #ifdef HAVE_TOUCHSCREEN
  153. int wps_get_touchaction(struct wps_data *data)
  154. {
  155. @@ -696,6 +721,7 @@ long gui_wps_show(void)
  156. bool vol_changed = false;
  157. int i;
  158. long last_left = 0, last_right = 0;
  159. + long curr_tick = current_tick;
  160.  
  161. #ifdef HAVE_LCD_CHARCELLS
  162. status_set_audio(true);
  163. @@ -1136,7 +1162,27 @@ long gui_wps_show(void)
  164. }
  165. }
  166.  
  167. - if (wps_sync_data.do_full_update || update)
  168. +
  169. + if (restore && wps_state.id3 &&
  170. + ((restoretimer == RESTORE_WPS_INSTANTLY) ||
  171. + TIME_AFTER(current_tick, restoretimer)))
  172. + {
  173. + restore = false;
  174. + restoretimer = RESTORE_WPS_INSTANTLY;
  175. +#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
  176. + add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook);
  177. +#endif
  178. + /* we remove the update delay since it's not very usable in the wps,
  179. + * e.g. during volume changing or ffwd/rewind */
  180. + sb_skin_set_update_delay(0);
  181. + FOR_NB_SCREENS(i)
  182. + gui_wps[i].display->backdrop_show(BACKDROP_SKIN_WPS);
  183. + send_event(GUI_EVENT_REFRESH, gwps_enter_wps);
  184. + long difftime = current_tick - curr_tick;
  185. + splashf(HZ, "done, needed %ld:%ld", difftime/HZ, difftime%HZ);
  186. + wps_sync_data.do_full_update = update = false;
  187. + }
  188. + else if (wps_sync_data.do_full_update || update)
  189. {
  190. #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
  191. gwps_caption_backlight(&wps_state);
  192. @@ -1156,25 +1202,6 @@ long gui_wps_show(void)
  193. update = false;
  194. }
  195.  
  196. - if (restore && wps_state.id3 &&
  197. - ((restoretimer == RESTORE_WPS_INSTANTLY) ||
  198. - TIME_AFTER(current_tick, restoretimer)))
  199. - {
  200. - restore = false;
  201. - restoretimer = RESTORE_WPS_INSTANTLY;
  202. -#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
  203. - add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook);
  204. -#endif
  205. - /* we remove the update delay since it's not very usable in the wps,
  206. - * e.g. during volume changing or ffwd/rewind */
  207. - sb_skin_set_update_delay(0);
  208. - FOR_NB_SCREENS(i)
  209. - {
  210. - screens[i].stop_scroll();
  211. - gui_wps_display(&gui_wps[i]);
  212. - }
  213. - }
  214. -
  215. if (exit) {
  216. #ifdef HAVE_LCD_CHARCELLS
  217. status_set_record(false);
Add Comment
Please, Sign In to add comment