Don't schedule our own redraw after a reformat, as this is performed anyway.

Attempt to get menus working on OS3 build.
This commit is contained in:
Chris Young 2015-01-29 19:18:49 +00:00
parent 509053cae7
commit 0e3cbbb67b
5 changed files with 64 additions and 17 deletions

View File

@ -1527,7 +1527,7 @@ static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD,
gwin->win, gwin->objects[GID_HSCROLL], attrs);
#else
#warning FIXME for OS3 - logically we should just permanently enable
SetAttrs(gwin->objects[GID_HSCROLLLAYOUT], LAYOUT_AddChild, gwin->objects[GID_HSCROLL]);
#endif
return true;
}
@ -1535,14 +1535,17 @@ static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
/* Remove the horizontal scroller, if present */
static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
{
#ifdef __amigaos4__
if(gwin->objects[GID_HSCROLL] == NULL) return false;
#ifdef __amigaos4__
IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_HSCROLL]);
#else
SetAttrs(gwin->objects[GID_HSCROLLLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_HSCROLL]);
#endif
gwin->objects[GID_HSCROLL] = NULL;
#endif
return true;
}
@ -1568,7 +1571,7 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD,
gwin->win, gwin->objects[GID_VSCROLL], attrs);
#else
#warning FIXME for OS3
SetAttrs(gwin->objects[GID_VSCROLLLAYOUT], LAYOUT_AddChild, gwin->objects[GID_VSCROLL]);
#endif
return true;
}
@ -1576,14 +1579,17 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
/* Remove the vertical scroller, if present */
static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
{
#ifdef __amigaos4__
if(gwin->objects[GID_VSCROLL] == NULL) return false;
#ifdef __amigaos4__
IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD,
gwin->win, gwin->objects[GID_VSCROLL]);
#else
SetAttrs(gwin->objects[GID_VSCROLLLAYOUT], LAYOUT_RemoveChild, gwin->objects[GID_VSCROLL]);
#endif
gwin->objects[GID_VSCROLL] = NULL;
#endif
return true;
}
@ -1632,7 +1638,6 @@ static void ami_gui_scroller_update(struct gui_window_2 *gwin)
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
browser_window_schedule_reformat(gwin->gw->bw);
ami_schedule_redraw(gwin, true);
}
}
@ -2431,7 +2436,6 @@ static void ami_handle_msg(void)
ami_throbber_redraw_schedule(0, gwin->gw);
ami_schedule(0, ami_gui_refresh_favicon, gwin);
browser_window_schedule_reformat(gwin->gw->bw);
ami_schedule_redraw(gwin, true);
break;
}
break;
@ -3584,7 +3588,9 @@ gui_window_create(struct browser_window *bw,
(strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0))
iconifygadget = TRUE;
ami_create_menu(g->shared);
#ifndef __amigaos4__
struct Menu *menu = ami_menu_create_os3(g->shared->menu);
#endif
NewList(&g->shared->tab_list);
g->tab_node = AllocClickTabNode(TNA_Text,messages_get("NetSurf"),
TNA_Number, 0,
@ -3707,10 +3713,6 @@ gui_window_create(struct browser_window *bw,
LOG(("Creating window object"));
g->shared->objects[OID_MAIN] = WindowObj,
#ifndef __amigaos4__
WA_Width, 100,
WA_Height, 100,
#endif
WA_ScreenTitle, ami_gui_get_screen_title(),
WA_Activate, TRUE,
WA_DepthGadget, TRUE,
@ -3732,7 +3734,11 @@ gui_window_create(struct browser_window *bw,
IDCMP_REFRESHWINDOW |
IDCMP_ACTIVEWINDOW | IDCMP_EXTENDEDMOUSE,
WINDOW_IconifyGadget, iconifygadget,
#ifdef __amigaos4__
WINDOW_NewMenu, g->shared->menu,
#else
WINDOW_MenuStrip, menu,
#endif
WINDOW_MenuUserData, WGUD_HOOK,
WINDOW_NewPrefsHook, &newprefs_hook,
WINDOW_IDCMPHook, &g->shared->scrollerhook,
@ -4172,6 +4178,9 @@ static void gui_window_destroy(struct gui_window *g)
if(g->shared->search_bm) DisposeObject(g->shared->search_bm);
ami_free_menulabs(g->shared);
#ifndef __amigaos4__
ami_menu_free_os3(g->shared);
#endif
free(g->shared->wintitle);
ami_utf8_free(g->shared->status);
FreeVec(g->shared->svbuffer);

View File

@ -130,6 +130,10 @@ struct gui_window_2 {
struct AppWindow *appwin;
struct MinList shared_pens;
gui_pointer_shape mouse_pointer;
#ifndef __amigaos4__
struct NewMenu *menu;
struct VisualInfo *vi;
#endif
};
struct gui_window

View File

@ -325,14 +325,28 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
void ami_menu_refresh(struct gui_window_2 *gwin)
{
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_free_menulabs(gwin);
ami_create_menu(gwin);
#ifndef __amigaos4__
gwin->menu_os3 = ami_menu_create_os3(gwin->menu);
#endif
SetAttrs(gwin->objects[OID_MAIN],
#ifdef __amigaos4__
WINDOW_NewMenu, gwin->menu,
#else
WINDOW_MenuStrip, gwin->menu_os3,
#endif
TAG_DONE);
}
@ -527,6 +541,22 @@ 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)
{
FreeMenus(gwin->menu_os3);
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(menu, vi, TAG_DONE);
return gwin->menu_os3;
}
#endif
struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
{
gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
@ -621,7 +651,8 @@ static bool ami_menu_hotlist_add(void *userdata, int level, int item, const char
type = NM_SUB;
break;
default:
/* entries not at level 1 or 2 are not able to be added */
/* entries not at level 1 or 2 are not able to be added
* \todo apparently this is possible with 4.1FE, need SDK! */
return false;
break;
}

View File

@ -144,4 +144,10 @@ void ami_menu_refresh(struct gui_window_2 *gwin);
void ami_menu_update_checked(struct gui_window_2 *gwin);
void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c);
void ami_menu_free_glyphs(void);
#ifndef __amigaos4__
void ami_menu_free_os3(struct gui_window_2 *gwin);
struct Menu *ami_menu_create_os3(struct gui_window_2 *gwin, struct NewMenu *newmenu);
#endif
#endif

View File

@ -153,9 +153,6 @@
#define IDoMethodA DoMethodA
#define IDoSuperMethodA DoSuperMethodA
#define ShowWindow(...) (void)0
/* OnMenu/OffMenu need re-enabling when we get the menus attached */
#define OnMenu(...) (void)0
#define OffMenu(...) (void)0
/* Utility */
#define SetMem memset