summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-20 20:03:55 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2015-01-20 20:03:55 +0000
commitd0f7247ea67491b4bfae28cb90538b68c6f83d70 (patch)
tree5a11197792c9d5a1279b38c5d24acdfa4b9dfa85
parent65ab38fc1c26bed356fc61dd4adfe1f0495fab65 (diff)
parent2b9df1b2cd30e394ebb4e9be721b7d219c4e418c (diff)
downloadnetsurf-d0f7247ea67491b4bfae28cb90538b68c6f83d70.tar.gz
netsurf-d0f7247ea67491b4bfae28cb90538b68c6f83d70.tar.bz2
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
-rw-r--r--amiga/Makefile.defaults6
-rw-r--r--amiga/Makefile.target2
-rw-r--r--amiga/bitmap.c5
-rw-r--r--amiga/gui.c138
-rwxr-xr-xamiga/gui_options.c5
-rwxr-xr-xamiga/help.c2
-rwxr-xr-xamiga/history_local.c2
-rw-r--r--amiga/icon.c74
-rwxr-xr-xamiga/launch.c13
-rw-r--r--amiga/libs.c94
-rwxr-xr-xamiga/login.c3
-rw-r--r--amiga/menu.c25
-rwxr-xr-xamiga/misc.c11
-rwxr-xr-xamiga/object.c5
-rw-r--r--amiga/os3support.c88
-rw-r--r--amiga/os3support.h120
-rwxr-xr-xamiga/plotters.c29
-rw-r--r--amiga/plugin_hack.c6
-rw-r--r--amiga/print.c16
-rwxr-xr-xamiga/schedule.c8
-rwxr-xr-xamiga/search.c2
-rwxr-xr-xamiga/stringview/stringview.c4
-rw-r--r--amiga/stringview/urlhistory.c16
-rw-r--r--amiga/theme.c20
-rwxr-xr-xamiga/thumbnail.c4
-rw-r--r--amiga/tree.c29
-rw-r--r--utils/log.c6
27 files changed, 565 insertions, 168 deletions
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults
index 2134e8373..243e44b38 100644
--- a/amiga/Makefile.defaults
+++ b/amiga/Makefile.defaults
@@ -4,7 +4,11 @@
# Force using glibc internal iconv implementation instead of external libiconv
# Valid options: YES, NO
-NETSURF_USE_LIBICONV_PLUG := YES
+ifneq ($(SUBTARGET),os3)
+ NETSURF_USE_LIBICONV_PLUG := YES
+else
+ NETSURF_USE_LIBICONV_PLUG := NO
+endif
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index d29e7aa17..ec478260d 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -53,7 +53,7 @@ else
LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib
ifeq ($(SUBTARGET),os3)
- LDFLAGS += -lpbl -liconv
+ LDFLAGS += -lpbl -liconv -lamiga
else
LDFLAGS += -lpbl -liconv
endif
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index e7bd72ce4..b7eb129db 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -19,8 +19,8 @@
#include "amiga/os3support.h"
#include <proto/exec.h>
-#include <proto/Picasso96API.h>
#ifdef __amigaos4__
+#include <proto/Picasso96API.h>
#include <graphics/blitattr.h>
#include <graphics/composite.h>
#endif
@@ -388,6 +388,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm)
{
+#ifdef __amigaos4__
struct RenderInfo ri;
struct BitMap *tbm = NULL;
struct RastPort trp;
@@ -495,6 +496,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
}
return tbm;
+#endif
}
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
@@ -581,3 +583,4 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);
}
}
+
diff --git a/amiga/gui.c b/amiga/gui.c
index 6f2f402e8..eeb39421d 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -34,25 +34,27 @@
#include <proto/intuition.h>
#include <proto/keymap.h>
#include <proto/locale.h>
+#ifdef __amigaos4__
#include <proto/Picasso96API.h>
#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) {
@@ -1232,9 +1239,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))
@@ -1257,9 +1266,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);
}
@@ -1430,6 +1441,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:
@@ -1445,6 +1457,7 @@ static void ami_gui_trap_mouse(struct gui_window_2 *gwin)
}
break;
}
+#endif
}
static void ami_gui_menu_update_all(void)
@@ -1510,23 +1523,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;
}
@@ -1548,23 +1564,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;
}
@@ -1657,7 +1675,7 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
warn_user("NoMemory", "");
return;
}
-
+#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestX, bbox->Left,
@@ -1671,7 +1689,11 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
BLITA_Minterm, minterm,
tag, tag_data,
TAG_DONE);
-
+#else
+ /*\todo we are assuming we are always masking here, which might not be true */
+ BltMaskBitMapRastPort(bm, 0, 0, g->shared->win->RPort,
+ bbox->Left, bbox->Top, 16, 16, tag_data, minterm);
+#endif
ami_gui_free_space_box(bbox);
}
}
@@ -1691,7 +1713,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,
@@ -1700,7 +1722,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;
@@ -2024,7 +2046,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;
@@ -2032,6 +2054,7 @@ static void ami_handle_msg(void)
case EXTRAUP:
ami_gui_history(gwin, false);
break;
+#endif
}
if(drag_save_data && !gwin->mouse_state)
@@ -2415,7 +2438,7 @@ static void ami_handle_msg(void)
case WMHI_CLOSEWINDOW:
ami_close_all_tabs(gwin);
break;
-
+#ifdef __amigaos4__
case WMHI_ICONIFY:
{
struct bitmap *bm;
@@ -2433,7 +2456,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);
@@ -2620,6 +2643,7 @@ static void ami_handle_appmsg(void)
static void ami_handle_applib(void)
{
+#ifdef __amigaos4__
struct ApplicationMsg *applibmsg;
struct browser_window *bw;
nsurl *url;
@@ -2699,6 +2723,7 @@ static void ami_handle_applib(void)
}
ReplyMsg((struct Message *)applibmsg);
}
+#endif
}
void ami_get_msg(void)
@@ -2976,10 +3001,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);
@@ -3110,6 +3135,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;
@@ -3147,6 +3173,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)
@@ -3176,6 +3205,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]);
@@ -3188,6 +3218,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)
@@ -3244,6 +3275,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];
@@ -3297,6 +3329,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)
@@ -3440,7 +3473,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)
{
@@ -3512,7 +3545,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)
{
@@ -3565,7 +3598,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"));
@@ -3670,7 +3703,13 @@ gui_window_create(struct browser_window *bw,
BitMapEnd;
}
+ LOG(("Creating window object"));
+
g->shared->objects[OID_MAIN] = WindowObject,
+#ifndef __amigaos4__
+ WA_Width, 100,
+ WA_Height, 100,
+#endif
WA_ScreenTitle, ami_gui_get_screen_title(),
WA_Activate, TRUE,
WA_DepthGadget, TRUE,
@@ -3924,8 +3963,12 @@ gui_window_create(struct browser_window *bw,
EndWindow;
}
+ LOG(("Opening window"));
+
g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]);
+ LOG(("Window opened, adding border gadgets"));
+
if(!g->shared->win)
{
warn_user("NoMemory","");
@@ -4292,7 +4335,7 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
&clip, ctx))
{
ami_clearclipreg(&browserglob);
-
+#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
BLITA_Source, browserglob.bm,
BLITA_SrcX, 0,
@@ -4304,6 +4347,12 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
BLITA_Width, (int)(clip.x1),
BLITA_Height, (int)(clip.y1),
TAG_DONE);
+#else
+ BltBitMapRastPort(browserglob.bm, 0, 0, gwin->win->RPort,
+ bbox->Left + (int)((x - sx) * gwin->gw->scale),
+ bbox->Top + (int)((y - sy) * gwin->gw->scale),
+ (int)(clip.x1), (int)(clip.y1), 0xC0);
+#endif
}
}
}
@@ -4965,6 +5014,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);
@@ -4979,7 +5029,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
g->shared->ptr_lock = NULL;
}
}
-
+#endif
return true;
}
@@ -5030,7 +5080,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)
{
@@ -5039,7 +5089,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;
@@ -5111,16 +5161,26 @@ Object *ami_gui_splash_open(void)
struct TextFont *tfont;
win_obj = WindowObject,
- WA_Borderless, TRUE,
+#ifdef __amigaos4__
WA_ToolBox, TRUE,
+#else
+ WA_Width, 100,
+ WA_Height, 100,
+#endif
+ WA_Borderless, TRUE,
WA_BusyPointer, TRUE,
WINDOW_Position, WPOS_CENTERSCREEN,
WINDOW_LockWidth, TRUE,
WINDOW_LockHeight, TRUE,
- WINDOW_ParentGroup, LayoutObject,
+ WINDOW_ParentGroup, VGroupObject,
LAYOUT_AddImage, bm_obj = BitMapObject,
BITMAP_SourceFile, "PROGDIR:Resources/splash.png",
BITMAP_Screen, wbscreen,
+ BITMAP_Precision, PRECISION_IMAGE,
+#ifndef __amigaos4__
+ BITMAP_Width, 400,
+ BITMAP_Height, 250,
+#endif
BitMapEnd,
LayoutEnd,
EndWindow;
@@ -5289,8 +5349,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");
@@ -5315,6 +5376,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));
@@ -5322,7 +5384,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;
@@ -5335,6 +5397,7 @@ int main(int argc, char** argv)
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
current_user = ASPrintf("%s", (user == -1) ? "Default" : temp);
+ LOG(("User: %s", current_user));
current_user_dir = ASPrintf("PROGDIR:Users/%s", current_user);
if((lock = CreateDirTree(current_user_dir)))
@@ -5350,7 +5413,10 @@ int main(int argc, char** argv)
ami_mime_init("PROGDIR:Resources/mimetypes");
sprintf(temp, "%s/mimetypes.user", current_user_dir);
ami_mime_init(temp);
+
+#ifdef __amigaos4__
amiga_plugin_hack_init();
+#endif
ret = amiga_datatypes_init();
/* user options setup */
diff --git a/amiga/gui_options.c b/amiga/gui_options.c
index d4a755e25..2187c30ab 100755
--- a/amiga/gui_options.c
+++ b/amiga/gui_options.c
@@ -491,8 +491,9 @@ void ami_gui_opts_open(void)
scaledisabled = TRUE;
scaleselected = FALSE;
}
-
+#ifdef __amigaos4__
if(ApplicationBase->lib_Version < 53)
+#endif
{
download_notify_disabled = TRUE;
nsoption_set_bool(download_notify, FALSE);
@@ -526,7 +527,7 @@ void ami_gui_opts_open(void)
{
ami_gui_opts_setup();
- gow = AllocVecTags(sizeof(struct ami_gui_opts_window), AVT_ClearWithValue, 0, TAG_DONE);
+ gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0);
gow->objects[OID_MAIN] = WindowObject,
WA_ScreenTitle, ami_gui_get_screen_title(),
diff --git a/amiga/help.c b/amiga/help.c
index 76dd1bd86..64b338426 100755
--- a/amiga/help.c
+++ b/amiga/help.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include "amiga/help.h"
/* AmigaGuide class */
diff --git a/amiga/history_local.c b/amiga/history_local.c
index 2fb1ba677..c8c7b7263 100755
--- a/amiga/history_local.c
+++ b/amiga/history_local.c
@@ -112,7 +112,7 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
- gw->hw = AllocVecTags(sizeof(struct history_window), AVT_ClearWithValue, 0, TAG_DONE);
+ gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height);
diff --git a/amiga/icon.c b/amiga/icon.c
index 2745fcf0f..dfbf84c09 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -376,43 +376,41 @@ void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct
TAG_DONE);
if(format != IDFMT_DIRECTMAPPED) return;
- {
- if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
- {
- bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
- }
+#ifdef __amigaos4__
+ if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
+ bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
+ }
- if(bm)
- {
- BltBitMapTags(BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestX, width - 16,
- BLITA_DestY, height - 16,
- BLITA_Width, 16,
- BLITA_Height, 16,
- BLITA_Source, bm,
- BLITA_Dest, icondata1,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, width * 4,
- BLITA_UseSrcAlpha, TRUE,
- TAG_DONE);
+ if(bm) {
+ BltBitMapTags(BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_DestX, width - 16,
+ BLITA_DestY, height - 16,
+ BLITA_Width, 16,
+ BLITA_Height, 16,
+ BLITA_Source, bm,
+ BLITA_Dest, icondata1,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_DestType, BLITT_ARGB32,
+ BLITA_DestBytesPerRow, width * 4,
+ BLITA_UseSrcAlpha, TRUE,
+ TAG_DONE);
- BltBitMapTags(BLITA_SrcX, 0,
- BLITA_SrcY, 0,
- BLITA_DestX, width - 16,
- BLITA_DestY, height - 16,
- BLITA_Width, 16,
- BLITA_Height, 16,
- BLITA_Source, bm,
- BLITA_Dest, icondata2,
- BLITA_SrcType, BLITT_BITMAP,
- BLITA_DestType, BLITT_ARGB32,
- BLITA_DestBytesPerRow, width * 4,
- BLITA_UseSrcAlpha, TRUE,
- TAG_DONE);
- }
+ BltBitMapTags(BLITA_SrcX, 0,
+ BLITA_SrcY, 0,
+ BLITA_DestX, width - 16,
+ BLITA_DestY, height - 16,
+ BLITA_Width, 16,
+ BLITA_Height, 16,
+ BLITA_Source, bm,
+ BLITA_Dest, icondata2,
+ BLITA_SrcType, BLITT_BITMAP,
+ BLITA_DestType, BLITT_ARGB32,
+ BLITA_DestBytesPerRow, width * 4,
+ BLITA_UseSrcAlpha, TRUE,
+ TAG_DONE);
}
+#endif
}
void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
@@ -496,7 +494,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
struct DiskObject *dobj;
struct BitMap *bitmap;
-
+#ifdef __amigaos4__
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
@@ -512,11 +510,11 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
BLITA_Dest, bm->icondata,
TAG_DONE);
}
-
+#endif
dobj = GetIconTags(NULL, ICONGETA_GetDefaultType, WBPROJECT,
ICONGETA_GetDefaultName, "iconify",
TAG_DONE);
-
+#ifdef __amigaos4__
if(bm)
{
IconControl(dobj,
@@ -527,7 +525,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
ICONCTRLA_SetImageData2, NULL,
TAG_DONE);
}
-
+#endif
dobj->do_Gadget.UserData = bm;
LayoutIconA(dobj, (struct Screen *)~0UL, NULL);
diff --git a/amiga/launch.c b/amiga/launch.c
index c3f993b28..5f22bdc23 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -124,8 +124,11 @@ static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
void ami_openurl_open(void)
{
if(nsoption_bool(use_openurl_lib)) {
- if((OpenURLBase = OpenLibrary("openurl.library",0)))
+ if((OpenURLBase = OpenLibrary("openurl.library",0))) {
+#ifdef __amigaos4__
IOpenURL = (struct OpenURLIFace *)GetInterface(OpenURLBase,"main",1,NULL);
+#endif
+ }
}
NewMinList(&ami_unsupportedprotocols);
@@ -133,7 +136,9 @@ void ami_openurl_open(void)
void ami_openurl_close(void)
{
+#ifdef __amigaos4__
if(IOpenURL) DropInterface((struct Interface *)IOpenURL);
+#endif
if(OpenURLBase) CloseLibrary(OpenURLBase);
ami_openurl_free_list(&ami_unsupportedprotocols);
@@ -141,7 +146,9 @@ void ami_openurl_close(void)
nserror gui_launch_url(struct nsurl *url)
{
+#ifdef __amigaos4__
APTR procwin = SetProcWindow((APTR)-1L);
+#endif
char *launchurl = NULL;
if(ami_openurl_check_list(&ami_unsupportedprotocols, url) == FALSE)
@@ -162,8 +169,8 @@ nserror gui_launch_url(struct nsurl *url)
}
}
}
-
+#ifdef __amigaos4__
SetProcWindow(procwin);
-
+#endif
return NSERROR_OK;
}
diff --git a/amiga/libs.c b/amiga/libs.c
index cab02d265..9ac9589c3 100644
--- a/amiga/libs.c
+++ b/amiga/libs.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include "amiga/libs.h"
#include "amiga/misc.h"
#include "utils/utils.h"
@@ -24,6 +26,7 @@
#include <proto/exec.h>
#include <proto/utility.h>
+#ifdef __amigaos4__
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
LOG(("Opening %s v%d", LIB, LIBVER)); \
if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \
@@ -48,10 +51,35 @@
#define AMINS_LIB_STRUCT(PREFIX) \
struct Library *PREFIX##Base; \
struct PREFIX##IFace *I##PREFIX;
+#else
+#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
+ LOG(("Opening %s v%d", LIB, LIBVER)); \
+ if((PREFIX##Base = OpenLibrary(LIB, LIBVER))) { \
+ } else { \
+ LOG(("Failed to open %s v%d", LIB, LIBVER)); \
+ if(FAIL == true) { \
+ STRPTR error = ASPrintf("Unable to open %s v%d", LIB, LIBVER); \
+ ami_misc_fatal_error(error); \
+ FreeVec(error); \
+ return false; \
+ } \
+ }
+
+#define AMINS_LIB_CLOSE(PREFIX) \
+ if(PREFIX##Base) CloseLibrary(PREFIX##Base);
+
+#define AMINS_LIB_STRUCT(PREFIX) \
+ struct Library *PREFIX##Base;
+#endif
#define GraphicsBase GfxBase /* graphics.library is a bit weird */
+#ifdef __amigaos4__
AMINS_LIB_STRUCT(Application);
+AMINS_LIB_STRUCT(P96);
+#else
+struct UtilityBase *UtilityBase; /* AMINS_LIB_STRUCT(Utility) */
+#endif
AMINS_LIB_STRUCT(Asl);
AMINS_LIB_STRUCT(DataTypes);
AMINS_LIB_STRUCT(Diskfont);
@@ -63,7 +91,6 @@ AMINS_LIB_STRUCT(Intuition);
AMINS_LIB_STRUCT(Keymap);
AMINS_LIB_STRUCT(Layers);
AMINS_LIB_STRUCT(Locale);
-AMINS_LIB_STRUCT(P96);
AMINS_LIB_STRUCT(Workbench);
AMINS_LIB_STRUCT(ARexx);
@@ -90,19 +117,26 @@ AMINS_LIB_STRUCT(Window);
bool ami_libs_open(void)
{
+#ifdef __amigaos4__
+ /* Libraries only needed on OS4 */
AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false)
+ AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true)
+#else
+ /* Libraries we get automatically on OS4 but not OS3 */
+ AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true)
+#endif
+ /* Standard libraries for both versions */
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
AMINS_LIB_OPEN("datatypes.library", 37, DataTypes, "main", 1, true)
- AMINS_LIB_OPEN("diskfont.library", 50, Diskfont, "main", 1, true)
+ AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true)
AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
- AMINS_LIB_OPEN("graphics.library", 50, Graphics, "main", 1, true)
- AMINS_LIB_OPEN("icon.library", 50, Icon, "main", 1, true)
+ AMINS_LIB_OPEN("graphics.library", 40, Graphics, "main", 1, true)
+ AMINS_LIB_OPEN("icon.library", 44, Icon, "main", 1, true)
AMINS_LIB_OPEN("iffparse.library", 37, IFFParse, "main", 1, true)
- AMINS_LIB_OPEN("intuition.library", 37, Intuition, "main", 1, true)
+ AMINS_LIB_OPEN("intuition.library", 40, Intuition, "main", 1, true)
AMINS_LIB_OPEN("keymap.library", 37, Keymap, "main", 1, true)
AMINS_LIB_OPEN("layers.library", 37, Layers, "main", 1, true)
AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true)
- AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true)
AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true)
/* NB: timer.device is opened in schedule.c (ultimately by the scheduler process).
@@ -121,26 +155,26 @@ bool ami_libs_open(void)
* we may as well just open them normally for now.
*/
- AMINS_LIB_OPEN("classes/arexx.class", 50, ARexx, "main", 1, true)
- AMINS_LIB_OPEN("images/bevel.image", 50, Bevel, "main", 1, true)
- AMINS_LIB_OPEN("images/bitmap.image", 50, BitMap, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/checkbox.gadget", 50, CheckBox, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/chooser.gadget", 50, Chooser, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/clicktab.gadget", 50, ClickTab, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 50, FuelGauge, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/getfile.gadget", 50, GetFile, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/getfont.gadget", 50, GetFont, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 50, GetScreenMode, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/integer.gadget", 50, Integer, "main", 1, true)
- AMINS_LIB_OPEN("images/label.image", 50, Label, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/layout.gadget", 50, Layout, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 50, ListBrowser, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 50, RadioButton, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/scroller.gadget", 50, Scroller, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/space.gadget", 50, Space, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/speedbar.gadget", 50, SpeedBar, "main", 1, true)
- AMINS_LIB_OPEN("gadgets/string.gadget", 50, String, "main", 1, true)
- AMINS_LIB_OPEN("classes/window.class", 50, Window, "main", 1, true)
+ AMINS_LIB_OPEN("arexx.class", 44, ARexx, "main", 1, true)
+ AMINS_LIB_OPEN("images/bevel.image", 44, Bevel, "main", 1, true)
+ AMINS_LIB_OPEN("images/bitmap.image", 44, BitMap, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/checkbox.gadget", 44, CheckBox, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/chooser.gadget", 44, Chooser, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/clicktab.gadget", 44, ClickTab, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/fuelgauge.gadget", 44, FuelGauge, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getfile.gadget", 44, GetFile, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getfont.gadget", 44, GetFont, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/getscreenmode.gadget", 44, GetScreenMode, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/integer.gadget", 44, Integer, "main", 1, true)
+ AMINS_LIB_OPEN("images/label.image", 44, Label, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/layout.gadget", 44, Layout, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/listbrowser.gadget", 44, ListBrowser, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/radiobutton.gadget", 44, RadioButton, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/scroller.gadget", 44, Scroller, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/space.gadget", 44, Space, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/speedbar.gadget", 44, SpeedBar, "main", 1, true)
+ AMINS_LIB_OPEN("gadgets/string.gadget", 44, String, "main", 1, true)
+ AMINS_LIB_OPEN("window.class", 44, Window, "main", 1, true)
return true;
}
@@ -168,7 +202,6 @@ void ami_libs_close(void)
AMINS_LIB_CLOSE(String)
AMINS_LIB_CLOSE(Window)
- AMINS_LIB_CLOSE(Application)
AMINS_LIB_CLOSE(Asl)
AMINS_LIB_CLOSE(DataTypes)
AMINS_LIB_CLOSE(Diskfont)
@@ -180,7 +213,12 @@ void ami_libs_close(void)
AMINS_LIB_CLOSE(Keymap)
AMINS_LIB_CLOSE(Layers)
AMINS_LIB_CLOSE(Locale)
- AMINS_LIB_CLOSE(P96)
AMINS_LIB_CLOSE(Workbench)
+#ifdef __amigaos4__
+ AMINS_LIB_CLOSE(Application)
+ AMINS_LIB_CLOSE(P96)
+#else
+ AMINS_LIB_CLOSE(Utility)
+#endif
}
diff --git a/amiga/login.c b/amiga/login.c
index e9e221bbc..fe476acc1 100755
--- a/amiga/login.c
+++ b/amiga/login.c
@@ -61,8 +61,7 @@ void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
const char *auth;
- struct gui_login_window *lw = AllocVecTags(sizeof(struct gui_login_window),
- AVT_ClearWithValue, 0, TAG_DONE);
+ struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0);
lwc_string *host = nsurl_get_component(url, NSURL_HOST);
assert(host != NULL);
diff --git a/amiga/menu.c b/amiga/menu.c
index 3eb8a9846..1fef12baf 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include <string.h>
#include <proto/dos.h>
@@ -40,6 +42,7 @@
#include "utils/nsoption.h"
#include "utils/messages.h"
+
#include "desktop/hotlist.h"
#include "desktop/browser.h"
#include "desktop/mouse.h"
@@ -196,7 +199,7 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
{
int i;
- gwin->menutype = AllocVecTags(AMI_MENU_AREXX_MAX + 1, AVT_ClearWithValue, 0, TAG_DONE);
+ gwin->menutype = ami_misc_allocvec_clear(AMI_MENU_AREXX_MAX + 1, 0);
for(i=0;i <= AMI_MENU_AREXX_MAX;i++)
{
@@ -333,6 +336,7 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri)
{
+#ifdef __amigaos4__
for(int i = 0; i < NSA_GLYPH_MAX; i++)
menu_glyph[i] = NULL;
@@ -350,10 +354,12 @@ static void ami_menu_load_glyphs(struct DrawInfo *dri)
(ULONG *)&menu_glyph_width[NSA_GLYPH_AMIGAKEY]);
menu_glyphs_loaded = true;
+#endif
}
void ami_menu_free_glyphs(void)
{
+#ifdef __amigaos4__
int i;
if(menu_glyphs_loaded == false) return;
@@ -363,6 +369,7 @@ void ami_menu_free_glyphs(void)
};
menu_glyphs_loaded = false;
+#endif
}
static int ami_menu_calc_item_width(struct gui_window_2 *gwin, int j, struct RastPort *rp)
@@ -413,7 +420,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
j++;
} while((gwin->menutype[j] != NM_TITLE) && (gwin->menutype[j] != 0));
}
-
+#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)GadToolsBase, 53, 6)) {
/* GadTools 53.6+ only. For now we will only create the menu
using label.image if there's a bitmap associated with the item. */
@@ -495,7 +502,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
if(gwin->menuobj[i]) gwin->menutype[i] |= MENU_IMAGE;
}
}
-
+#endif
gwin->menu[i].nm_Type = gwin->menutype[i];
if(gwin->menuobj[i])
@@ -520,8 +527,7 @@ static struct gui_window_2 *ami_menu_layout(struct gui_window_2 *gwin)
struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
{
- gwin->menu = AllocVecTags(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1),
- AVT_ClearWithValue, 0, TAG_DONE);
+ gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
ami_init_menulabs(gwin);
ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin);
ami_menu_arexx_scan(gwin);
@@ -835,7 +841,7 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I
temp2 = ami_utf8_easy(temp);
FreeVec(temp);
-
+#ifdef __amigaos4__
sel = TimedDosRequesterTags(TDR_ImageType,TDRIMAGE_INFO,
TDR_TitleString, messages_get("NetSurf"),
TDR_Window, gwin->win,
@@ -844,7 +850,12 @@ static void ami_menu_item_project_about(struct Hook *hook, APTR window, struct I
TDR_Arg1,netsurf_version,
TDR_Arg2,verdate,
TAG_DONE);
-
+#else
+ /*\todo proper requester for OS3
+ * at the moment menus are disabled so won't get here anyway */
+ printf("NetSurf %s\nBuild date %s\n", netsurf_version, verdate);
+ sel = 0;
+#endif
free(temp2);
if(sel == 2) {
diff --git a/amiga/misc.c b/amiga/misc.c
index 0cd3baedd..73a87e78d 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -52,7 +52,7 @@ static LONG ami_misc_req(const char *message, uint32 type)
LONG ret = 0;
LOG(("%s", message));
-
+#ifdef __amigaos4__
ret = TimedDosRequesterTags(
TDR_TitleString, messages_get("NetSurf"),
TDR_FormatString, message,
@@ -60,7 +60,9 @@ static LONG ami_misc_req(const char *message, uint32 type)
TDR_ImageType, type,
TDR_Window, cur_gw ? cur_gw->shared->win : NULL,
TAG_DONE);
-
+#else
+ printf("%s\n", message);
+#endif
return ret;
}
@@ -84,6 +86,7 @@ void warn_user(const char *warning, const char *detail)
int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win)
{
int res = 0;
+#ifdef __amigaos4__
char *utf8text = ami_utf8_easy(body);
char *utf8gadget1 = ami_utf8_easy(messages_get(opt1));
char *utf8gadget2 = ami_utf8_easy(messages_get(opt2));
@@ -100,7 +103,9 @@ int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2,
if(utf8text) free(utf8text);
if(utf8gadgets) FreeVec(utf8gadgets);
-
+#else
+#warning write this for os3
+#endif
return res;
}
diff --git a/amiga/object.c b/amiga/object.c
index 0c848aa5f..99f359ad1 100755
--- a/amiga/object.c
+++ b/amiga/object.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include <stdlib.h>
#include <proto/exec.h>
@@ -24,6 +26,7 @@
#include "amiga/filetype.h"
#include "amiga/font.h"
+#include "amiga/misc.h"
#include "amiga/object.h"
struct MinList *NewObjList(void)
@@ -43,7 +46,7 @@ struct nsObject *AddObject(struct MinList *objlist, ULONG otype)
{
struct nsObject *dtzo;
- dtzo = (struct nsObject *)AllocVecTags(sizeof(struct nsObject), AVT_ClearWithValue, 0, TAG_DONE);
+ dtzo = (struct nsObject *)ami_misc_allocvec_clear(sizeof(struct nsObject), 0);
AddTail((struct List *)objlist,(struct Node *)dtzo);
diff --git a/amiga/os3support.c b/amiga/os3support.c
index 613701cc5..3b42685a5 100644
--- a/amiga/os3support.c
+++ b/amiga/os3support.c
@@ -23,6 +23,21 @@
#ifndef __amigaos4__
#include "os3support.h"
+#include <inttypes.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <proto/exec.h>
+#include <proto/intuition.h>
+#include <proto/dos.h>
+#include <proto/utility.h>
+
+#include <intuition/gadgetclass.h>
+
+#define SUCCESS (TRUE)
+#define FAILURE (FALSE)
+#define NO !
+
/* DOS */
int64 GetFileSize(BPTR fh)
{
@@ -37,6 +52,19 @@ int64 GetFileSize(BPTR fh)
return (int64)size;
}
+void FreeSysObject(ULONG type, APTR obj)
+{
+ switch(type) {
+ case ASOT_PORT:
+ DeleteMsgPort(obj);
+ break;
+ case ASOT_IOREQUEST:
+ DeleteIORequest(obj);
+ break;
+ }
+}
+
+
/* Exec */
struct Node *GetHead(struct List *list)
{
@@ -49,6 +77,52 @@ struct Node *GetHead(struct List *list)
return res;
}
+/* Intuition */
+uint32 GetAttrs(Object *obj, Tag tag1, ...)
+{
+ va_list ap;
+ Tag tag = tag1;
+ ULONG data = 0;
+ int i = 0;
+
+ va_start(ap, tag1);
+
+ while(tag != TAG_DONE) {
+ data = va_arg(ap, ULONG);
+ i += GetAttr(tag, obj, (void *)data);
+ tag = va_arg(ap, Tag);
+ }
+ va_end(ap);
+
+ return i;
+}
+
+ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags)
+{
+ ULONG retval;
+ BOOL changedisabled = FALSE;
+ BOOL disabled;
+
+ if (w) {
+ if (FindTagItem(GA_Disabled,tags)) {
+ changedisabled = TRUE;
+ disabled = g->Flags & GFLG_DISABLED;
+ }
+ }
+ retval = SetGadgetAttrsA(g,w,r,tags);
+ if (w && (retval || (changedisabled && disabled != (g->Flags & GFLG_DISABLED)))) {
+ RefreshGList(g,w,r,1);
+ retval = 1;
+ }
+ return retval;
+}
+
+ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...)
+{
+ return RefreshSetGadgetAttrsA(g,w,r,(struct TagItem *) &tag1);
+}
+
+
/* Utility */
struct FormatContext
{
@@ -171,5 +245,19 @@ char *strlwr(char *str)
return str;
}
+
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **))
+{
+ /*\todo stub function, needs writing, preferably into clib2 */
+ return 0;
+}
+
+long long int strtoll(const char *nptr, char **endptr, int base)
+{
+ return (long long int)strtol(nptr, endptr, base);
+}
+
#endif
diff --git a/amiga/os3support.h b/amiga/os3support.h
index 4de39d82f..a8c5abad2 100644
--- a/amiga/os3support.h
+++ b/amiga/os3support.h
@@ -1,5 +1,6 @@
/*
* Copyright 2010 John-Mark Bell <jmb@netsurf-browser.org>
+ * Copyright 2014 Chris Young <chris@unsatisfactorsysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -26,6 +27,7 @@
#ifndef __amigaos4__
#include <stdint.h>
+
#include <proto/exec.h>
#include <proto/dos.h>
@@ -36,43 +38,125 @@
#include <exec/memory.h>
#endif
+/* C macros */
+#ifndef ASM
+#define ASM
+#endif
+
+#ifndef REG
+#define REG(reg,arg) arg __asm(#reg)
+#endif
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+
/* Macros */
#define IsMinListEmpty(L) (L)->mlh_Head->mln_Succ == 0
+#define LIB_IS_AT_LEAST(B,V,R) ((B)->lib_Version>(V)) || \
+ ((B)->lib_Version==(V) && (B)->lib_Revision>=(R))
+#define EAD_IS_FILE(E) ((E)->ed_Type<0)
/* Define extra memory type flags */
#define MEMF_PRIVATE MEMF_ANY
#define MEMF_SHARED MEMF_ANY
-/* Ignore tags that aren't supported */
+/* Ignore unsupported tags */
+#define ASO_NoTrack TAG_IGNORE
+#define BITMAP_DisabledSourceFile TAG_IGNORE
+#define BLITA_UseSrcAlpha TAG_IGNORE
+#define BLITA_MaskPlane TAG_IGNORE
+#define CLICKTAB_CloseImage TAG_IGNORE
+#define CLICKTAB_FlagImage TAG_IGNORE
+#define CLICKTAB_LabelTruncate TAG_IGNORE
+#define CLICKTAB_NodeClosed TAG_IGNORE
+#define GETFONT_OTagOnly TAG_IGNORE
+#define GETFONT_ScalableOnly TAG_IGNORE
#define PDTA_PromoteMask TAG_IGNORE
+#define RPTAG_APenColor TAG_IGNORE
+#define GA_HintInfo TAG_IGNORE
+#define GAUGEIA_Level TAG_IGNORE
+#define IA_InBorder TAG_IGNORE
+#define IA_Label TAG_IGNORE
+#define SA_Compositing TAG_IGNORE
+#define SBNA_Text TAG_IGNORE
+#define TNA_CloseGadget TAG_IGNORE
+#define TNA_HintInfo TAG_IGNORE
+#define WA_ToolBox TAG_IGNORE
+#define WINDOW_BuiltInScroll TAG_IGNORE
+#define WINDOW_NewMenu TAG_IGNORE
+#define WINDOW_NewPrefsHook TAG_IGNORE
+
+/* raw keycodes */
+#define RAWKEY_BACKSPACE 0x41
+#define RAWKEY_TAB 0x42
+#define RAWKEY_ESC 0x45
+#define RAWKEY_DEL 0x46
+#define RAWKEY_PAGEUP 0x48
+#define RAWKEY_PAGEDOWN 0x49
+#define RAWKEY_CRSRUP 0x4C
+#define RAWKEY_CRSRDOWN 0x4D
+#define RAWKEY_CRSRRIGHT 0x4E
+#define RAWKEY_CRSRLEFT 0x4F
+#define RAWKEY_F5 0x54
+#define RAWKEY_HELP 0x5F
+#define RAWKEY_HOME 0x70
+#define RAWKEY_END 0x71
+
+/* Other constants */
+#define BVS_DISPLAY BVS_NONE
+#define IDCMP_EXTENDEDMOUSE 0
+#define WINDOW_BACKMOST 0
+#define DN_FULLPATH 0
+#define BGBACKFILL JAM1
/* Renamed structures */
#define AnchorPathOld AnchorPath
+/* ReAction (ClassAct) macros */
+#define GetFileEnd End
+#define GetFontEnd End
+#define GetScreenModeEnd End
+
/* Easy compat macros */
/* application */
#define Notify(...) (void)0
-/* Exec */
-/* AllocVecTagList with no tags */
-#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY)
-#define GetSucc(N) (N)->ln_Succ
+/* DataTypes */
+#define SaveDTObjectA(O,W,R,F,M,I,A) DoDTMethod(O,W,R,DTM_WRITE,F,M,NULL)
/* diskfont */
/* Only used in one place we haven't ifdeffed, where it returns the charset name */
#define ObtainCharsetInfo(A,B,C) (const char *)"ISO-8859-1"
/* DOS */
+#define AllocSysObjectTags(A,B,C,D) CreateMsgPort() /* Assume ASOT_PORT for now */
#define FOpen(A,B,C) Open(A,B)
#define FClose(A) Close(A)
+#define CreateDirTree(D) CreateDir(D) /*\todo This isn't quite right */
+#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
+
+/* Exec */
+#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
+#define GetPred(N) (N)->ln_Pred
+#define GetSucc(N) (N)->ln_Succ
+
+/* Gfx */
+#define SetRPAttrs(...) (void)0 /*\todo Probably need to emulate this */
/* Intuition */
+#define ICoerceMethod CoerceMethod
#define IDoMethod DoMethod
#define IDoMethodA DoMethodA
#define IDoSuperMethodA DoSuperMethodA
-#define RefreshSetGadgetAttrs SetGadgetAttrs /*\todo This isn't quite right */
+#define ShowWindow(...) (void)0
+
+/* P96 */
+#define p96FreeBitMap(B) FreeBitMap(B)
+#define p96AllocBitMap(W,H,D,FL,FR,FM) AllocBitMap(W,H,D,FL,FR)
+#define p96RectFill(RP,X,Y,XW,YH,C) RectFill(RP,X,Y,XW,YH) /* Needs pen */
+
/* Utility */
#define SetMem memset
+#define SNPrintf snprintf
/* Integral type definitions */
typedef int8_t int8;
@@ -90,6 +174,12 @@ struct TimeVal {
uint32 Microseconds;
};
+/* TimeRequest */
+struct TimeRequest {
+ struct IORequest Request;
+ struct TimeVal Time;
+};
+
/* Compositing */
#define COMPFLAG_IgnoreDestAlpha 0
#define COMPFLAG_SrcAlphaOverride 0
@@ -117,13 +207,31 @@ struct TimeVal {
#define IDFMT_PALETTEMAPPED (1) /* Palette mapped icon (chunky, V44+) */
#define IDFMT_DIRECTMAPPED (2) /* Direct mapped icon (truecolor 0xAARRGGBB, V51+) */
+/* Object types */
+enum {
+ ASOT_PORT = 1,
+ ASOT_IOREQUEST
+};
+
+/* Requester types */
+enum {
+ TDRIMAGE_ERROR = 1,
+ TDRIMAGE_WARNING
+};
+
/* Functions */
/* DOS */
int64 GetFileSize(BPTR fh);
+void FreeSysObject(ULONG type, APTR obj);
/* Exec */
struct Node *GetHead(struct List *list);
+/* Intuition */
+uint32 GetAttrs(Object *obj, Tag tag1, ...);
+ULONG RefreshSetGadgetAttrs(struct Gadget *g, struct Window *w, struct Requester *r, Tag tag1, ...);
+ULONG RefreshSetGadgetAttrsA(struct Gadget *g, struct Window *w, struct Requester *r, struct TagItem *tags);
+
/* Utility */
char *ASPrintf(const char *fmt, ...);
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 855d10497..eaf775183 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -16,7 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
+#ifdef __amigaos4__
#include <proto/Picasso96API.h>
+#endif
#include <proto/exec.h>
#include <proto/intuition.h>
@@ -46,7 +50,9 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
+#ifdef __amigaos4__
static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct BackFillMessage *bfmsg);
+#endif
struct bfbitmap {
struct BitMap *bm;
@@ -114,7 +120,9 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
} else {
palette_mapped = false;
}
-
+#ifndef __amigaos4__
+ palette_mapped = true; /* only supporting palette mapped screens on OS3 for now */
+#endif
if(!width) width = nsoption_int(redraw_tile_size_x);
if(!height) height = nsoption_int(redraw_tile_size_y);
@@ -138,7 +146,6 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
InitRastPort(gg->rp);
gg->rp->BitMap = gg->bm;
- /* Is all this safe to do to an existing window RastPort? */
SetDrMd(gg->rp,BGBACKFILL);
gg->rp->Layer = CreateUpfrontLayer(gg->layerinfo,gg->rp->BitMap,0,0,
@@ -232,9 +239,11 @@ void ami_plot_release_pens(struct MinList *shared_pens)
static void ami_plot_setapen(ULONG colr)
{
if(palette_mapped == false) {
+#ifdef __amigaos4__
SetRPAttrs(glob->rp, RPTAG_APenColor,
ns_color_to_nscss(colr),
TAG_DONE);
+#endif
} else {
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetAPen(glob->rp, pen);
@@ -244,9 +253,11 @@ static void ami_plot_setapen(ULONG colr)
static void ami_plot_setopen(ULONG colr)
{
if(palette_mapped == false) {
+#ifdef __amigaos4__
SetRPAttrs(glob->rp, RPTAG_OPenColor,
ns_color_to_nscss(colr),
TAG_DONE);
+#endif
} else {
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetOPen(glob->rp, pen);
@@ -521,7 +532,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
if((tag_data = (ULONG)ami_bitmap_get_mask(bitmap, width, height, tbm)))
minterm = (ABC|ABNC|ANBC);
}
-
+#ifdef __amigaos4__
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
@@ -533,6 +544,10 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
BLITA_Minterm, minterm,
tag, tag_data,
TAG_DONE);
+#else
+ /* Assume mask is always required */
+ BltMaskBitMapRastPort(tbm, 0, 0, glob->rp, x, y, width, height, tag_data, minterm);
+#endif
}
if((bitmap->dto == NULL) && (tbm != bitmap->nativebm))
@@ -562,7 +577,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if(!(repeat_x || repeat_y))
return ami_bitmap(x, y, width, height, bitmap);
-
+#ifdef __amigaos4__
/* If it is a one pixel transparent image, we are wasting our time */
if((bitmap->opaque == false) && (bitmap->width == 1) && (bitmap->height == 1))
return true;
@@ -641,10 +656,13 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
{
p96FreeBitMap(tbm);
}
-
+#else
+#warning FIXME: bitmap tiling uses backfill hooks
+#endif
return true;
}
+#ifdef __amigaos4__
static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct BackFillMessage *bfmsg)
{
int xf,yf;
@@ -700,6 +718,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba
}
}
}
+#endif
bool ami_group_start(const char *name)
{
diff --git a/amiga/plugin_hack.c b/amiga/plugin_hack.c
index 7982a6734..23f4d3454 100644
--- a/amiga/plugin_hack.c
+++ b/amiga/plugin_hack.c
@@ -17,9 +17,11 @@
*/
/** \file
- * DataTypes picture handler (implementation)
+ * Plugin=>external program handler (implementation)
*/
+#include "amiga/os3support.h"
+
#include "amiga/filetype.h"
#include "amiga/plugin_hack.h"
#include "content/content_protected.h"
@@ -250,6 +252,7 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c)
if(full_cmd)
{
+#ifdef __amigaos4__
LOG(("Attempting to execute %s", full_cmd));
in = Open("NIL:", MODE_OLDFILE);
@@ -264,5 +267,6 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c)
TAG_DONE);
FreeVec(full_cmd);
+#endif
}
}
diff --git a/amiga/print.c b/amiga/print.c
index 862e598c7..5c89705d3 100644
--- a/amiga/print.c
+++ b/amiga/print.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include <proto/utility.h>
#include <proto/iffparse.h>
#include <proto/dos.h>
@@ -53,6 +55,7 @@
#include "amiga/plotters.h"
#include "amiga/gui.h"
+#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
@@ -217,11 +220,11 @@ void ami_print_ui(struct hlcache_handle *c)
char filename[30];
int i;
- struct ami_print_window *pw = AllocVecTags(sizeof(struct ami_print_window), AVT_ClearWithValue, 0, TAG_DONE);
+ struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0);
pw->c = c;
- printers[0] = AllocVecTags(50, AVT_ClearWithValue, 0, TAG_DONE);
+ printers[0] = ami_misc_allocvec_clear(50, 0);
ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0);
strcpy(filename,"ENV:Sys/printerN.prefs");
@@ -385,13 +388,18 @@ void ami_print(struct hlcache_handle *c, int copies)
if(ami_print_info.msgport == NULL)
ami_print_init();
-
+#ifdef __amigaos4__
if(!(ami_print_info.PReq =
(struct IODRPTagsReq *)AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size, sizeof(struct IODRPTagsReq),
ASOIOR_ReplyPort, ami_print_info.msgport,
ASO_NoTrack, FALSE,
TAG_DONE))) return;
+#else
+ if(!(ami_print_info.PReq =
+ (struct IODRPTagsReq *)CreateIORequest(ami_print_info.msgport,
+ sizeof(struct IODRPTagsReq)))) return;
+#endif
if(OpenDevice("printer.device", nsoption_int(printer_unit),
(struct IORequest *)ami_print_info.PReq, 0))
@@ -467,7 +475,7 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = AllocVecTags(sizeof(struct gui_globals), AVT_ClearWithValue, 0, TAG_DONE);
+ ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
if(!ami_print_info.gg) return false;
ami_init_layers(ami_print_info.gg,
diff --git a/amiga/schedule.c b/amiga/schedule.c
index 93389a8d9..494b8b027 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -297,18 +297,22 @@ static struct MsgPort *ami_schedule_open_timer(struct MsgPort *msgport)
ASO_NoTrack, FALSE,
TAG_DONE);
}
-
+#ifdef __amigaos4__
tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size,sizeof(struct TimeRequest),
ASOIOR_ReplyPort,msgport,
ASO_NoTrack,FALSE,
TAG_DONE);
+#else
+ tioreq = (struct TimeRequest *)CreateIORequest(msgport, sizeof(struct TimeRequest));
+#endif
OpenDevice("timer.device", UNIT_WAITUNTIL, (struct IORequest *)tioreq, 0);
TimerBase = (struct Device *)tioreq->Request.io_Device;
+#ifdef __amigaos4__
ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase, "main", 1, NULL);
-
+#endif
return msgport;
}
diff --git a/amiga/search.c b/amiga/search.c
index ac061cbc3..ab32abbdf 100755
--- a/amiga/search.c
+++ b/amiga/search.c
@@ -103,7 +103,7 @@ void ami_search_open(struct gui_window *gwin)
return;
}
- fwin = AllocVecTags(sizeof(struct find_window), AVT_ClearWithValue, 0, TAG_DONE);
+ fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0);
fwin->objects[OID_MAIN] = WindowObject,
WA_ScreenTitle, ami_gui_get_screen_title(),
diff --git a/amiga/stringview/stringview.c b/amiga/stringview/stringview.c
index daabe58e0..a009f228a 100755
--- a/amiga/stringview/stringview.c
+++ b/amiga/stringview/stringview.c
@@ -667,7 +667,7 @@ static uint32 myStringClass_GM_HandleInput( Class *cl, Object *obj, struct gpInp
myStringHandleListview( cl, obj );
break;
}
-
+#ifdef __amigaos4__
case IECLASS_MOUSEWHEEL:
{
struct InputEvent *ie = msg->gpi_IEvent;
@@ -686,7 +686,7 @@ static uint32 myStringClass_GM_HandleInput( Class *cl, Object *obj, struct gpInp
retval = GMR_MEACTIVE;
break;
}
-
+#endif
default:
{
retval = IDoSuperMethodA( cl, obj, (APTR)msg );
diff --git a/amiga/stringview/urlhistory.c b/amiga/stringview/urlhistory.c
index 6d134a4a5..d55a4b4b6 100644
--- a/amiga/stringview/urlhistory.c
+++ b/amiga/stringview/urlhistory.c
@@ -33,6 +33,12 @@
static struct List PageList;
+#ifdef __amigaos4__
+#define ALLOCVEC_SHARED(N) AllocVecTags((N), AVT_Type, MEMF_SHARED, TAG_DONE);
+#else
+#define ALLOCVEC_SHARED(N) AllocVec((N), MEMF_SHARED);
+#endif
+
void URLHistory_Init( void )
{
// Initialise page list
@@ -79,17 +85,11 @@ static bool URLHistoryFound(nsurl *url, const struct url_data *data)
/* skip this URL if it is already in the list */
if(URLHistory_FindPage(nsurl_access(url))) return true;
- node = AllocVecTags(sizeof(struct Node),
- AVT_Type, MEMF_SHARED,
- //AVT_ClearWithValue, 0,
- TAG_DONE);
+ node = ALLOCVEC_SHARED(sizeof(struct Node));
if ( node )
{
- STRPTR urladd = (STRPTR) AllocVecTags( strlen ( nsurl_access(url) ) + 1,
- AVT_Type, MEMF_SHARED,
- //AVT_ClearWithValue, 0,
- TAG_DONE);
+ STRPTR urladd = (STRPTR) ALLOCVEC_SHARED( strlen ( nsurl_access(url) ) + 1);
if ( urladd )
{
diff --git a/amiga/theme.c b/amiga/theme.c
index b7099e897..b75f6ed5c 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include <string.h>
#include <proto/clicktab.h>
@@ -99,6 +101,7 @@ const char *ptrs32[AMI_LASTPOINTER+1] = {
"ptr32_blank",
"ptr32_drag"};
+#ifdef __amigaos4__
/* Mapping from NetSurf to AmigaOS mouse pointers */
int osmouseptr[AMI_LASTPOINTER+1] = {
POINTERTYPE_NORMAL,
@@ -122,7 +125,7 @@ int osmouseptr[AMI_LASTPOINTER+1] = {
POINTERTYPE_PROGRESS,
POINTERTYPE_NONE,
POINTERTYPE_DRAGANDDROP};
-
+#endif
void ami_theme_init(void)
{
@@ -218,13 +221,15 @@ void ami_update_pointer(struct Window *win, gui_pointer_shape shape)
if(drag_save_data) return;
if(LIB_IS_AT_LEAST((struct Library *)IntuitionBase, 53, 42)) {
+#ifdef __amigaos4__
BOOL ptr_delay = FALSE;
if(shape == GUI_POINTER_WAIT) ptr_delay = TRUE;
SetWindowPointer(win,
WA_PointerType, osmouseptr[shape],
WA_PointerDelay, ptr_delay,
- TAG_DONE);
+ TAG_DONE);
+#endif
} else {
if(nsoption_bool(os_mouse_pointers))
{
@@ -408,12 +413,14 @@ void gui_window_start_throbber(struct gui_window *g)
if(!g) return;
if(nsoption_bool(kiosk_mode)) return;
+#ifdef __amigaos4__
if(g->tab_node && (g->shared->tabs > 1))
{
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, TRUE, TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_TABS],
g->shared->win, NULL);
}
+#endif
g->throbbing = true;
if(g->shared->throbber_frame == 0) g->shared->throbber_frame = 1;
@@ -427,12 +434,14 @@ void gui_window_stop_throbber(struct gui_window *g)
if(!g) return;
if(nsoption_bool(kiosk_mode)) return;
+#ifdef __amigaos4__
if(g->tab_node && (g->shared->tabs > 1))
{
SetClickTabNodeAttrs(g->tab_node, TNA_Flagged, FALSE, TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_TABS],
g->shared->win, NULL);
}
+#endif
if(g == g->shared->gw) {
if(ami_gui_get_space_box(g->shared->objects[GID_THROBBER], &bbox) != NSERROR_OK) {
@@ -471,7 +480,7 @@ static void ami_throbber_update(void *p)
warn_user("NoMemory", "");
return;
}
-
+#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcX, throbber_width * frame,
BLITA_SrcY, 0,
BLITA_DestX, bbox->Left,
@@ -484,7 +493,10 @@ static void ami_throbber_update(void *p)
BLITA_DestType, BLITT_RASTPORT,
// BLITA_UseSrcAlpha, TRUE,
TAG_DONE);
-
+#else
+ BltBitMapRastPort(throbber, throbber_width * frame, 0, g->shared->win->RPort,
+ bbox->Left, bbox->Top, throbber_width, throbber_height, 0xC0);
+#endif
ami_gui_free_space_box(bbox);
}
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index ea681d269..5333b4ce1 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -16,8 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "amiga/os3support.h"
+
#include <proto/graphics.h>
+#ifdef __amigaos4__
#include <proto/Picasso96API.h>
+#endif
#include <intuition/intuition.h>
#ifdef __amigaos4__
#include <graphics/blitattr.h>
diff --git a/amiga/tree.c b/amiga/tree.c
index e44c821e0..1785a9d28 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -42,7 +42,9 @@
#include <gadgets/scroller.h>
#include <reaction/reaction_macros.h>
#include <intuition/icclass.h>
+#ifdef __amigaos4__
#include <graphics/blitattr.h>
+#endif
#include <assert.h>
#include <string.h>
@@ -62,6 +64,7 @@
#include "amiga/gui.h"
#include "amiga/tree.h"
#include "amiga/file.h"
+#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
#include "amiga/drag.h" /* drag icon stuff */
@@ -315,7 +318,7 @@ static void ami_tree_redraw_req(void *p)
tree_draw(twin->tree, - tile_x, - tile_y,
tile_x, tile_y, tile_w, tile_h, &ctx);
-
+#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
BLITA_Source, twin->globals.bm,
BLITA_SrcX, 0,
@@ -327,6 +330,11 @@ static void ami_tree_redraw_req(void *p)
BLITA_Width, tile_w,
BLITA_Height, tile_h,
TAG_DONE);
+#else
+ BltBitMapRastPort(twin->globals.bm, 0, 0,
+ twin->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y,
+ tile_w, tile_h, 0xC0);
+#endif
}
}
@@ -534,7 +542,7 @@ static void ami_tree_scroller_hook(struct Hook *hook,Object *object,struct Intui
break;
}
break;
-
+#ifdef __amigaos4__
case IDCMP_EXTENDEDMOUSE:
if(msg->Code == IMSGCODE_INTUIWHEELDATA)
{
@@ -543,6 +551,7 @@ static void ami_tree_scroller_hook(struct Hook *hook,Object *object,struct Intui
ami_tree_scroll(twin, (wheel->WheelX * 20), (wheel->WheelY * 20));
}
break;
+#endif
}
}
@@ -550,9 +559,7 @@ static void ami_tree_menu(struct treeview_window *twin)
{
if(twin->menu) return;
- if((twin->menu = AllocVecTags(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS,
- AVT_ClearWithValue, 0, TAG_DONE)))
- {
+ if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
twin->menu[0].nm_Type = NM_TITLE;
twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
twin->menu[0].nm_Label = twin->menu_name[0];
@@ -902,9 +909,11 @@ void ami_tree_close(struct treeview_window *twin)
static void ami_tree_update_quals(struct treeview_window *twin)
{
uint32 quals = 0;
-
+#ifdef __amigaos4__
GetAttr(WINDOW_Qualifier, twin->objects[OID_MAIN], (uint32 *)&quals);
-
+#else
+#warning FIXME not reading qualifiers on OS3
+#endif
twin->key_state = 0;
if((quals & IEQUALIFIER_LSHIFT) || (quals & IEQUALIFIER_RSHIFT))
@@ -976,7 +985,9 @@ BOOL ami_tree_event(struct treeview_window *twin)
if((twin->type != AMI_TREE_SSLCERT) &&
(twin->rmbtrapped == FALSE))
{
+#ifdef __amigaos4__
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)TRUE, sizeof(BOOL));
+#endif
twin->rmbtrapped = TRUE;
}
}
@@ -984,7 +995,9 @@ BOOL ami_tree_event(struct treeview_window *twin)
{
if(twin->rmbtrapped == TRUE)
{
+#ifdef __amigaos4__
SetWindowAttr(twin->win, WA_RMBTrap, (APTR)(BOOL)FALSE, sizeof(BOOL));
+#endif
twin->rmbtrapped = FALSE;
}
}
@@ -1459,7 +1472,7 @@ struct treeview_window *ami_tree_create(int flags,
{
struct treeview_window *twin;
- twin = AllocVecTags(sizeof(struct treeview_window), AVT_ClearWithValue, 0, TAG_DONE);
+ twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
if(!twin)
{
diff --git a/utils/log.c b/utils/log.c
index 8ec42c1f7..0be8ea264 100644
--- a/utils/log.c
+++ b/utils/log.c
@@ -70,12 +70,12 @@ timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating y. */
if (x->tv_usec < y->tv_usec) {
- int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
+ int nsec = (int)(y->tv_usec - x->tv_usec) / 1000000 + 1;
y->tv_usec -= 1000000 * nsec;
y->tv_sec += nsec;
}
- if (x->tv_usec - y->tv_usec > 1000000) {
- int nsec = (x->tv_usec - y->tv_usec) / 1000000;
+ if ((int)(x->tv_usec - y->tv_usec) > 1000000) {
+ int nsec = (int)(x->tv_usec - y->tv_usec) / 1000000;
y->tv_usec += 1000000 * nsec;
y->tv_sec -= nsec;
}