diff --git a/src/menu/components.h b/src/menu/components.h index 6ebf2463..858b9763 100644 --- a/src/menu/components.h +++ b/src/menu/components.h @@ -40,6 +40,7 @@ void component_file_list_draw (entry_t *list, int entries, int selected); typedef struct { int count; int selected; + bool hide_pending; struct { const char *text; void (*action) (menu_t *menu); diff --git a/src/menu/components/context_menu.c b/src/menu/components/context_menu.c index 00229f85..205e1386 100644 --- a/src/menu/components/context_menu.c +++ b/src/menu/components/context_menu.c @@ -6,6 +6,7 @@ void component_context_menu_init (component_context_menu_t *cm) { cm->selected = -1; cm->count = 0; + cm->hide_pending = false; for (int i = 0; (cm->list[i].text) != NULL; i++) { cm->count += 1; } @@ -21,11 +22,11 @@ bool component_context_menu_process (menu_t *menu, component_context_menu_t *cm) } if (menu->actions.back) { - cm->selected = -1; + cm->hide_pending = true; } else if (menu->actions.enter) { if (cm->list[cm->selected].action) { cm->list[cm->selected].action(menu); - cm->selected = -1; + cm->hide_pending = true; } } else if (menu->actions.go_up) { cm->selected -= 1; @@ -89,4 +90,9 @@ void component_context_menu_draw (component_context_menu_t *cm) { rdpq_paragraph_render(layout, VISIBLE_AREA_X0, VISIBLE_AREA_Y0); rdpq_paragraph_free(layout); + + if (cm->hide_pending) { + cm->hide_pending = false; + cm->selected = -1; + } }