diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-01-17 17:06:48 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2015-01-17 17:06:48 +0000 |
commit | 0c4f942c2da23c0456272dfe051d6ea564780499 (patch) | |
tree | e2991aa046984cef9892df5f01fdb3388fc7fecb /amiga/gui.c | |
parent | bf14b2ddb1c535a97f1eded6b874e96f00f51d4f (diff) | |
download | netsurf-0c4f942c2da23c0456272dfe051d6ea564780499.tar.gz netsurf-0c4f942c2da23c0456272dfe051d6ea564780499.tar.bz2 |
Attempt to fix some OS3 build errors in gui.c
Diffstat (limited to 'amiga/gui.c')
-rw-r--r-- | amiga/gui.c | 94 |
1 files changed, 63 insertions, 31 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index b24ae1c88..9bea295a6 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -35,24 +35,26 @@ #include <proto/keymap.h> #include <proto/locale.h> #include <proto/Picasso96API.h> +#ifdef __amigaos4__ #include <proto/popupmenu.h> +#endif #include <proto/utility.h> #include <proto/wb.h> /* Other OS includes */ #include <datatypes/textclass.h> #include <devices/inputevent.h> +#include <graphics/rpattr.h> #ifdef __amigaos4__ #include <graphics/blitattr.h> +#include <intuition/gui.h> #include <libraries/application.h> #include <libraries/keymap.h> #endif -#include <libraries/gadtools.h> #include <intuition/icclass.h> -#include <graphics/rpattr.h> -#include <workbench/workbench.h> -#include <intuition/gui.h> #include <intuition/screens.h> +#include <libraries/gadtools.h> +#include <workbench/workbench.h> /* ReAction libraries */ #include <proto/bevel.h> @@ -427,11 +429,15 @@ static bool ami_open_resources(void) static UWORD ami_system_colour_scrollbar_fgpen(struct DrawInfo *drinfo) { LONG scrollerfillpen = FALSE; - +#ifdef __amigaos4__ GetGUIAttrs(NULL, drinfo, GUIA_PropKnobColor, &scrollerfillpen, TAG_DONE); if(scrollerfillpen) return FILLPEN; else return FOREGROUNDPEN; +#else + return FILLPEN; +#endif + } /** @@ -498,7 +504,7 @@ static void ami_set_screen_defaults(struct Screen *screen) nsoption_default_set_int(redraw_tile_size_x, screen->Width); nsoption_default_set_int(redraw_tile_size_y, screen->Height); - +#ifdef __amigaos4__ /* set system colours for amiga ui */ colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveBorder, screen, 0x00000000); colour_option_from_pen(FILLPEN, NSOPTION_sys_colour_ActiveCaption, screen, 0x00dddddd); @@ -528,6 +534,7 @@ static void ami_set_screen_defaults(struct Screen *screen) colour_option_from_pen(BACKGROUNDPEN, NSOPTION_sys_colour_Window, screen, 0x00aaaaaa); colour_option_from_pen(INACTIVEFILLPEN, NSOPTION_sys_colour_WindowFrame, screen, 0x00000000); colour_option_from_pen(TEXTPEN, NSOPTION_sys_colour_WindowText, screen, 0x00000000); +#endif } @@ -971,7 +978,7 @@ static void gui_init2(int argc, char** argv) ami_quit=true; return; } - +#ifdef __amigaos4__ if(IApplication) { if(argc == 0) @@ -1008,7 +1015,7 @@ static void gui_init2(int argc, char** argv) GetApplicationAttrs(ami_appid, APPATTR_Port, (ULONG)&applibport, TAG_DONE); if(applibport) applibsig = (1L << applibport->mp_SigBit); } - +#endif if(!bw && (nsoption_bool(startup_no_window) == false)) { error = nsurl_create(nsoption_charp(homepage_url), &url); if (error == NSERROR_OK) { @@ -1233,9 +1240,11 @@ int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie) static void ami_update_quals(struct gui_window_2 *gwin) { uint32 quals = 0; - +#ifdef __amigaos4__ GetAttr(WINDOW_Qualifier,gwin->objects[OID_MAIN],(uint32 *)&quals); - +#else +#warning qualifier needs fixing for OS3 +#endif gwin->key_state = 0; if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT)) @@ -1258,9 +1267,11 @@ static void ami_update_quals(struct gui_window_2 *gwin) nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox) { if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) { +#ifdef __amigaos4__ *bbox = AllocVecTagList(sizeof(struct IBox), NULL); if(*bbox == NULL) return NSERROR_NOMEM; GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox); +#endif } else { GetAttr(SPACE_AreaBox, obj, (ULONG *)bbox); } @@ -1431,6 +1442,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct static void ami_gui_trap_mouse(struct gui_window_2 *gwin) { +#ifdef __amigaos4__ switch(gwin->drag_op) { case GDRAGGING_NONE: @@ -1446,6 +1458,7 @@ static void ami_gui_trap_mouse(struct gui_window_2 *gwin) } break; } +#endif } static void ami_gui_menu_update_all(void) @@ -1511,23 +1524,26 @@ static bool ami_gui_hscroll_add(struct gui_window_2 *gwin) SCROLLER_Orientation, SORIENT_HORIZ, ICA_TARGET, ICTARGET_IDCMP, ScrollerEnd; - +#ifdef __amigaos4__ 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 +#endif return true; } /* 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; IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD, gwin->win, gwin->objects[GID_HSCROLL]); gwin->objects[GID_HSCROLL] = NULL; - +#endif return true; } @@ -1549,23 +1565,25 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin) GA_RelVerify, TRUE, ICA_TARGET, ICTARGET_IDCMP, ScrollerEnd; - +#ifdef __amigaos4__ +#warning FIXME for OS3 IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_ADDCHILD, gwin->win, gwin->objects[GID_VSCROLL], attrs); - +#endif return true; } /* 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; IDoMethod(gwin->objects[GID_VSCROLLLAYOUT], LM_REMOVECHILD, gwin->win, gwin->objects[GID_VSCROLL]); gwin->objects[GID_VSCROLL] = NULL; - +#endif return true; } @@ -1692,7 +1710,7 @@ static void ami_gui_refresh_favicon(void *p) static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height) { ULONG available_width; - +#ifdef __amigaos4__ if((sz_gad_width == 0) || (sz_gad_height == 0)) { struct DrawInfo *dri = GetScreenDrawInfo(scrn); GetGUIAttrs(NULL, dri, @@ -1701,7 +1719,7 @@ static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, TAG_DONE); FreeScreenDrawInfo(scrn, dri); } - +#endif available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width; *width = available_width; @@ -2025,7 +2043,7 @@ static void ami_handle_msg(void) gwin->prev_mouse_state = gwin->mouse_state; gwin->mouse_state=0; break; - +#ifdef __amigaos4__ case SIDEUP: ami_gui_history(gwin, true); break; @@ -2033,6 +2051,7 @@ static void ami_handle_msg(void) case EXTRAUP: ami_gui_history(gwin, false); break; +#endif } if(drag_save_data && !gwin->mouse_state) @@ -2413,7 +2432,7 @@ static void ami_handle_msg(void) case WMHI_CLOSEWINDOW: ami_close_all_tabs(gwin); break; - +#ifdef __amigaos4__ case WMHI_ICONIFY: { struct bitmap *bm; @@ -2431,7 +2450,7 @@ static void ami_handle_msg(void) cur_gw = NULL; } break; - +#endif case WMHI_INACTIVE: gwin->gw->c_h_temp = gwin->gw->c_h; gui_window_remove_caret(gwin->gw); @@ -2618,6 +2637,7 @@ static void ami_handle_appmsg(void) static void ami_handle_applib(void) { +#ifdef __amigaos4__ struct ApplicationMsg *applibmsg; struct browser_window *bw; nsurl *url; @@ -2697,6 +2717,7 @@ static void ami_handle_applib(void) } ReplyMsg((struct Message *)applibmsg); } +#endif } void ami_get_msg(void) @@ -2974,10 +2995,10 @@ static void gui_quit(void) ami_hotlist_free(nsoption_charp(hotlist_file)); ami_cookies_free(); ami_global_history_free(); - +#ifdef __amigaos4__ if(IApplication && ami_appid) UnregisterApplication(ami_appid, NULL); - +#endif ami_arexx_cleanup(); ami_free_layers(&browserglob); @@ -3108,6 +3129,7 @@ static int ami_gui_hotlist_scan(struct tree *tree, struct List *speed_button_lis static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) { +#ifdef __amigaos4__ struct TagItem attrs[2]; attrs[0].ti_Tag = CHILD_MinWidth; @@ -3145,6 +3167,9 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin) ami_schedule_redraw(gwin, true); } +#else +#warning FIXME for OS3 +#endif } static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List *speed_button_list) @@ -3174,6 +3199,7 @@ static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin) { +#ifdef __amigaos4__ IDoMethod(gwin->objects[GID_HOTLISTLAYOUT], LM_REMOVECHILD, gwin->win, gwin->objects[GID_HOTLIST]); @@ -3186,6 +3212,7 @@ static void ami_gui_hotlist_toolbar_remove(struct gui_window_2 *gwin) gwin->win, NULL, TRUE); ami_schedule_redraw(gwin, true); +#endif } static void ami_gui_hotlist_toolbar_update(struct gui_window_2 *gwin) @@ -3242,6 +3269,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show) { if(ClickTabBase->lib_Version < 53) return; +#ifdef __amigaos4__ if(show) { struct TagItem attrs[3]; @@ -3295,6 +3323,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show) gwin->win, NULL, TRUE); if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false); +#endif } void ami_gui_tabs_toggle_all(void) @@ -3438,7 +3467,7 @@ gui_window_create(struct browser_window *bw, if(curh > (scrn->Height - cury)) curh = scrn->Height - cury; - g = AllocVecTags(sizeof(struct gui_window), AVT_ClearWithValue, 0, TAG_DONE); + g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0); if(!g) { @@ -3510,7 +3539,7 @@ gui_window_create(struct browser_window *bw, return g; } - g->shared = AllocVecTags(sizeof(struct gui_window_2), AVT_ClearWithValue, 0, TAG_DONE); + g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0); if(!g->shared) { @@ -3563,7 +3592,7 @@ gui_window_create(struct browser_window *bw, g->shared->tabs=1; g->shared->next_tab=1; - g->shared->svbuffer = AllocVecTags(2000, AVT_ClearWithValue, 0, TAG_DONE); + g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0); g->shared->helphints[GID_BACK] = translate_escape_chars(messages_get("HelpToolbarBack")); @@ -4963,6 +4992,7 @@ static void gui_window_new_content(struct gui_window *g) static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, const struct rect *rect) { +#ifdef __amigaos4__ g->shared->drag_op = type; if(rect) g->shared->ptr_lock = ami_ns_rect_to_ibox(g->shared, rect); @@ -4977,7 +5007,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, g->shared->ptr_lock = NULL; } } - +#endif return true; } @@ -5028,7 +5058,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg break; } break; - +#ifdef __amigaos4__ case IDCMP_EXTENDEDMOUSE: if(msg->Code == IMSGCODE_INTUIWHEELDATA) { @@ -5037,7 +5067,7 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg ami_gui_scroll_internal(gwin, wheel->WheelX * 50, wheel->WheelY * 50); } break; - +#endif case IDCMP_SIZEVERIFY: break; @@ -5287,8 +5317,9 @@ int main(int argc, char** argv) .llcache = amiga_filesystem_llcache_table, }; +#ifdef __amigaos4__ signal(SIGINT, SIG_IGN); - +#endif ret = netsurf_register(&amiga_table); if (ret != NSERROR_OK) { ami_misc_fatal_error("NetSurf operation table failed registration"); @@ -5313,6 +5344,7 @@ int main(int argc, char** argv) * forcibly disable context menus if these are in use. */ popupmenu_lib_ok = FALSE; +#ifdef __amigaos4__ if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) { LOG(("popupmenu.library v%d.%d", PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision)); @@ -5320,7 +5352,7 @@ int main(int argc, char** argv) popupmenu_lib_ok = TRUE; CloseLibrary(PopupMenuBase); } - +#endif if (ami_open_resources() == false) { /* alloc message ports */ ami_misc_fatal_error("Unable to allocate resources"); return RETURN_FAIL; |