summaryrefslogtreecommitdiff
path: root/amiga/menu.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-09-06 09:12:26 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-09-06 09:12:26 +0100
commitd1ccd3e53d45071b9c715aaacf9d60e261701957 (patch)
tree4a7beecf01f48e3bc440bd1b50373559daf0e5b6 /amiga/menu.c
parent1e83301251beed8fd0450a2a0d71d8a9451ccc46 (diff)
parentde75959362f83adee9f7b879fe5e76701575af7c (diff)
downloadnetsurf-d1ccd3e53d45071b9c715aaacf9d60e261701957.tar.gz
netsurf-d1ccd3e53d45071b9c715aaacf9d60e261701957.tar.bz2
Create menu on OS3 and 3 the same way (old GadTools method)
This makes it easier to switch to menuclass. It also fixes a crash-on-exit bug on OS3.
Diffstat (limited to 'amiga/menu.c')
-rw-r--r--amiga/menu.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/amiga/menu.c b/amiga/menu.c
index c4e0a51d7..9d555abc1 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -704,29 +704,19 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
/* Menu refresh for hotlist */
void ami_menu_refresh(struct gui_window_2 *gwin)
{
+ struct Menu *menu;
+
SetAttrs(gwin->objects[OID_MAIN],
-#ifdef __amigaos4__
- WINDOW_NewMenu, NULL,
-#else
WINDOW_MenuStrip, NULL,
-#endif
TAG_DONE);
-#ifndef __amigaos4__
- ami_menu_free_os3(gwin->menu_os3);
-#endif
+ ami_menu_free(gwin);
ami_free_menulabs(gwin);
- ami_create_menu(gwin);
-#ifndef __amigaos4__
- gwin->menu_os3 = ami_menu_create_os3(gwin, gwin->menu);
-#endif
+
+ menu = ami_menu_create(gwin);
SetAttrs(gwin->objects[OID_MAIN],
-#ifdef __amigaos4__
- WINDOW_NewMenu, gwin->menu,
-#else
- WINDOW_MenuStrip, gwin->menu_os3,
-#endif
+ WINDOW_MenuStrip, menu,
TAG_DONE);
}
@@ -905,25 +895,13 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
return gwin;
}
-#ifndef __amigaos4__
-void ami_menu_free_os3(struct gui_window_2 *gwin)
+void ami_menu_free(struct gui_window_2 *gwin)
{
- FreeMenus(gwin->menu_os3);
+ FreeMenus(gwin->imenu);
FreeVisualInfo(gwin->vi);
}
-struct Menu *ami_menu_create_os3(struct gui_window_2 *gwin, struct NewMenu *newmenu)
-{
- gwin->vi = GetVisualInfo(scrn, TAG_DONE);
- gwin->menu_os3 = CreateMenus(newmenu, TAG_DONE);
- LayoutMenus(gwin->menu_os3, gwin->vi,
- GTMN_NewLookMenus, TRUE, TAG_DONE);
-
- return gwin->menu_os3;
-}
-#endif
-
-struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
+struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
ami_init_menulabs(gwin);
@@ -944,7 +922,14 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
if(nsoption_bool(background_images) == true)
gwin->menu[M_IMGBACK].nm_Flags |= CHECKED;
- return(gwin->menu);
+ gwin->vi = GetVisualInfo(scrn, TAG_DONE);
+ gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
+ LayoutMenus(gwin->imenu, gwin->vi,
+ GTMN_NewLookMenus, TRUE, TAG_DONE);
+
+ /**\todo do we even need to store/keep gwin->menu? **/
+
+ return gwin->imenu;
}
void ami_menu_arexx_scan(struct gui_window_2 *gwin)