From 654b25ffa1bab41d346f3c55b9257750cd515b78 Mon Sep 17 00:00:00 2001 From: Steve Fryatt Date: Tue, 28 Jan 2014 23:58:42 +0000 Subject: Improve handling of Message_MenusDeleted so that we don't close whatever menu tree is open at the time. --- riscos/gui.c | 3 ++- riscos/menus.c | 23 +++++++++++++++++++++++ riscos/menus.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/riscos/gui.c b/riscos/gui.c index 69d5b2932..e862e9345 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1315,7 +1315,8 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message) break; case message_MENUS_DELETED: - ro_gui_menu_closed(); + ro_gui_menu_message_deleted((wimp_message_menus_deleted *) + &message->data); break; case message_CLAIM_ENTITY: diff --git a/riscos/menus.c b/riscos/menus.c index 29d514122..91232a160 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -118,6 +118,7 @@ wimp_menu *image_quality_menu, *proxy_type_menu, *languages_menu; /** * Create menu structures. */ + void ro_gui_menu_init(void) { /* image quality menu */ @@ -439,6 +440,28 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning) } } + +/** + * Handle Message_MenusDeleted, removing our current record of an open menu + * if it matches the deleted menu handle. + * + * \param *deleted The message block. + */ + +void ro_gui_menu_message_deleted(wimp_message_menus_deleted *deleted) +{ + if (deleted != NULL && deleted->menu == current_menu) { + ro_gui_wimp_event_menus_closed(current_menu_window, + current_menu_icon, current_menu); + + current_menu = NULL; + current_menu_window = NULL; + current_menu_icon = 0; + current_menu_open = false; + } +} + + /** * Update the current menu by sending it a Menu Prepare event through wimp_event * and then reopening it if the contents has changed. diff --git a/riscos/menus.h b/riscos/menus.h index 033b01117..e2269b77c 100644 --- a/riscos/menus.h +++ b/riscos/menus.h @@ -173,6 +173,7 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i); void ro_gui_menu_window_changed(wimp_w from, wimp_w to); void ro_gui_menu_selection(wimp_selection* selection); void ro_gui_menu_warning(wimp_message_menu_warning *warning); +void ro_gui_menu_message_deleted(wimp_message_menus_deleted *deleted); void ro_gui_menu_refresh(wimp_menu *menu); void ro_gui_menu_init_structure(wimp_menu *menu, int entries); const char *ro_gui_menu_find_menu_entry_key(wimp_menu *menu, -- cgit v1.2.3 From 849bb5911c6add45c2d46f98bf501f843808571f Mon Sep 17 00:00:00 2001 From: Steve Fryatt Date: Tue, 28 Jan 2014 23:59:51 +0000 Subject: Don't poll when converting a menu to a dialogue, as the resulting Message_MenusDeleted no longer kills any newly-opened menus. --- riscos/wimp_event.c | 1 - 1 file changed, 1 deletion(-) diff --git a/riscos/wimp_event.c b/riscos/wimp_event.c index 1811498ea..a84c016ad 100644 --- a/riscos/wimp_event.c +++ b/riscos/wimp_event.c @@ -720,7 +720,6 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer) ro_gui_dialog_add_persistent(current_menu_window, pointer->w); ro_gui_menu_closed(); - gui_poll(true); error = xwimp_open_window(PTR_WIMP_OPEN(&open)); if (error) { LOG(("xwimp_open_window: 0x%x: %s", -- cgit v1.2.3