summaryrefslogtreecommitdiff
path: root/apps/gui/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r--apps/gui/list.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 85046ead54..c119c4f193 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -51,6 +51,7 @@ void list_draw(struct screen *display, struct gui_synclist *list);
51 51
52static long last_dirty_tick; 52static long last_dirty_tick;
53static struct viewport parent[NB_SCREENS]; 53static struct viewport parent[NB_SCREENS];
54static struct gui_synclist *current_lists;
54 55
55static bool list_is_dirty(struct gui_synclist *list) 56static bool list_is_dirty(struct gui_synclist *list)
56{ 57{
@@ -160,7 +161,6 @@ void gui_synclist_init(struct gui_synclist * gui_list,
160 gui_list->nb_items = 0; 161 gui_list->nb_items = 0;
161 gui_list->selected_item = 0; 162 gui_list->selected_item = 0;
162 gui_synclist_init_display_settings(gui_list); 163 gui_synclist_init_display_settings(gui_list);
163
164#ifdef HAVE_TOUCHSCREEN 164#ifdef HAVE_TOUCHSCREEN
165 gui_list->y_pos = 0; 165 gui_list->y_pos = 0;
166#endif 166#endif
@@ -586,16 +586,19 @@ bool gui_synclist_keyclick_callback(int action, void* data)
586 * loop. 586 * loop.
587 * 587 *
588 * The GUI_EVENT_NEED_UI_UPDATE event is registered for in list_do_action_timeout() 588 * The GUI_EVENT_NEED_UI_UPDATE event is registered for in list_do_action_timeout()
589 * and unregistered in gui_synclict_do_button(). This is done because 589 * as a oneshot and current_lists updated. later current_lists is set to NULL
590 * if something is using the list UI they *must* be calling those 590 * in gui_synclist_do_button() effectively disabling the callback.
591* This is done because if something is using the list UI they *must* be calling those
591 * two functions in the correct order or the list wont work. 592 * two functions in the correct order or the list wont work.
592 */ 593 */
593static struct gui_synclist *current_lists; 594
594static bool ui_update_event_registered = false; 595static void _lists_uiviewport_update_callback(unsigned short id,
595static void _lists_uiviewport_update_callback(unsigned short id, void *data) 596 void *data, void *userdata)
596{ 597{
597 (void)id; 598 (void)id;
598 (void)data; 599 (void)data;
600 (void)userdata;
601
599 if (current_lists) 602 if (current_lists)
600 gui_synclist_draw(current_lists); 603 gui_synclist_draw(current_lists);
601} 604}
@@ -697,6 +700,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, int *actionptr)
697 case ACTION_TREE_PGRIGHT: 700 case ACTION_TREE_PGRIGHT:
698 gui_synclist_scroll_right(lists); 701 gui_synclist_scroll_right(lists);
699 gui_synclist_draw(lists); 702 gui_synclist_draw(lists);
703 yield();
700 return true; 704 return true;
701 case ACTION_TREE_ROOT_INIT: 705 case ACTION_TREE_ROOT_INIT:
702 /* After this button press ACTION_TREE_PGLEFT is allowed 706 /* After this button press ACTION_TREE_PGLEFT is allowed
@@ -724,6 +728,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, int *actionptr)
724 gui_synclist_draw(lists); 728 gui_synclist_draw(lists);
725 pgleft_allow_cancel = false; /* stop ACTION_TREE_PAGE_LEFT 729 pgleft_allow_cancel = false; /* stop ACTION_TREE_PAGE_LEFT
726 skipping to root */ 730 skipping to root */
731 yield();
727 return true; 732 return true;
728/* for pgup / pgdown, we are obliged to have a different behaviour depending 733/* for pgup / pgdown, we are obliged to have a different behaviour depending
729 * on the screen for which the user pressed the key since for example, remote 734 * on the screen for which the user pressed the key since for example, remote
@@ -769,13 +774,8 @@ int list_do_action_timeout(struct gui_synclist *lists, int timeout)
769/* Returns the lowest of timeout or the delay until a postponed 774/* Returns the lowest of timeout or the delay until a postponed
770 scheduled announcement is due (if any). */ 775 scheduled announcement is due (if any). */
771{ 776{
772 if (lists != current_lists) 777 add_event_ex(GUI_EVENT_NEED_UI_UPDATE, true, _lists_uiviewport_update_callback, NULL);
773 { 778 current_lists = lists;
774 if (!ui_update_event_registered)
775 ui_update_event_registered =
776 add_event(GUI_EVENT_NEED_UI_UPDATE, _lists_uiviewport_update_callback);
777 current_lists = lists;
778 }
779 if(lists->scheduled_talk_tick) 779 if(lists->scheduled_talk_tick)
780 { 780 {
781 long delay = lists->scheduled_talk_tick -current_tick +1; 781 long delay = lists->scheduled_talk_tick -current_tick +1;
@@ -944,7 +944,9 @@ bool simplelist_show_list(struct simplelist_info *info)
944 old_line_count = simplelist_line_count; 944 old_line_count = simplelist_line_count;
945 } 945 }
946 else if(default_event_handler(action) == SYS_USB_CONNECTED) 946 else if(default_event_handler(action) == SYS_USB_CONNECTED)
947 {
947 return true; 948 return true;
949 }
948 } 950 }
949 talk_shutup(); 951 talk_shutup();
950 952