From 3a6244a9d09062a0a55ea258c72c6bea9759d52f Mon Sep 17 00:00:00 2001 From: boercher Date: Wed, 1 Jun 2005 22:45:43 +0000 Subject: [PATCH] bugfix: ignore hidden menus also when a menuitem is selected from a menu via key Enter --- server/menu.c | 9 ++++++++- server/menu.h | 11 +++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/server/menu.c b/server/menu.c index bc43e1d..f1c4e58 100644 --- a/server/menu.c +++ b/server/menu.c @@ -64,7 +64,6 @@ menu_get_subitem(Menu * menu, int index) return NULL; } - static int menu_visible_item_count(Menu * menu) { @@ -178,6 +177,13 @@ menu_destroy_all_items (Menu *menu) } } +MenuItem *menu_get_current_item (Menu *menu) +{ + return (MenuItem*) ((menu != NULL) + ? menu_get_subitem(menu, menu->data.menu.selector_pos) + : NULL); +} + MenuItem *menu_find_item (Menu *menu, char *id, bool recursive) { MenuItem * item; @@ -420,6 +426,7 @@ void menu_update_screen (MenuItem *menu, Screen *s) else { /* Limit string length and add ringstring */ p = LL_GetByIndex (subitem->data.ring.strings, subitem->data.ring.value); + assert(p != NULL); if (strlen(p) > display_props->width - 3) { short a = display_props->width - 3; /* We need to limit the ring string and DON'T diff --git a/server/menu.h b/server/menu.h index 8d54037..556fc21 100644 --- a/server/menu.h +++ b/server/menu.h @@ -78,14 +78,9 @@ static inline MenuItem *menu_getnext_item (Menu *menu) : NULL); } -/** Retrieves the current item from the list of items in the menu. */ -static inline MenuItem *menu_get_current_item (Menu *menu) -{ - return (MenuItem*) ((menu != NULL) - ? LL_GetByIndex(menu->data.menu.contents, - menu->data.menu.selector_pos) - : NULL); -} +/** Retrieves the current (non-hidden) item from the list of items in the + * menu. */ +MenuItem *menu_get_current_item (Menu *menu); /** Finds an item in the menu by the given id. */ MenuItem *menu_find_item (Menu *menu, char *id, bool recursive);