From b67b382c49a6390ccd23bd51def3be35629a7e4f Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Mon, 28 Nov 2005 00:20:15 +0000 Subject: [PATCH] [project @ 2005-11-28 00:20:15 by adrianl] Fix IS_MENU check to prevent Illegal window handle error in menus. Removed debug svn path=/import/netsurf/; revision=1886 --- riscos/menus.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/riscos/menus.c b/riscos/menus.c index a1951099f..a873d9fab 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -128,9 +128,11 @@ static wimp_MENU(GLOBAL_HISTORY_RECENT_URLS) url_suggest; wimp_menu *url_suggest_menu = (wimp_menu *)&url_suggest; /* the values given in PRM 3-157 for how to check menus/windows are - * incorrect so we use a hack of checking if the sub-menu is within - * 256KB of its parent */ -#define IS_MENU(menu, submenu) (abs((int)(submenu) - (int)(menu)) < 0x40000) + * incorrect so we use a hack of checking if the sub-menu has bit 0 + * set which is undocumented but true of window handles on + * all target OS versions */ +#define IS_MENU(menu, submenu) !((int)(submenu) & 1) + /** * Create menu structures. @@ -708,11 +710,6 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning) { menu_entry = &menu_entry->sub_menu-> entries[warning->selection.items[i]]; - LOG(("menu (%s): %p submenu: %p", - menu_entry->data.indirected_text.text, - menu_entry, - menu_entry->sub_menu)); - if (IS_MENU(menu_entry, menu_entry->sub_menu)) { sub_menu = menu_entry->sub_menu; i = 0; @@ -2317,11 +2314,6 @@ bool ro_gui_menu_translate(struct menu_definition *menu) entry->menu_entry->data.indirected_text.size = strlen(translated); - LOG(("menu (%s): %p submenu: %p", - entry->menu_entry->data.indirected_text.text, - entry->menu_entry, - submenu)); - /* child menu title - this is the same as the text of * the parent menu entry, so just copy the pointer */ if (submenu != wimp_NO_SUB_MENU &&