summaryrefslogtreecommitdiff
path: root/frontends/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/amiga')
-rw-r--r--frontends/amiga/Makefile8
-rw-r--r--frontends/amiga/Makefile.defaults1
-rw-r--r--frontends/amiga/Makefile.tools21
-rw-r--r--frontends/amiga/bitmap.c75
-rwxr-xr-xfrontends/amiga/bitmap.h16
-rw-r--r--frontends/amiga/clipboard.c1
-rw-r--r--frontends/amiga/cookies.c10
-rw-r--r--frontends/amiga/cookies.h2
-rw-r--r--frontends/amiga/corewindow.c14
-rw-r--r--frontends/amiga/corewindow.h5
-rw-r--r--frontends/amiga/dist/Rexx/YT_download_page.nsrx21
-rw-r--r--frontends/amiga/dist/Rexx/YT_open.nsrx21
-rw-r--r--frontends/amiga/dist/Rexx/YT_play.nsrx19
-rw-r--r--frontends/amiga/dt_anim.c16
-rw-r--r--frontends/amiga/dt_picture.c7
-rw-r--r--frontends/amiga/dt_sound.c9
-rw-r--r--frontends/amiga/file.c3
-rw-r--r--frontends/amiga/font_bullet.c12
-rw-r--r--frontends/amiga/font_diskfont.c16
-rw-r--r--frontends/amiga/gui.c415
-rw-r--r--frontends/amiga/gui_menu.c33
-rw-r--r--frontends/amiga/gui_menu.h5
-rwxr-xr-xfrontends/amiga/gui_options.c100
-rw-r--r--frontends/amiga/history.c2
-rw-r--r--frontends/amiga/history_local.c3
-rw-r--r--frontends/amiga/hotlist.c2
-rw-r--r--frontends/amiga/icon.c17
-rw-r--r--frontends/amiga/iff_dr2d.c4
-rw-r--r--frontends/amiga/libs.c11
-rw-r--r--frontends/amiga/options.h16
-rw-r--r--frontends/amiga/os3support.c7
-rw-r--r--frontends/amiga/os3support.h5
-rw-r--r--frontends/amiga/pageinfo.c282
-rw-r--r--frontends/amiga/pageinfo.h (renamed from frontends/amiga/sslcert.h)23
-rw-r--r--frontends/amiga/pkg/SearchEngines2
-rwxr-xr-xfrontends/amiga/pkg/netsurf.readme4
-rw-r--r--frontends/amiga/pkg/netsurf_os3.readme10
-rw-r--r--frontends/amiga/plotters.c47
-rw-r--r--frontends/amiga/plugin_hack.c13
-rwxr-xr-xfrontends/amiga/resources/Themes/AISS/Theme5
-rwxr-xr-xfrontends/amiga/resources/Themes/Default/Theme5
-rw-r--r--frontends/amiga/rtg.c3
-rw-r--r--frontends/amiga/sslcert.c376
-rwxr-xr-xfrontends/amiga/stringview/stringview.c4
-rwxr-xr-xfrontends/amiga/utf8.c70
-rw-r--r--frontends/amiga/version.c2
46 files changed, 1008 insertions, 735 deletions
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index a88fc1d53..f537a1163 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -12,7 +12,7 @@ endif
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
-$(eval $(call feature_enabled,AMISSL,-DWITH_AMISSL -D__NO_NET_API -D__NO_NETINCLUDE_ERRNO -I$(GCCSDK_INSTALL_ENV)/netinclude,-lamisslauto,AmiSSL))
+$(eval $(call feature_enabled,AMISSL,-DWITH_AMISSL -DWITH_OPENSSL -D__NO_NET_API -D__NO_NETINCLUDE_ERRNO -I$(GCCSDK_INSTALL_ENV)/netinclude,-lamisslauto,AmiSSL))
CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include
CFLAGS += $(shell $(PKG_CONFIG) --cflags tre)
@@ -48,12 +48,12 @@ S_FRONTEND := gui.c history.c hotlist.c schedule.c file.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
- sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \
+ gui_options.c print.c theme.c drag.c icon.c libs.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c rtg.c \
agclass/amigaguide_class.c os3support.c font_diskfont.c \
selectmenu.c hash/xxhash.c font_cache.c font_bullet.c \
- nsoption.c corewindow.c gui_menu.c
+ nsoption.c corewindow.c gui_menu.c pageinfo.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
@@ -80,7 +80,7 @@ AMIGA_DISTRIBUTION_FILES := $(FRONTEND_SOURCE_DIR)/dist/*
AMIGA_PKG_DIR := $(FRONTEND_SOURCE_DIR)/pkg
AMIGA_INSTALL_TARGET_DIR := NetSurf_Amiga
-netsurf.lha: $(EXETARGET)
+netsurf.lha: $(EXETARGET) $(POSTEXES)
$(VQ)echo Creating netsurf.lha
$(Q)rm -rf $(AMIGA_INSTALL_TARGET_DIR)
$(Q)$(MKDIR) -p $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
diff --git a/frontends/amiga/Makefile.defaults b/frontends/amiga/Makefile.defaults
index 7fcbef0fe..25e1f42e4 100644
--- a/frontends/amiga/Makefile.defaults
+++ b/frontends/amiga/Makefile.defaults
@@ -40,6 +40,7 @@ CFLAGS += -fomit-frame-pointer
ifeq ($(SUBTARGET),os3)
NETSURF_USE_OPENSSL := NO
NETSURF_USE_AMISSL := YES
+ NETSURF_FS_BACKING_STORE := YES
else
CFLAGS += -gstabs
endif
diff --git a/frontends/amiga/Makefile.tools b/frontends/amiga/Makefile.tools
new file mode 100644
index 000000000..c16928783
--- /dev/null
+++ b/frontends/amiga/Makefile.tools
@@ -0,0 +1,21 @@
+# -*- mode: makefile-gmake -*-
+##
+## amiga target tool setup
+##
+
+ifeq ($(findstring amiga,$(HOST)),amiga)
+ # building for amiga on amiga
+ PKG_CONFIG := pkg-config
+else
+ ifeq ($(SUBTARGET),os3)
+ GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-unknown-amigaos/env
+ GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-unknown-amigaos/cross/bin
+ else
+ GCCSDK_INSTALL_ENV ?= /opt/netsurf/ppc-amigaos/env
+ GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/ppc-amigaos/cross/bin
+ endif
+
+ CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+ PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
+endif
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index e160f9351..e8534a395 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -108,7 +108,7 @@ static APTR pool_bitmap = NULL;
static bool guigfx_warned = false;
/* exported function documented in amiga/bitmap.h */
-void *amiga_bitmap_create(int width, int height, unsigned int state)
+void *amiga_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
{
struct bitmap *bitmap;
@@ -139,8 +139,7 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
bitmap->width = width;
bitmap->height = height;
- if(state & BITMAP_OPAQUE) bitmap->opaque = true;
- else bitmap->opaque = false;
+ bitmap->opaque = (flags & BITMAP_OPAQUE) == BITMAP_OPAQUE;
bitmap->nativebm = NULL;
bitmap->nativebmwidth = 0;
@@ -307,25 +306,6 @@ void amiga_bitmap_set_opaque(void *bitmap, bool opaque)
/* exported function documented in amiga/bitmap.h */
-bool amiga_bitmap_test_opaque(void *bitmap)
-{
- struct bitmap *bm = bitmap;
- uint32 p = bm->width * bm->height;
- uint32 a = 0;
- uint32 *bmi = (uint32 *)amiga_bitmap_get_buffer(bm);
-
- assert(bitmap);
-
- for(a=0;a<p;a+=4)
- {
- if ((*bmi & 0x000000ffU) != 0x000000ffU) return false;
- bmi++;
- }
- return true;
-}
-
-
-/* exported function documented in amiga/bitmap.h */
bool amiga_bitmap_get_opaque(void *bitmap)
{
struct bitmap *bm = bitmap;
@@ -367,40 +347,6 @@ int bitmap_get_height(void *bitmap)
}
}
-
-/**
- * Find the bytes per pixel of a bitmap
- *
- * \param vbitmap a bitmap, as returned by bitmap_create()
- * \return bytes per pixel
- */
-static size_t bitmap_get_bpp(void *vbitmap)
-{
- struct bitmap *bitmap = (struct bitmap *)vbitmap;
- assert(bitmap);
- return 4;
-}
-
-static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] << 8) | (data[i] >> 24);
- }
-}
-
-static void ami_bitmap_rgba_to_argb(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[ i] >> 8) | (data[i] << 24);
- }
-}
-
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -436,7 +382,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
{
bmhd->bmh_Width = (UWORD)bitmap_get_width(bitmap);
bmhd->bmh_Height = (UWORD)bitmap_get_height(bitmap);
- bmhd->bmh_Depth = (UBYTE)bitmap_get_bpp(bitmap) * 8;
+ bmhd->bmh_Depth = (UBYTE)32;
if(!amiga_bitmap_get_opaque(bitmap)) bmhd->bmh_Masking = mskHasAlpha;
}
@@ -450,7 +396,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
TAG_DONE);
IDoMethod(dto, PDTM_WRITEPIXELARRAY, amiga_bitmap_get_buffer(bitmap),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bitmap), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bitmap), 0, 0,
bitmap_get_width(bitmap), bitmap_get_height(bitmap));
}
@@ -475,10 +421,10 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
bm = amiga_bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
IDoMethod(dto, PDTM_READPIXELARRAY, amiga_bitmap_get_buffer(bm),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bm), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
- amiga_bitmap_set_opaque(bm, amiga_bitmap_test_opaque(bm));
+ amiga_bitmap_set_opaque(bm, bitmap_test_opaque(bm));
}
DisposeDTObject(dto);
}
@@ -531,7 +477,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
dithermode = DITHERMODE_FS;
}
- ami_bitmap_rgba_to_argb(bitmap);
bitmap->drawhandle = ObtainDrawHandle(
NULL,
&rp,
@@ -548,7 +493,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
ReleaseDrawHandle(bitmap->drawhandle);
bitmap->drawhandle = NULL;
}
- ami_bitmap_argb_to_rgba(bitmap);
} else {
if(guigfx_warned == false) {
amiga_warn_user("BMConvErr", NULL);
@@ -698,7 +642,7 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
for(y=0; y<height; y++) {
for(x=0; x<width; x++) {
- if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
+ if ((*bmi & 0xff000000U) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
else maskbit = 1;
bmi++;
bitmap->native_mask[(y*bpr) + (x/8)] |=
@@ -775,8 +719,6 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
BLITA_DestY, 0,
TAG_DONE);
- ami_bitmap_argb_to_rgba(bitmap);
-
/**\todo In theory we should be able to move the bitmap to our native area
to try to avoid re-conversion (at the expense of memory) */
@@ -824,13 +766,10 @@ static struct gui_bitmap_table bitmap_table = {
.destroy = amiga_bitmap_destroy,
.set_opaque = amiga_bitmap_set_opaque,
.get_opaque = amiga_bitmap_get_opaque,
- .test_opaque = amiga_bitmap_test_opaque,
.get_buffer = amiga_bitmap_get_buffer,
.get_rowstride = amiga_bitmap_get_rowstride,
.get_width = bitmap_get_width,
.get_height = bitmap_get_height,
- .get_bpp = bitmap_get_bpp,
- .save = amiga_bitmap_save,
.modified = amiga_bitmap_modified,
.render = bitmap_render,
};
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index aaec26ac2..a7dc9198f 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -25,7 +25,9 @@
#include <intuition/classusr.h>
#include <libraries/Picasso96.h>
-#define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8
+#include "netsurf/bitmap.h"
+
+#define AMI_BITMAP_FORMAT RGBFB_A8R8G8B8
#define AMI_BITMAP_SCALE_ICON 0xFF
extern struct gui_bitmap_table *amiga_bitmap_table;
@@ -101,10 +103,10 @@ void ami_bitmap_fini(void);
*
* \param width width of image in pixels
* \param height width of image in pixels
- * \param state a flag word indicating the initial state
+ * \param flags flags for bitmap creation
* \return an opaque struct bitmap, or NULL on memory exhaustion
*/
-void *amiga_bitmap_create(int width, int height, unsigned int state);
+void *amiga_bitmap_create(int width, int height, enum gui_bitmap_flags flags);
/**
* Return a pointer to the pixel data in a bitmap.
@@ -174,14 +176,6 @@ void amiga_bitmap_modified(void *bitmap);
void amiga_bitmap_set_opaque(void *bitmap, bool opaque);
/**
- * Tests whether a bitmap has an opaque alpha channel
- *
- * \param bitmap a bitmap, as returned by bitmap_create()
- * \return whether the bitmap is opaque
- */
-bool amiga_bitmap_test_opaque(void *bitmap);
-
-/**
* Gets whether a bitmap should be plotted opaque
*
* \param bitmap a bitmap, as returned by bitmap_create()
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 00dba2d50..05a83606e 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -17,6 +17,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <proto/iffparse.h>
#include <proto/intuition.h>
#include <proto/exec.h>
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
index 5d46a3a57..441e4003f 100644
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -345,7 +345,7 @@ ami_cookies_create_window(struct ami_cookie_window *cookie_win)
}
/* exported interface documented in amiga/cookies.h */
-nserror ami_cookies_present(void)
+nserror ami_cookies_present(const char *search_term)
{
struct ami_cookie_window *ncwin;
nserror res;
@@ -385,7 +385,7 @@ nserror ami_cookies_present(void)
return res;
}
- res = cookie_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ res = cookie_manager_init((struct core_window *)ncwin);
if (res != NSERROR_OK) {
ami_utf8_free(ncwin->core.wintitle);
DisposeObject(ncwin->core.objects[GID_CW_WIN]);
@@ -395,6 +395,10 @@ nserror ami_cookies_present(void)
cookie_window = ncwin;
- return NSERROR_OK;
+ if (search_term != NULL) {
+ res = cookie_manager_set_search_string(search_term);
+ }
+
+ return res;
}
diff --git a/frontends/amiga/cookies.h b/frontends/amiga/cookies.h
index 6858e4cab..6eb525cbe 100644
--- a/frontends/amiga/cookies.h
+++ b/frontends/amiga/cookies.h
@@ -20,6 +20,6 @@
#define AMIGA_COOKIES_H
/** Open the cookie viewer */
-nserror ami_cookies_present(void);
+nserror ami_cookies_present(const char *search_term);
#endif
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 44798d24b..5fb77d2f9 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -826,7 +826,8 @@ ami_cw_invalidate_area(struct core_window *cw, const struct rect *r)
static nserror
-ami_cw_get_window_dimensions(struct core_window *cw, int *width, int *height)
+ami_cw_get_window_dimensions(const struct core_window *cw,
+ int *width, int *height)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
@@ -867,7 +868,7 @@ ami_cw_update_size(struct core_window *cw, int width, int height)
static nserror
-ami_cw_get_scroll(struct core_window *cw, int *x, int *y)
+ami_cw_get_scroll(const struct core_window *cw, int *x, int *y)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
ULONG win_x0, win_y0;
@@ -912,20 +913,21 @@ ami_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
}
-struct core_window_callback_table ami_cw_cb_table = {
+struct core_window_table ami_cw_cb_table = {
.invalidate = ami_cw_invalidate_area,
- .update_size = ami_cw_update_size,
+ .set_extent = ami_cw_update_size,
.set_scroll = ami_cw_set_scroll,
.get_scroll = ami_cw_get_scroll,
- .get_window_dimensions = ami_cw_get_window_dimensions,
+ .get_dimensions = ami_cw_get_window_dimensions,
.drag_status = ami_cw_drag_status
};
+struct core_window_table *amiga_core_window_table = &ami_cw_cb_table;
+
/* exported function documented example/corewindow.h */
nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
{
/* setup the core window callback table */
- ami_cw->cb_table = &ami_cw_cb_table;
ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* clear some vars */
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index ea01f67f1..421397984 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -24,6 +24,8 @@
#include "amiga/gui.h" /* need to know the size of ami_generic_window :( */
#include "amiga/plotters.h"
+extern struct core_window_table *amiga_core_window_table;
+
/**
* BOOPSI objects
*/
@@ -82,9 +84,6 @@ struct ami_corewindow {
/** drag status set by core */
core_window_drag_status drag_status;
- /** table of callbacks for core window operations */
- struct core_window_callback_table *cb_table;
-
/**
* callback to draw on drawable area of Amiga core window
*
diff --git a/frontends/amiga/dist/Rexx/YT_download_page.nsrx b/frontends/amiga/dist/Rexx/YT_download_page.nsrx
new file mode 100644
index 000000000..fdc06923d
--- /dev/null
+++ b/frontends/amiga/dist/Rexx/YT_download_page.nsrx
@@ -0,0 +1,21 @@
+/* YT play.nsrx by Chris Handley
+ This script shows download links for a YouTube video using YT (OS4Depot:video/misc/yt.lha)
+*/
+
+options results
+
+if ~open('yt','AppDir:YT','R') then do
+ GETSCREENNAME
+ address command 'requestchoice >NIL: "NetSurf" "YT must be installed for this script to function.*n*nIt can be downloaded from OS4Depot:video/misc/yt" "OK" PubScreen='||result
+ OPEN 'http://os4depot.net/?function=showfile&file=video/misc/yt.lha' NEWTAB ACTIVE /* This doesn't work due to a NetSurf(?) bug */
+ exit
+end
+close('yt')
+
+GETURL
+/*address command 'requestchoice >NIL: "TEST" "'||result||'" "OK"'*/
+address command 'AppDir:YT <>CON:0/30/640/256/YT/AUTO/CLOSE "'||result||'" html silent'
+
+/* Hack to activate the newest tab */
+OPEN 'file:///RAM:' NEWTAB ACTIVE
+CLOSE
diff --git a/frontends/amiga/dist/Rexx/YT_open.nsrx b/frontends/amiga/dist/Rexx/YT_open.nsrx
new file mode 100644
index 000000000..4454f0c29
--- /dev/null
+++ b/frontends/amiga/dist/Rexx/YT_open.nsrx
@@ -0,0 +1,21 @@
+/* YT play.nsrx by Chris Handley
+ This script opens a YouTube video using YT (OS4Depot:video/misc/yt.lha)
+*/
+
+options results
+
+if ~open('yt','AppDir:YT','R') then do
+ GETSCREENNAME
+ address command 'requestchoice >NIL: "NetSurf" "YT must be installed for this script to function.*n*nIt can be downloaded from OS4Depot:video/misc/yt" "OK" PubScreen='||result
+ OPEN 'http://os4depot.net/?function=showfile&file=video/misc/yt.lha' NEWTAB ACTIVE /* This doesn't work due to a NetSurf(?) bug */
+ exit
+end
+close('yt')
+
+address COMMAND 'Run >NIL: RequestChoice Title="NetSurf" BODY="When finished with YT, click OK to return to NetSurf" GADGETS="OK" INACTIVE >NIL:' /* Hack to get Workbench to front */
+
+GETURL
+/*address command 'requestchoice >NIL: "TEST" "'||result||'" "OK"'*/
+address command 'AppDir:YT <>CON:0/30/640/256/YT/AUTO/CLOSE "'||result||'"'
+
+/*TOBACK*/ /* ideally we'd bring Workbench to front */
diff --git a/frontends/amiga/dist/Rexx/YT_play.nsrx b/frontends/amiga/dist/Rexx/YT_play.nsrx
new file mode 100644
index 000000000..a8e29162f
--- /dev/null
+++ b/frontends/amiga/dist/Rexx/YT_play.nsrx
@@ -0,0 +1,19 @@
+/* YT play.nsrx by Chris Handley
+ This script auto-plays a YouTube video using YT (OS4Depot:video/misc/yt.lha)
+*/
+
+options results
+
+if ~open('yt','AppDir:YT','R') then do
+ GETSCREENNAME
+ address command 'requestchoice >NIL: "NetSurf" "YT must be installed for this script to function.*n*nIt can be downloaded from OS4Depot:video/misc/yt" "OK" PubScreen='||result
+ OPEN 'http://os4depot.net/?function=showfile&file=video/misc/yt.lha' NEWTAB ACTIVE /* This doesn't work due to a NetSurf(?) bug */
+ exit
+end
+close('yt')
+
+GETURL
+/*address command 'requestchoice >NIL: "TEST" "'||result||'" "OK"'*/
+address command 'AppDir:YT <>CON:0/30/640/256/YT/AUTO/CLOSE "'||result||'" AutoPlay'
+
+/*TOBACK*/ /* ideally we'd bring Workbench to front */
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 70f7e6ba6..1162d7214 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -40,7 +40,9 @@
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "content/llcache.h"
#include "amiga/bitmap.h"
@@ -72,9 +74,9 @@ static void amiga_dt_anim_destroy(struct content *c);
static bool amiga_dt_anim_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
-static void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
+static nserror amiga_dt_anim_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params);
-static void amiga_dt_anim_close(struct content *c);
+static nserror amiga_dt_anim_close(struct content *c);
static nserror amiga_dt_anim_clone(const struct content *old, struct content **newc);
static content_type amiga_dt_anim_content_type(void);
@@ -171,7 +173,7 @@ bool amiga_dt_anim_convert(struct content *c)
size_t size;
UBYTE *bm_buffer;
struct BitMapHeader *bmh;
- unsigned int bm_flags = BITMAP_NEW | BITMAP_OPAQUE;
+ unsigned int bm_flags = BITMAP_OPAQUE;
struct adtFrame adt_frame;
APTR clut;
@@ -288,18 +290,18 @@ bool amiga_dt_anim_redraw(struct content *c,
* \param box box containing c, or 0 if not an object
* \param params object parameters, or 0 if not an object
*/
-void amiga_dt_anim_open(struct content *c, struct browser_window *bw,
+nserror amiga_dt_anim_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params)
{
NSLOG(netsurf, INFO, "amiga_dt_anim_open");
- return;
+ return NSERROR_OK;
}
-void amiga_dt_anim_close(struct content *c)
+nserror amiga_dt_anim_close(struct content *c)
{
NSLOG(netsurf, INFO, "amiga_dt_anim_close");
- return;
+ return NSERROR_OK;
}
void amiga_dt_anim_reformat(struct content *c, int width, int height)
diff --git a/frontends/amiga/dt_picture.c b/frontends/amiga/dt_picture.c
index 3b2b942b0..e13790d5c 100644
--- a/frontends/amiga/dt_picture.c
+++ b/frontends/amiga/dt_picture.c
@@ -25,6 +25,7 @@
#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <proto/datatypes.h>
#include <proto/dos.h>
#include <proto/intuition.h>
@@ -36,7 +37,9 @@
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "content/llcache.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "content/handlers/image/image_cache.h"
#include "amiga/bitmap.h"
@@ -184,7 +187,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
if((dto = amiga_dt_picture_newdtobject(adt)))
{
- bitmap = amiga_bitmap_create(c->width, c->height, BITMAP_NEW);
+ bitmap = amiga_bitmap_create(c->width, c->height, BITMAP_NONE);
if (!bitmap) {
msg_data.errordata.errorcode = NSERROR_NOMEM;
msg_data.errordata.errormsg = messages_get("NoMemory");
@@ -199,7 +202,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
amiga_bitmap_get_rowstride(bitmap),
0, 0, c->width, c->height);
- amiga_bitmap_set_opaque(bitmap, amiga_bitmap_test_opaque(bitmap));
+ amiga_bitmap_set_opaque(bitmap, bitmap_test_opaque(bitmap));
DisposeDTObject(dto);
adt->dto = NULL;
diff --git a/frontends/amiga/dt_sound.c b/frontends/amiga/dt_sound.c
index e0a794fa9..16b4f7c62 100644
--- a/frontends/amiga/dt_sound.c
+++ b/frontends/amiga/dt_sound.c
@@ -23,6 +23,8 @@
#ifdef WITH_AMIGA_DATATYPES
#include "amiga/os3support.h"
+#include <string.h>
+
#include <proto/datatypes.h>
#include <proto/dos.h>
#include <proto/intuition.h>
@@ -36,6 +38,7 @@
#include "html/box.h"
#include "content/llcache.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
@@ -57,7 +60,7 @@ static void amiga_dt_sound_destroy(struct content *c);
static bool amiga_dt_sound_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
-static void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
+static nserror amiga_dt_sound_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params);
static nserror amiga_dt_sound_clone(const struct content *old, struct content **newc);
static content_type amiga_dt_sound_content_type(void);
@@ -220,7 +223,7 @@ bool amiga_dt_sound_redraw(struct content *c,
}
-void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
+nserror amiga_dt_sound_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params)
{
amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
@@ -247,7 +250,7 @@ void amiga_dt_sound_open(struct content *c, struct browser_window *bw,
if(plugin->dto && (plugin->immediate == true))
amiga_dt_sound_play(plugin->dto);
- return;
+ return NSERROR_OK;
}
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 67866aa48..79acb1a21 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -22,6 +22,8 @@
#include <proto/icon.h>
#include <workbench/icon.h>
+#include <string.h>
+
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/file.h"
@@ -29,6 +31,7 @@
#include "utils/nsurl.h"
#include "netsurf/browser_window.h"
#include "netsurf/content.h"
+#include "content/content_factory.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf.h"
#include "desktop/save_text.h"
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index 6283a1fbd..43f7b9488 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -349,6 +349,11 @@ static nserror amiga_nsfont_split(const plot_font_style_t *fstyle,
*/
static struct ami_font_cache_node *ami_font_open(const char *font, bool critical)
{
+ if(font == NULL) {
+ NSLOG(netsurf, INFO, "Requested NULL font");
+ return NULL;
+ }
+
struct ami_font_cache_node *nodedata = ami_font_cache_locate(font);
if(nodedata) return nodedata;
@@ -549,6 +554,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
FIXED kern = 0;
ULONG glyphmaptag;
ULONG template_type;
+ bool skip_c2 = false;
uint32 long_char_1 = 0, long_char_2 = 0;
#ifndef __amigaos4__
struct BulletBase *BulletBase = ofont->BulletBase;
@@ -566,6 +572,8 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
}
#endif
+ if (*char2 < 0x0020) skip_c2 = true;
+
#ifdef __amigaos4__
if(__builtin_expect(aa == true, 1)) {
glyphmaptag = OT_GlyphMap8Bit;
@@ -628,7 +636,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
kern = 0;
- if(*char2) EObtainInfo(AMI_OFONT_ENGINE,
+ if((*char2) && (!skip_c2)) EObtainInfo(AMI_OFONT_ENGINE,
OT_TextKernPair, &kern,
TAG_END);
@@ -638,7 +646,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
glyphmaptag, glyph,
TAG_END);
- if(*char2) EReleaseInfo(AMI_OFONT_ENGINE,
+ if((*char2) && (!skip_c2)) EReleaseInfo(AMI_OFONT_ENGINE,
OT_TextKernPair, kern,
TAG_END);
}
diff --git a/frontends/amiga/font_diskfont.c b/frontends/amiga/font_diskfont.c
index a587d6eaf..be1b89194 100644
--- a/frontends/amiga/font_diskfont.c
+++ b/frontends/amiga/font_diskfont.c
@@ -100,7 +100,10 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
tattr.ta_YSize = fstyle->size / PLOT_STYLE_SCALE;
NSLOG(netsurf, INFO, "font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
- if(prev_font != NULL) CloseFont(prev_font);
+ if(prev_font != NULL) {
+ CloseFont(prev_font);
+ prev_font = NULL;
+ }
if((bmfont = OpenDiskFont(&tattr))) {
SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE);
@@ -300,7 +303,14 @@ void ami_font_diskfont_init(void)
void ami_font_diskfont_fini(void)
{
- if(prev_font != NULL) CloseFont(prev_font);
- if(prev_fstyle != NULL) free(prev_fstyle);
+ if(prev_font != NULL) {
+ CloseFont(prev_font);
+ prev_font = NULL;
+ }
+
+ if(prev_fstyle != NULL) {
+ free(prev_fstyle);
+ prev_fstyle = NULL;
+ }
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 5384ffec4..ec251efa0 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2019 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -152,6 +152,7 @@
#include "amiga/menu.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
+#include "amiga/pageinfo.h"
#include "amiga/plotters.h"
#include "amiga/plugin_hack.h"
#include "amiga/print.h"
@@ -160,7 +161,7 @@
#include "amiga/selectmenu.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
-#include "amiga/sslcert.h"
+#include "amiga/corewindow.h"
#define AMINS_SCROLLERPEN NUMDRIPENS
#define NSA_KBD_SCROLL_PX 10
@@ -213,6 +214,12 @@ enum
GID_FORWARD,
GID_THROBBER,
GID_SEARCH_ICON,
+ GID_PAGEINFO,
+ GID_PAGEINFO_INSECURE_BM,
+ GID_PAGEINFO_INTERNAL_BM,
+ GID_PAGEINFO_LOCAL_BM,
+ GID_PAGEINFO_SECURE_BM,
+ GID_PAGEINFO_WARNING_BM,
GID_FAVE,
GID_FAVE_ADD,
GID_FAVE_RMV,
@@ -1089,6 +1096,7 @@ static nserror ami_set_options(struct nsoption_s *defaults)
const char *encname = (const char *)ObtainCharsetInfo(DFCS_NUMBER, codeset,
DFCS_MIMENAME);
nsoption_set_charp(local_charset, strdup(encname));
+ nsoption_set_int(local_codeset, codeset);
#else
nsoption_set_bool(download_notify, false);
nsoption_set_bool(font_antialiasing, false);
@@ -1448,7 +1456,7 @@ static void gui_init2(int argc, char** argv)
hotlist_init(nsoption_charp(hotlist_file),
nsoption_charp(hotlist_file));
- search_web_select_provider(nsoption_int(search_provider));
+ search_web_select_provider(nsoption_charp(search_web_provider));
if (notalreadyrunning &&
(nsoption_bool(startup_no_window) == false))
@@ -2238,6 +2246,7 @@ static void ami_gui_scroller_update(struct gui_window_2 *gwin)
}
}
+/* For future use
static void ami_gui_console_log_clear(struct gui_window *g)
{
if(g->shared->objects[GID_LOG] != NULL) {
@@ -2256,6 +2265,7 @@ static void ami_gui_console_log_clear(struct gui_window *g)
TAG_DONE);
}
}
+*/
static void ami_gui_console_log_add(struct gui_window *g)
{
@@ -2991,6 +3001,25 @@ static BOOL ami_gui_event(void *w)
ami_gui_history(gwin, false);
break;
+ case GID_PAGEINFO:
+ {
+ ULONG w_top, w_left;
+ ULONG g_top, g_left, g_height;
+
+ GetAttr(WA_Top, gwin->objects[OID_MAIN], &w_top);
+ GetAttr(WA_Left, gwin->objects[OID_MAIN], &w_left);
+ GetAttr(GA_Top, gwin->objects[GID_PAGEINFO], &g_top);
+ GetAttr(GA_Left, gwin->objects[GID_PAGEINFO], &g_left);
+ GetAttr(GA_Height, gwin->objects[GID_PAGEINFO], &g_height);
+
+ if(ami_pageinfo_open(gwin->gw->bw,
+ w_left + g_left,
+ w_top + g_top + g_height) != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Unable to open page info window");
+ }
+ }
+ break;
+
case GID_FAVE:
GetAttr(STRINGA_TextVal,
(Object *)gwin->objects[GID_URL],
@@ -3226,6 +3255,56 @@ static void ami_gui_appicon_remove(struct gui_window_2 *gwin)
}
}
+static nserror gui_page_info_change(struct gui_window *gw)
+{
+ int bm_idx;
+ browser_window_page_info_state pistate;
+ struct gui_window_2 *gwin = ami_gui_get_gui_window_2(gw);
+ struct browser_window *bw = ami_gui_get_browser_window(gw);
+
+ /* if this isn't the visible tab, don't do anything */
+ if((gwin == NULL) || (gwin->gw != gw)) return NSERROR_OK;
+
+ pistate = browser_window_get_page_info_state(bw);
+
+ switch(pistate) {
+ case PAGE_STATE_INTERNAL:
+ bm_idx = GID_PAGEINFO_INTERNAL_BM;
+ break;
+
+ case PAGE_STATE_LOCAL:
+ bm_idx = GID_PAGEINFO_LOCAL_BM;
+ break;
+
+ case PAGE_STATE_INSECURE:
+ bm_idx = GID_PAGEINFO_INSECURE_BM;
+ break;
+
+ case PAGE_STATE_SECURE_OVERRIDE:
+ bm_idx = GID_PAGEINFO_WARNING_BM;
+ break;
+
+ case PAGE_STATE_SECURE_ISSUES:
+ bm_idx = GID_PAGEINFO_WARNING_BM;
+ break;
+
+ case PAGE_STATE_SECURE:
+ bm_idx = GID_PAGEINFO_SECURE_BM;
+ break;
+
+ default:
+ bm_idx = GID_PAGEINFO_INTERNAL_BM;
+ break;
+ }
+
+ RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_PAGEINFO], gwin->win, NULL,
+ BUTTON_RenderImage, gwin->objects[bm_idx],
+ GA_HintInfo, gwin->helphints[bm_idx],
+ TAG_DONE);
+
+ return NSERROR_OK;
+}
+
static void ami_handle_appmsg(void)
{
struct AppMessage *appmsg;
@@ -3519,6 +3598,135 @@ static void ami_change_tab(struct gui_window_2 *gwin, int direction)
ami_switch_tab(gwin, true);
}
+
+static void gui_window_set_title(struct gui_window *g, const char *restrict title)
+{
+ struct Node *node;
+ char *restrict utf8title;
+
+ if(!g) return;
+ if(!title) return;
+
+ utf8title = ami_utf8_easy((char *)title);
+
+ if(g->tab_node) {
+ node = g->tab_node;
+
+ if((g->tabtitle == NULL) || (strcmp(utf8title, g->tabtitle)))
+ {
+ SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
+ g->shared->win, NULL,
+ CLICKTAB_Labels, ~0,
+ TAG_DONE);
+
+ if(g->tabtitle) free(g->tabtitle);
+ g->tabtitle = strdup(utf8title);
+
+ SetClickTabNodeAttrs(node, TNA_Text, g->tabtitle,
+ TNA_HintInfo, g->tabtitle,
+ TAG_DONE);
+
+ RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
+ g->shared->win, NULL,
+ CLICKTAB_Labels, &g->shared->tab_list,
+ TAG_DONE);
+
+ if(ClickTabBase->lib_Version < 53)
+ RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
+ g->shared->win, NULL, TRUE);
+ }
+ }
+
+ if(g == g->shared->gw) {
+ if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle)))
+ {
+ if(g->shared->wintitle) free(g->shared->wintitle);
+ g->shared->wintitle = strdup(utf8title);
+ SetWindowTitles(g->shared->win, g->shared->wintitle, ami_gui_get_screen_title());
+ }
+ }
+
+ ami_utf8_free(utf8title);
+}
+
+static void gui_window_update_extent(struct gui_window *g)
+{
+ struct IBox *bbox;
+
+ if(!g || !g->bw) return;
+ if(browser_window_has_content(g->bw) == false) return;
+
+ if(g == g->shared->gw) {
+ int width, height;
+ if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
+ amiga_warn_user("NoMemory", "");
+ return;
+ }
+
+ if(g->shared->objects[GID_VSCROLL]) {
+ browser_window_get_extents(g->bw, true, &width, &height);
+ RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],g->shared->win,NULL,
+ SCROLLER_Total, (ULONG)(height),
+ SCROLLER_Visible, bbox->Height,
+ TAG_DONE);
+ }
+
+ if(g->shared->objects[GID_HSCROLL])
+ {
+ browser_window_get_extents(g->bw, true, &width, &height);
+ RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
+ g->shared->win, NULL,
+ SCROLLER_Total, (ULONG)(width),
+ SCROLLER_Visible, bbox->Width,
+ TAG_DONE);
+ }
+
+ ami_gui_free_space_box(bbox);
+ }
+
+ ami_gui_scroller_update(g->shared);
+ g->shared->new_content = true;
+}
+
+
+/**
+ * Invalidates an area of an amiga browser window
+ *
+ * \param g gui_window
+ * \param rect area to redraw or NULL for the entire window area
+ * \return NSERROR_OK on success or appropriate error code
+ */
+static nserror amiga_window_invalidate_area(struct gui_window *g,
+ const struct rect *restrict rect)
+{
+ struct nsObject *nsobj;
+ struct rect *restrict deferred_rect;
+
+ if(!g) return NSERROR_BAD_PARAMETER;
+
+ if (rect == NULL) {
+ if (g != g->shared->gw) {
+ return NSERROR_OK;
+ }
+ } else {
+ if (ami_gui_window_update_box_deferred_check(g->deferred_rects, rect,
+ g->deferred_rects_pool)) {
+ deferred_rect = ami_memory_itempool_alloc(g->deferred_rects_pool,
+ sizeof(struct rect));
+ CopyMem(rect, deferred_rect, sizeof(struct rect));
+ nsobj = AddObject(g->deferred_rects, AMINS_RECT);
+ nsobj->objstruct = deferred_rect;
+ } else {
+ NSLOG(netsurf, INFO,
+ "Ignoring duplicate or subset of queued box redraw");
+ }
+ }
+ ami_schedule_redraw(g->shared, false);
+
+ return NSERROR_OK;
+}
+
+
static void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
{
struct Node *tabnode;
@@ -3564,7 +3772,10 @@ static void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
struct rect rect;
ami_plot_clear_bbox(gwin->win->RPort, bbox);
- browser_window_update(gwin->gw->bw, false);
+ gui_window_set_title(gwin->gw,
+ browser_window_get_title(gwin->gw->bw));
+ gui_window_update_extent(gwin->gw);
+ amiga_window_invalidate_area(gwin->gw, NULL);
rect.x0 = rect.x1 = gwin->gw->scrollx;
rect.y0 = rect.y1 = gwin->gw->scrolly;
@@ -3578,6 +3789,7 @@ static void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
ami_throbber_redraw_schedule(0, gwin->gw);
gui_window_set_icon(gwin->gw, gwin->gw->favicon);
+ gui_page_info_change(gwin->gw);
}
ami_gui_free_space_box(bbox);
@@ -4070,7 +4282,12 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
- if(gwin->gw && gwin->gw->bw) browser_window_update(gwin->gw->bw, false);
+ if (gwin->gw && gwin->gw->bw) {
+ gui_window_set_title(gwin->gw,
+ browser_window_get_title(gwin->gw->bw));
+ gui_window_update_extent(gwin->gw);
+ amiga_window_invalidate_area(gwin->gw, NULL);
+ }
}
void ami_gui_tabs_toggle_all(void)
@@ -4328,44 +4545,6 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
}
-/**
- * Invalidates an area of an amiga browser window
- *
- * \param g gui_window
- * \param rect area to redraw or NULL for the entire window area
- * \return NSERROR_OK on success or appropriate error code
- */
-static nserror amiga_window_invalidate_area(struct gui_window *g,
- const struct rect *restrict rect)
-{
- struct nsObject *nsobj;
- struct rect *restrict deferred_rect;
-
- if(!g) return NSERROR_BAD_PARAMETER;
-
- if (rect == NULL) {
- if (g != g->shared->gw) {
- return NSERROR_OK;
- }
- } else {
- if (ami_gui_window_update_box_deferred_check(g->deferred_rects, rect,
- g->deferred_rects_pool)) {
- deferred_rect = ami_memory_itempool_alloc(g->deferred_rects_pool,
- sizeof(struct rect));
- CopyMem(rect, deferred_rect, sizeof(struct rect));
- nsobj = AddObject(g->deferred_rects, AMINS_RECT);
- nsobj->objstruct = deferred_rect;
- } else {
- NSLOG(netsurf, INFO,
- "Ignoring duplicate or subset of queued box redraw");
- }
- }
- ami_schedule_redraw(g->shared, false);
-
- return NSERROR_OK;
-}
-
-
static void ami_refresh_window(struct gui_window_2 *gwin)
{
/* simplerefresh only */
@@ -4534,6 +4713,7 @@ gui_window_create(struct browser_window *bw,
char closetab[100],closetab_s[100],closetab_g[100];
char addtab[100],addtab_s[100],addtab_g[100];
char fave[100], unfave[100];
+ char pi_insecure[100], pi_internal[100], pi_local[100], pi_secure[100], pi_warning[100];
char tabthrobber[100];
ULONG refresh_mode = WA_SmartRefresh;
ULONG defer_layout = TRUE;
@@ -4755,6 +4935,12 @@ gui_window_create(struct browser_window *bw,
g->shared->helphints[GID_ADDTAB] =
translate_escape_chars(messages_get("HelpToolbarAddTab"));
+ g->shared->helphints[GID_PAGEINFO_INSECURE_BM] = ami_utf8_easy(messages_get("PageInfoInsecure"));
+ g->shared->helphints[GID_PAGEINFO_LOCAL_BM] = ami_utf8_easy(messages_get("PageInfoLocal"));
+ g->shared->helphints[GID_PAGEINFO_SECURE_BM] = ami_utf8_easy(messages_get("PageInfoSecure"));
+ g->shared->helphints[GID_PAGEINFO_WARNING_BM] = ami_utf8_easy(messages_get("PageInfoWarning"));
+ g->shared->helphints[GID_PAGEINFO_INTERNAL_BM] = ami_utf8_easy(messages_get("PageInfoInternal"));
+
ami_get_theme_filename(nav_west, "theme_nav_west", false);
ami_get_theme_filename(nav_west_s, "theme_nav_west_s", false);
ami_get_theme_filename(nav_west_g, "theme_nav_west_g", false);
@@ -4779,6 +4965,11 @@ gui_window_create(struct browser_window *bw,
ami_get_theme_filename(tabthrobber, "theme_tab_loading", false);
ami_get_theme_filename(fave, "theme_fave", false);
ami_get_theme_filename(unfave, "theme_unfave", false);
+ ami_get_theme_filename(pi_insecure, "theme_pageinfo_insecure", false);
+ ami_get_theme_filename(pi_internal, "theme_pageinfo_internal", false);
+ ami_get_theme_filename(pi_local, "theme_pageinfo_local", false);
+ ami_get_theme_filename(pi_secure, "theme_pageinfo_secure", false);
+ ami_get_theme_filename(pi_warning, "theme_pageinfo_warning", false);
g->shared->objects[GID_FAVE_ADD] = BitMapObj,
BITMAP_SourceFile, fave,
@@ -4808,6 +4999,37 @@ gui_window_create(struct browser_window *bw,
BITMAP_Masking, TRUE,
BitMapEnd;
+ g->shared->objects[GID_PAGEINFO_INSECURE_BM] = BitMapObj,
+ BITMAP_SourceFile, pi_insecure,
+ BITMAP_Screen, scrn,
+ BITMAP_Masking, TRUE,
+ BitMapEnd;
+
+ g->shared->objects[GID_PAGEINFO_INTERNAL_BM] = BitMapObj,
+ BITMAP_SourceFile, pi_internal,
+ BITMAP_Screen, scrn,
+ BITMAP_Masking, TRUE,
+ BitMapEnd;
+
+ g->shared->objects[GID_PAGEINFO_LOCAL_BM] = BitMapObj,
+ BITMAP_SourceFile, pi_local,
+ BITMAP_Screen, scrn,
+ BITMAP_Masking, TRUE,
+ BitMapEnd;
+
+ g->shared->objects[GID_PAGEINFO_SECURE_BM] = BitMapObj,
+ BITMAP_SourceFile, pi_secure,
+ BITMAP_Screen, scrn,
+ BITMAP_Masking, TRUE,
+ BitMapEnd;
+
+ g->shared->objects[GID_PAGEINFO_WARNING_BM] = BitMapObj,
+ BITMAP_SourceFile, pi_warning,
+ BITMAP_Screen, scrn,
+ BITMAP_Masking, TRUE,
+ BitMapEnd;
+
+
if(ClickTabBase->lib_Version < 53)
{
addtabclosegadget = LAYOUT_AddChild;
@@ -4966,6 +5188,14 @@ gui_window_create(struct browser_window *bw,
SpaceEnd,
CHILD_WeightedWidth, 0,
CHILD_WeightedHeight, 0,
+ LAYOUT_AddChild, g->shared->objects[GID_PAGEINFO] = ButtonObj,
+ GA_ID, GID_PAGEINFO,
+ GA_RelVerify, TRUE,
+ GA_ReadOnly, FALSE,
+ BUTTON_RenderImage, g->shared->objects[GID_PAGEINFO_INTERNAL_BM],
+ ButtonEnd,
+ CHILD_WeightedWidth, 0,
+ CHILD_WeightedHeight, 0,
LAYOUT_AddChild, g->shared->objects[GID_URL] =
#ifdef __amigaos4__
NewObject(urlStringClass, NULL,
@@ -5335,6 +5565,11 @@ static void gui_window_destroy(struct gui_window *g)
DisposeObject(g->shared->objects[GID_TABS_FLAG]);
DisposeObject(g->shared->objects[GID_FAVE_ADD]);
DisposeObject(g->shared->objects[GID_FAVE_RMV]);
+ DisposeObject(g->shared->objects[GID_PAGEINFO_INSECURE_BM]);
+ DisposeObject(g->shared->objects[GID_PAGEINFO_INTERNAL_BM]);
+ DisposeObject(g->shared->objects[GID_PAGEINFO_LOCAL_BM]);
+ DisposeObject(g->shared->objects[GID_PAGEINFO_SECURE_BM]);
+ DisposeObject(g->shared->objects[GID_PAGEINFO_WARNING_BM]);
ami_gui_opts_websearch_free(g->shared->web_search_list);
if(g->shared->search_bm) DisposeObject(g->shared->search_bm);
@@ -5375,55 +5610,6 @@ static void gui_window_destroy(struct gui_window *g)
win_destroyed = true;
}
-static void gui_window_set_title(struct gui_window *g, const char *restrict title)
-{
- struct Node *node;
- char *restrict utf8title;
-
- if(!g) return;
- if(!title) return;
-
- utf8title = ami_utf8_easy((char *)title);
-
- if(g->tab_node) {
- node = g->tab_node;
-
- if((g->tabtitle == NULL) || (strcmp(utf8title, g->tabtitle)))
- {
- SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, ~0,
- TAG_DONE);
-
- if(g->tabtitle) free(g->tabtitle);
- g->tabtitle = strdup(utf8title);
-
- SetClickTabNodeAttrs(node, TNA_Text, g->tabtitle,
- TNA_HintInfo, g->tabtitle,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)g->shared->objects[GID_TABS],
- g->shared->win, NULL,
- CLICKTAB_Labels, &g->shared->tab_list,
- TAG_DONE);
-
- if(ClickTabBase->lib_Version < 53)
- RethinkLayout((struct Gadget *)g->shared->objects[GID_TABLAYOUT],
- g->shared->win, NULL, TRUE);
- }
- }
-
- if(g == g->shared->gw) {
- if((g->shared->wintitle == NULL) || (strcmp(utf8title, g->shared->wintitle)))
- {
- if(g->shared->wintitle) free(g->shared->wintitle);
- g->shared->wintitle = strdup(utf8title);
- SetWindowTitles(g->shared->win, g->shared->wintitle, ami_gui_get_screen_title());
- }
- }
-
- ami_utf8_free(utf8title);
-}
static void ami_redraw_callback(void *p)
{
@@ -5734,45 +5920,6 @@ gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
return NSERROR_OK;
}
-static void gui_window_update_extent(struct gui_window *g)
-{
- struct IBox *bbox;
-
- if(!g || !g->bw) return;
- if(browser_window_has_content(g->bw) == false) return;
-
- if(g == g->shared->gw) {
- int width, height;
- if(ami_gui_get_space_box((Object *)g->shared->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
- }
-
- if(g->shared->objects[GID_VSCROLL]) {
- browser_window_get_extents(g->bw, true, &width, &height);
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total, (ULONG)(height),
- SCROLLER_Visible, bbox->Height,
- TAG_DONE);
- }
-
- if(g->shared->objects[GID_HSCROLL])
- {
- browser_window_get_extents(g->bw, true, &width, &height);
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
- g->shared->win, NULL,
- SCROLLER_Total, (ULONG)(width),
- SCROLLER_Visible, bbox->Width,
- TAG_DONE);
- }
-
- ami_gui_free_space_box(bbox);
- }
-
- ami_gui_scroller_update(g->shared);
- g->shared->new_content = true;
-}
-
static void gui_window_set_status(struct gui_window *g, const char *text)
{
char *utf8text;
@@ -6319,6 +6466,10 @@ gui_window_event(struct gui_window *gw, enum gui_window_event event)
gui_window_stop_throbber(gw);
break;
+ case GW_EVENT_PAGE_INFO_CHANGE:
+ gui_page_info_change(gw);
+ break;
+
default:
break;
}
@@ -6371,6 +6522,7 @@ static struct gui_misc_table amiga_misc_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
+ .present_cookies = ami_cookies_present,
};
/** Normal entry point from OS */
@@ -6390,6 +6542,7 @@ int main(int argc, char** argv)
struct netsurf_table amiga_table = {
.misc = &amiga_misc_table,
.window = &amiga_window_table,
+ .corewindow = amiga_core_window_table,
.clipboard = amiga_clipboard_table,
.download = amiga_download_table,
.fetch = &amiga_fetch_table,
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 64dd7fbc7..dc1450fce 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2017-2024 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -336,7 +336,7 @@ HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessa
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
{
- ami_cookies_present();
+ ami_cookies_present(NULL);
}
HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
@@ -375,6 +375,18 @@ HOOKF(void, ami_menu_item_browser_enablejs, APTR, window, struct IntuiMessage *)
ami_gui_menu_set_check_toggled();
}
+HOOKF(void, ami_menu_item_browser_enablecss, APTR, window, struct IntuiMessage *)
+{
+ struct Menu *menustrip;
+ bool checked = false;
+
+ GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
+ checked = ami_menu_get_selected(menustrip, msg);
+
+ nsoption_set_bool(author_level_css, checked);
+ ami_gui_menu_set_check_toggled();
+}
+
HOOKF(void, ami_menu_item_browser_scale_decrease, APTR, window, struct IntuiMessage *)
{
struct gui_window_2 *gwin;
@@ -582,6 +594,10 @@ ULONG ami_gui_menu_number(int item)
case M_JS:
menu_num = FULLMENUNUM(2,9,0);
break;
+
+ case M_CSS:
+ menu_num = FULLMENUNUM(2,10,0);
+ break;
default:
NSLOG(netsurf, INFO,
@@ -690,6 +706,13 @@ void ami_gui_menu_update_checked(struct gui_window_2 *gwin)
if(ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags & CHECKED)
ItemAddress(menustrip, ami_gui_menu_number(M_JS))->Flags ^= CHECKED;
}
+ if(nsoption_bool(author_level_css) == true) {
+ if((ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags & CHECKED) == 0)
+ ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags ^= CHECKED;
+ } else {
+ if(ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags & CHECKED)
+ ItemAddress(menustrip, ami_gui_menu_number(M_CSS))->Flags ^= CHECKED;
+ }
if(nsoption_bool(foreground_images) == true) {
if((ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags & CHECKED) == 0)
ItemAddress(menustrip, ami_gui_menu_number(M_IMGFORE))->Flags ^= CHECKED;
@@ -919,6 +942,10 @@ static void ami_init_menulabs(struct ami_menu_data **md)
if(nsoption_bool(enable_javascript) == true)
js_flags |= CHECKED;
+ UWORD css_flags = CHECKIT | MENUTOGGLE;
+ if(nsoption_bool(author_level_css) == true)
+ css_flags |= CHECKED;
+
UWORD imgfore_flags = CHECKIT | MENUTOGGLE;
if(nsoption_bool(foreground_images) == true)
imgfore_flags |= CHECKED;
@@ -1007,6 +1034,8 @@ static void ami_init_menulabs(struct ami_menu_data **md)
ami_menu_item_browser_backimg, NULL, imgback_flags);
ami_menu_alloc_item(md, M_JS, NM_ITEM, "EnableJS", NULL, NULL,
ami_menu_item_browser_enablejs, NULL, js_flags);
+ ami_menu_alloc_item(md, M_CSS, NM_ITEM, "EnableCSS", NULL, NULL,
+ ami_menu_item_browser_enablecss, NULL, css_flags);
ami_menu_alloc_item(md, M_BAR_B4, NM_ITEM, NM_BARLABEL, NULL, NULL, NULL, NULL, 0);
ami_menu_alloc_item(md, M_REDRAW, NM_ITEM, "Redraw", NULL, "TBImages:list_wand",
ami_menu_item_browser_redraw, NULL, 0);
diff --git a/frontends/amiga/gui_menu.h b/frontends/amiga/gui_menu.h
index ed72c24a4..ae36397c5 100644
--- a/frontends/amiga/gui_menu.h
+++ b/frontends/amiga/gui_menu.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-2024 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -78,13 +78,14 @@ enum {
M_IMGFORE,
M_IMGBACK,
M_JS,
+ M_CSS,
M_BAR_B4,
M_REDRAW,
/* Hotlist menu */
M_HOTLIST,
M_HLADD,
M_HLSHOW,
- M_BAR_H1, // 47
+ M_BAR_H1, // 48
AMI_MENU_HOTLIST, /* Where the hotlist entries start */
AMI_MENU_HOTLIST_MAX = AMI_MENU_HOTLIST + AMI_HOTLIST_ITEMS,
/* Settings menu */
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 36d8546e7..76ec5400e 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -94,6 +94,7 @@ enum
GID_OPTS_FROMLOCALE,
GID_OPTS_HISTORY,
GID_OPTS_JAVASCRIPT,
+ GID_OPTS_ENABLECSS,
GID_OPTS_REFERRAL,
GID_OPTS_DONOTTRACK,
GID_OPTS_FASTSCROLL,
@@ -102,6 +103,9 @@ enum
GID_OPTS_SCREENNAME,
GID_OPTS_WIN_SIMPLE,
GID_OPTS_THEME,
+ GID_OPTS_THEMEPAGE,
+ GID_OPTS_DARK,
+ GID_OPTS_LIGHT,
GID_OPTS_PTRTRUE,
GID_OPTS_PTROS,
GID_OPTS_PROXY,
@@ -116,7 +120,6 @@ enum
GID_OPTS_NATIVEBM,
GID_OPTS_SCALEQ,
GID_OPTS_DITHERQ,
- GID_OPTS_ANIMSPEED,
GID_OPTS_ANIMDISABLE,
GID_OPTS_DPI_Y,
GID_OPTS_FONT_SANS,
@@ -211,6 +214,7 @@ enum
#define OPTS_LAST LAB_OPTS_LAST
#define OPTS_MAX_TABS 10
#define OPTS_MAX_SCREEN 4
+#define OPTS_MAX_THEMEPAGE 3
#define OPTS_MAX_PROXY 5
#define OPTS_MAX_NATIVEBM 4
#define OPTS_MAX_DITHER 4
@@ -228,6 +232,7 @@ struct ami_gui_opts_window {
#ifndef __amigaos4__
struct List clicktablist;
struct List screenoptslist;
+ struct List pagethemeoptslist;
struct List proxyoptslist;
struct List nativebmoptslist;
struct List ditheroptslist;
@@ -247,6 +252,7 @@ static struct ami_gui_opts_window *gow = NULL;
static CONST_STRPTR tabs[OPTS_MAX_TABS];
static STRPTR screenopts[OPTS_MAX_SCREEN];
+static CONST_STRPTR pagethemeopts[OPTS_MAX_THEMEPAGE];
static CONST_STRPTR proxyopts[OPTS_MAX_PROXY];
static CONST_STRPTR nativebmopts[OPTS_MAX_NATIVEBM];
static CONST_STRPTR ditheropts[OPTS_MAX_DITHER];
@@ -334,6 +340,10 @@ static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
screenopts[2] = (char *)ami_utf8_easy((char *)messages_get("ScreenPublic"));
screenopts[3] = NULL;
+ pagethemeopts[0] = (char *)ami_utf8_easy((char *)messages_get("Light"));
+ pagethemeopts[1] = (char *)ami_utf8_easy((char *)messages_get("Dark"));
+ pagethemeopts[2] = NULL;
+
proxyopts[0] = (char *)ami_utf8_easy((char *)messages_get("ProxyNone"));
proxyopts[1] = (char *)ami_utf8_easy((char *)messages_get("ProxyNoAuth"));
proxyopts[2] = (char *)ami_utf8_easy((char *)messages_get("ProxyBasic"));
@@ -360,10 +370,15 @@ static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
gadlab[GID_OPTS_FROMLOCALE] = (char *)ami_utf8_easy((char *)messages_get("LocaleLang"));
gadlab[GID_OPTS_HISTORY] = (char *)ami_utf8_easy((char *)messages_get("HistoryAge"));
gadlab[GID_OPTS_JAVASCRIPT] = (char *)ami_utf8_easy((char *)messages_get("EnableJS"));
+ gadlab[GID_OPTS_ENABLECSS] = (char *)ami_utf8_easy((char *)messages_get("EnableCSS"));
gadlab[GID_OPTS_REFERRAL] = (char *)ami_utf8_easy((char *)messages_get("SendReferer"));
gadlab[GID_OPTS_DONOTTRACK] = (char *)ami_utf8_easy((char *)messages_get("DoNotTrack"));
gadlab[GID_OPTS_FASTSCROLL] = (char *)ami_utf8_easy((char *)messages_get("FastScrolling"));
gadlab[GID_OPTS_WIN_SIMPLE] = (char *)ami_utf8_easy((char *)messages_get("SimpleRefresh"));
+ gadlab[GID_OPTS_THEME] = (char *)ami_utf8_easy((char *)messages_get("ThemeGUI"));
+ gadlab[GID_OPTS_THEMEPAGE] = (char *)ami_utf8_easy((char *)messages_get("ThemePage"));
+ gadlab[GID_OPTS_DARK] = (char *)ami_utf8_easy((char *)messages_get("Dark"));
+ gadlab[GID_OPTS_LIGHT] = (char *)ami_utf8_easy((char *)messages_get("Light"));
gadlab[GID_OPTS_PTRTRUE] = (char *)ami_utf8_easy((char *)messages_get("TrueColour"));
gadlab[GID_OPTS_PTROS] = (char *)ami_utf8_easy((char *)messages_get("OSPointers"));
gadlab[GID_OPTS_PROXY] = (char *)ami_utf8_easy((char *)messages_get("ProxyType"));
@@ -377,7 +392,6 @@ static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
gadlab[GID_OPTS_NATIVEBM] = (char *)ami_utf8_easy((char *)messages_get("CacheNative"));
gadlab[GID_OPTS_SCALEQ] = (char *)ami_utf8_easy((char *)messages_get("ScaleQuality"));
gadlab[GID_OPTS_DITHERQ] = (char *)ami_utf8_easy((char *)messages_get("DitherQuality"));
- gadlab[GID_OPTS_ANIMSPEED] = (char *)ami_utf8_easy((char *)messages_get("AnimSpeedLimit"));
gadlab[GID_OPTS_DPI_Y] = (char *)ami_utf8_easy((char *)messages_get("ResolutionY"));
gadlab[GID_OPTS_ANIMDISABLE] = (char *)ami_utf8_easy((char *)messages_get("AnimDisable"));
gadlab[GID_OPTS_FONT_SANS] = (char *)ami_utf8_easy((char *)messages_get("FontSans"));
@@ -423,7 +437,6 @@ static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
gadlab[LAB_OPTS_WINTITLE] = (char *)ami_utf8_easy((char *)messages_get("Preferences"));
gadlab[LAB_OPTS_RESTART] = (char *)ami_utf8_easy((char *)messages_get("NeedRestart"));
gadlab[LAB_OPTS_DAYS] = (char *)ami_utf8_easy((char *)messages_get("Days"));
- gadlab[LAB_OPTS_SECS] = (char *)ami_utf8_easy((char *)messages_get("AnimSpeedFrames"));
gadlab[LAB_OPTS_PT] = (char *)ami_utf8_easy((char *)messages_get("Pt"));
gadlab[LAB_OPTS_MM] = (char *)ami_utf8_easy((char *)messages_get("MM"));
gadlab[LAB_OPTS_MB] = (char *)ami_utf8_easy((char *)messages_get("MBytes"));
@@ -469,6 +482,7 @@ static void ami_gui_opts_setup(struct ami_gui_opts_window *gow)
#ifndef __amigaos4__
ami_gui_opts_array_to_list(&gow->clicktablist, tabs, NSA_LIST_CLICKTAB);
ami_gui_opts_array_to_list(&gow->screenoptslist, screenopts, NSA_LIST_RADIO);
+ ami_gui_opts_array_to_list(&gow->pagethemeoptslist, pagethemeopts, NSA_LIST_CHOOSER);
ami_gui_opts_array_to_list(&gow->proxyoptslist, proxyopts, NSA_LIST_CHOOSER);
ami_gui_opts_array_to_list(&gow->nativebmoptslist, nativebmopts, NSA_LIST_CHOOSER);
ami_gui_opts_array_to_list(&gow->ditheroptslist, ditheropts, NSA_LIST_CHOOSER);
@@ -500,6 +514,7 @@ static void ami_gui_opts_free(struct ami_gui_opts_window *gow)
#ifndef __amigaos4__
ami_gui_opts_free_list(&gow->clicktablist, NSA_LIST_CLICKTAB);
ami_gui_opts_free_list(&gow->screenoptslist, NSA_LIST_RADIO);
+ ami_gui_opts_free_list(&gow->pagethemeoptslist, NSA_LIST_CHOOSER);
ami_gui_opts_free_list(&gow->proxyoptslist, NSA_LIST_CHOOSER);
ami_gui_opts_free_list(&gow->nativebmoptslist, NSA_LIST_CHOOSER);
ami_gui_opts_free_list(&gow->ditheroptslist, NSA_LIST_CHOOSER);
@@ -514,12 +529,11 @@ void ami_gui_opts_open(void)
ULONG proxytype = 0;
BOOL screenmodedisabled = FALSE, screennamedisabled = FALSE;
BOOL proxyhostdisabled = TRUE, proxyauthdisabled = TRUE, proxybypassdisabled = FALSE;
- BOOL disableanims, animspeeddisabled = FALSE, acceptlangdisabled = FALSE;
+ BOOL disableanims, acceptlangdisabled = FALSE;
BOOL scaleselected = nsoption_bool(scale_quality), scaledisabled = FALSE;
BOOL ditherdisable = TRUE;
BOOL download_notify_disabled = FALSE, tab_always_show_disabled = FALSE;
BOOL ptr_disable = FALSE;
- char animspeed[10];
char *homepage_url_lc = ami_utf8_easy(nsoption_charp(homepage_url));
struct TextAttr fontsans, fontserif, fontmono, fontcursive, fontfantasy;
@@ -583,17 +597,13 @@ void ami_gui_opts_open(void)
proxybypassdisabled = TRUE;
}
- sprintf(animspeed,"%.2f",(float)(nsoption_int(minimum_gif_delay)/100.0));
-
if(nsoption_bool(animate_images))
{
disableanims = FALSE;
- animspeeddisabled = FALSE;
}
else
{
disableanims = TRUE;
- animspeeddisabled = TRUE;
}
if(nsoption_bool(accept_lang_locale))
@@ -866,6 +876,23 @@ void ami_gui_opts_open(void)
GETFILE_ReadOnly, TRUE,
GETFILE_FullFileExpand, FALSE,
GetFileEnd,
+ CHILD_Label, LabelObj,
+ LABEL_Text, gadlab[GID_OPTS_THEME],
+ LabelEnd,
+ LAYOUT_AddChild, gow->objects[GID_OPTS_THEMEPAGE] = ChooserObj,
+ GA_ID, GID_OPTS_THEMEPAGE,
+ GA_RelVerify, TRUE,
+ CHOOSER_PopUp, TRUE,
+#ifdef __amigaos4__
+ CHOOSER_LabelArray, pagethemeopts,
+#else
+ CHOOSER_Labels, &gow->pagethemeoptslist,
+#endif
+ CHOOSER_Selected, nsoption_bool(prefer_dark_mode),
+ ChooserEnd,
+ CHILD_Label, LabelObj,
+ LABEL_Text, gadlab[GID_OPTS_THEMEPAGE],
+ LabelEnd,
LayoutEnd, // theme
CHILD_WeightedHeight, 0,
LAYOUT_AddChild, LayoutVObj,
@@ -1071,24 +1098,6 @@ void ami_gui_opts_open(void)
LAYOUT_SpaceOuter, TRUE,
LAYOUT_BevelStyle, BVS_GROUP,
LAYOUT_Label, gadlab[GRP_OPTS_ANIMS],
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_LabelColumn, PLACETEXT_RIGHT,
- LAYOUT_AddChild, gow->objects[GID_OPTS_ANIMSPEED] = StringObj,
- GA_ID, GID_OPTS_ANIMSPEED,
- GA_RelVerify, TRUE,
- GA_Disabled, animspeeddisabled,
- STRINGA_HookType, SHK_FLOAT,
- STRINGA_TextVal, animspeed,
- STRINGA_BufferPos,0,
- StringEnd,
- CHILD_WeightedWidth, 0,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[LAB_OPTS_SECS],
- LabelEnd,
- LayoutEnd,
- CHILD_Label, LabelObj,
- LABEL_Text, gadlab[GID_OPTS_ANIMSPEED],
- LabelEnd,
LAYOUT_AddChild, gow->objects[GID_OPTS_ANIMDISABLE] = CheckBoxObj,
GA_ID, GID_OPTS_ANIMDISABLE,
GA_RelVerify, TRUE,
@@ -1465,7 +1474,7 @@ void ami_gui_opts_open(void)
GA_RelVerify, TRUE,
CHOOSER_PopUp, TRUE,
CHOOSER_Labels, websearch_list,
- CHOOSER_Selected, nsoption_int(search_provider),
+ CHOOSER_Selected, nsoption_charp(search_web_provider),
CHOOSER_MaxLabels, 40,
ChooserEnd,
CHILD_Label, LabelObj,
@@ -1492,6 +1501,12 @@ void ami_gui_opts_open(void)
GA_Selected, !nsoption_bool(core_select_menu),
GA_Disabled, !ami_selectmenu_is_safe(),
CheckBoxEnd,
+ LAYOUT_AddChild, gow->objects[GID_OPTS_ENABLECSS] = CheckBoxObj,
+ GA_ID, GID_OPTS_ENABLECSS,
+ GA_RelVerify, TRUE,
+ GA_Text, gadlab[GID_OPTS_ENABLECSS],
+ GA_Selected, nsoption_bool(author_level_css),
+ CheckBoxEnd,
LayoutEnd, // misc
CHILD_WeightedHeight, 0,
@@ -1684,7 +1699,6 @@ void ami_gui_opts_open(void)
static void ami_gui_opts_use(bool save)
{
ULONG data, id = 0;
- float animspeed;
struct TextAttr *tattr;
char *dot;
bool rescan_fonts = false;
@@ -1736,7 +1750,16 @@ static void ami_gui_opts_use(bool save)
} else {
nsoption_set_bool(do_not_track, false);
}
-
+
+ GetAttr(GA_Selected,gow->objects[GID_OPTS_ENABLECSS],(ULONG *)&data);
+ if (data) {
+ nsoption_set_bool(author_level_css, true);
+ } else {
+ nsoption_set_bool(author_level_css, false);
+ }
+
+ ami_gui_menu_set_checked(NULL, M_CSS, nsoption_bool(author_level_css));
+
GetAttr(GA_Selected,gow->objects[GID_OPTS_FASTSCROLL],(ULONG *)&data);
if (data) {
nsoption_set_bool(faster_scroll, true);
@@ -1781,6 +1804,13 @@ static void ami_gui_opts_use(bool save)
GetAttr(GETFILE_Drawer,gow->objects[GID_OPTS_THEME],(ULONG *)&data);
nsoption_set_charp(theme, (char *)strdup((char *)data));
+ GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_THEMEPAGE],(ULONG *)&data);
+ if(data) {
+ nsoption_set_bool(prefer_dark_mode, true);
+ } else {
+ nsoption_set_bool(prefer_dark_mode, false);
+ }
+
GetAttr(GA_Selected,gow->objects[GID_OPTS_PTRTRUE],(ULONG *)&data);
if (data) {
nsoption_set_bool(truecolour_mouse_pointers, true);
@@ -1835,10 +1865,6 @@ static void ami_gui_opts_use(bool save)
GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_DITHERQ],(ULONG *)&nsoption_int(dither_quality));
- GetAttr(STRINGA_TextVal,gow->objects[GID_OPTS_ANIMSPEED],(ULONG *)&data);
- animspeed = strtof((char *)data, NULL);
- nsoption_set_int(minimum_gif_delay, (int)(animspeed * 100));
-
GetAttr(GA_Selected,gow->objects[GID_OPTS_ANIMDISABLE],(ULONG *)&data);
if(data) {
nsoption_set_bool(animate_images, false);
@@ -1983,8 +2009,8 @@ static void ami_gui_opts_use(bool save)
if(old_tab_always_show != nsoption_bool(tab_always_show))
ami_gui_tabs_toggle_all();
- GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_SEARCH_PROV],(ULONG *)&nsoption_int(search_provider));
- search_web_select_provider(nsoption_int(search_provider));
+ GetAttr(CHOOSER_Selected,gow->objects[GID_OPTS_SEARCH_PROV],(char *)nsoption_charp(search_web_provider));
+ search_web_select_provider(nsoption_charp(search_web_provider));
GetAttr(GA_Selected,gow->objects[GID_OPTS_CLIPBOARD],(ULONG *)&data);
if (data) {
@@ -2250,8 +2276,6 @@ static BOOL ami_gui_opts_event(void *w)
break;
case GID_OPTS_ANIMDISABLE:
- RefreshSetGadgetAttrs((struct Gadget *)gow->objects[GID_OPTS_ANIMSPEED],
- gow->win,NULL, GA_Disabled, code, TAG_DONE);
break;
case GID_OPTS_FONT_SANS:
diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c
index fd33a67f3..596e5ff12 100644
--- a/frontends/amiga/history.c
+++ b/frontends/amiga/history.c
@@ -461,7 +461,7 @@ nserror ami_history_global_present(void)
return res;
}
- res = global_history_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ res = global_history_init((struct core_window *)ncwin);
if (res != NSERROR_OK) {
ami_utf8_free(ncwin->core.wintitle);
DisposeObject(ncwin->core.objects[GID_CW_WIN]);
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 5ad77ead7..f5149dcdb 100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -293,8 +293,7 @@ nserror ami_history_local_present(struct gui_window *gw)
return res;
}
- res = local_history_init(ncwin->core.cb_table,
- (struct core_window *)ncwin,
+ res = local_history_init((struct core_window *)ncwin,
ami_gui_get_browser_window(gw),
&ncwin->session);
if (res != NSERROR_OK) {
diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c
index 9a1d423bc..397fd6716 100644
--- a/frontends/amiga/hotlist.c
+++ b/frontends/amiga/hotlist.c
@@ -586,7 +586,7 @@ nserror ami_hotlist_present(void)
return res;
}
- res = hotlist_manager_init(ncwin->core.cb_table, (struct core_window *)ncwin);
+ res = hotlist_manager_init((struct core_window *)ncwin);
if (res != NSERROR_OK) {
ami_utf8_free(ncwin->core.wintitle);
DisposeObject(ncwin->core.objects[GID_CW_WIN]);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index 914ab65f2..2b7f61281 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -45,7 +45,10 @@
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
+#include "content/content.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
+#include "desktop/gui_internal.h"
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
@@ -85,6 +88,17 @@ static void *amiga_icon_get_internal(const struct content *c, void *context)
return icon_c->bitmap;
}
+static bool amiga_icon_is_opaque(struct content *c)
+{
+ amiga_icon_content *icon_c = (amiga_icon_content *)c;
+
+ if (icon_c->bitmap != NULL) {
+ return guit->bitmap->get_opaque(icon_c->bitmap);
+ }
+
+ return false;
+}
+
static const content_handler amiga_icon_content_handler = {
.create = amiga_icon_create,
.data_complete = amiga_icon_convert,
@@ -93,6 +107,7 @@ static const content_handler amiga_icon_content_handler = {
.clone = amiga_icon_clone,
.get_internal = amiga_icon_get_internal,
.type = amiga_icon_content_type,
+ .is_opaque = amiga_icon_is_opaque,
.no_share = false,
};
@@ -186,7 +201,7 @@ bool amiga_icon_convert(struct content *c)
return false;
}
- icon_c->bitmap = amiga_bitmap_create(width, height, BITMAP_NEW);
+ icon_c->bitmap = amiga_bitmap_create(width, height, BITMAP_NONE);
if (!icon_c->bitmap) {
msg_data.errordata.errorcode = NSERROR_NOMEM;
msg_data.errordata.errormsg = messages_get("NoMemory");
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 5de1463f0..624b501ff 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -120,6 +120,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
if(!(PushChunk(iffh,0,ID_NAME,IFFSIZE_UNKNOWN)))
{
WriteChunkBytes(iffh,url,strlen(url));
+ WriteChunkBytes(iffh,"\0",1);
PopChunk(iffh);
}
@@ -185,6 +186,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
attr->DashPattern = 1;
attr->EdgeValue = findcolour(diagram->shape[i].stroke);
}
+
attr->EdgeThick = (float) diagram->shape[i].stroke_width;
if(!(PushChunk(iffh,0,ID_ATTR,IFFSIZE_UNKNOWN)))
@@ -281,7 +283,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
if(!(PushChunk(iffh, 0, ID_FONS, IFFSIZE_UNKNOWN)))
{
WriteChunkBytes(iffh, fons, sizeof(struct fons_struct));
- WriteChunkBytes(iffh, "Topaz\0", 6);
+ WriteChunkBytes(iffh, "Helvetica\0", 10);
PopChunk(iffh);
}
free(fons);
diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c
index 109baa44e..eb1f21617 100644
--- a/frontends/amiga/libs.c
+++ b/frontends/amiga/libs.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2014-2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -189,6 +189,7 @@ AMINS_LIB_STRUCT(Locale);
AMINS_LIB_STRUCT(P96);
AMINS_LIB_STRUCT(Workbench);
+AMINS_LIB_STRUCT(Codesets);
AMINS_LIB_STRUCT(GuiGFX);
AMINS_CLASS_STRUCT(ARexx);
@@ -222,6 +223,7 @@ 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("dos.library", 37, DOS, "main", 1, true)
#else
/* Libraries we get automatically on OS4 but not OS3 */
AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true)
@@ -230,7 +232,6 @@ bool ami_libs_open(void)
AMINS_LIB_OPEN("asl.library", 37, Asl, "main", 1, true)
AMINS_LIB_OPEN("datatypes.library", 39, DataTypes, "main", 1, true)
AMINS_LIB_OPEN("diskfont.library", 40, Diskfont, "main", 1, true)
- AMINS_LIB_OPEN("dos.library", 37, DOS, "main", 1, true)
AMINS_LIB_OPEN("gadtools.library", 37, GadTools, "main", 1, true)
AMINS_LIB_OPEN("graphics.library", 40, Graphics, "main", 1, true)
AMINS_LIB_OPEN("icon.library", 44, Icon, "main", 1, true)
@@ -248,7 +249,8 @@ bool ami_libs_open(void)
AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, false)
/* Non-OS provided libraries */
- AMINS_LIB_OPEN("guigfx.library", 9, GuiGFX, "main", 1, false)
+ AMINS_LIB_OPEN("codesets.library", 6, Codesets, "main", 1, false)
+ AMINS_LIB_OPEN("guigfx.library", 9, GuiGFX, "main", 1, false)
/* NB: timer.device is opened in schedule.c (ultimately by the scheduler process).
* The library base and interface are obtained there, rather than here, due to
@@ -324,12 +326,12 @@ void ami_libs_close(void)
AMINS_CLASS_CLOSE(Window)
/* Libraries */
+ AMINS_LIB_CLOSE(Codesets)
AMINS_LIB_CLOSE(GuiGFX)
AMINS_LIB_CLOSE(Asl)
AMINS_LIB_CLOSE(DataTypes)
AMINS_LIB_CLOSE(Diskfont)
- AMINS_LIB_CLOSE(DOS)
AMINS_LIB_CLOSE(GadTools)
AMINS_LIB_CLOSE(Graphics)
AMINS_LIB_CLOSE(Icon)
@@ -342,6 +344,7 @@ void ami_libs_close(void)
AMINS_LIB_CLOSE(Workbench)
#ifdef __amigaos4__
AMINS_LIB_CLOSE(Application)
+ AMINS_LIB_CLOSE(DOS)
#else
AMINS_LIB_CLOSE(Utility)
#endif
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index 196b05709..101558f6a 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 - 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008 - 2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -89,12 +89,22 @@ NSOPTION_INTEGER(redraw_tile_size_y, 0)
NSOPTION_INTEGER(monitor_aspect_x, 0)
NSOPTION_INTEGER(monitor_aspect_y, 0)
NSOPTION_BOOL(accept_lang_locale, true)
+
+/* Local charset when using iconv */
NSOPTION_STRING(local_charset, "ISO-8859-1")
+
#ifdef __amigaos4__
-/* Options relevant for OS4 only */
+/** Options relevant for OS4 only **/
+
+/* Local charset IANA number when using codesets */
+NSOPTION_INTEGER(local_codeset, 0)
+
+/* Use ExtMem */
NSOPTION_BOOL(use_extmem, true)
+
#else
-/* Options relevant for OS3 only */
+/** Options relevant for OS3 only **/
+
NSOPTION_BOOL(friend_bitmap, false)
#endif
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index 645496b73..98843c702 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include <dirent.h>
#include <proto/bullet.h>
#include <proto/exec.h>
@@ -182,6 +181,12 @@ char *strsep(char **s1, const char *s2)
return p1;
}
+int alphasort(const struct dirent **d1, const struct dirent **d2)
+{
+ /*\todo stub function, needs writing, preferably into clib2 */
+ return 0;
+}
+
int scandir(const char *dir, struct dirent ***namelist,
int (*filter)(const struct dirent *),
int (*compar)(const struct dirent **, const struct dirent **))
diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h
index fde032a18..dc4e06503 100644
--- a/frontends/amiga/os3support.h
+++ b/frontends/amiga/os3support.h
@@ -27,6 +27,7 @@
#ifndef __amigaos4__
#include <stdint.h>
+#include <dirent.h>
#include <proto/exec.h>
#include <proto/dos.h>
@@ -257,6 +258,10 @@ char *ASPrintf(const char *fmt, ...);
/* C */
char *strlwr(char *str);
+int alphasort(const struct dirent **d1, const struct dirent **d2);
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **));
#endif
#endif
diff --git a/frontends/amiga/pageinfo.c b/frontends/amiga/pageinfo.c
new file mode 100644
index 000000000..3ff223d7d
--- /dev/null
+++ b/frontends/amiga/pageinfo.c
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Amiga implementation of page info using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/scroller.h>
+#include <gadgets/space.h>
+#include <images/label.h>
+
+#include <intuition/icclass.h>
+#include <reaction/reaction_macros.h>
+
+#include "utils/log.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/page-info.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/libs.h"
+#include "amiga/pageinfo.h"
+#include "amiga/schedule.h"
+#include "amiga/utf8.h"
+
+
+/**
+ * Amiga page info window context
+ */
+struct ami_pageinfo_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+ /** core pageinfo */
+ struct page_info *pi;
+};
+
+/**
+ * destroy a previously created pageinfo window
+ */
+static void
+ami_pageinfo_destroy(struct ami_corewindow *ami_cw)
+{
+ nserror res;
+ struct ami_pageinfo_window *pageinfo_win = (struct ami_pageinfo_window *)ami_cw;
+ if(pageinfo_win->pi != NULL) {
+ res = page_info_destroy(pageinfo_win->pi);
+
+ if (res == NSERROR_OK) {
+ pageinfo_win->pi = NULL;
+ ami_corewindow_fini(&pageinfo_win->core); /* closes the window for us */
+ }
+ }
+}
+
+/**
+ * close pageinfo window (callback)
+ */
+static void
+ami_pageinfo_close_cb(void *p)
+{
+ ami_pageinfo_destroy((struct ami_corewindow *)p);
+}
+
+/**
+ * callback for unknown events on Amiga core window
+ * (result & WMHI_CLASSMASK) gives the class of event (eg. WMHI_GADGETUP)
+ * (result & WMHI_GADGETMASK) gives the gadget ID (eg. GID_SSLCERT_ACCEPT)
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param result event as returned by RA_HandleInput()
+ * \return TRUE if window closed during event processing
+ */
+static BOOL
+ami_pageinfo_event(struct ami_corewindow *ami_cw, ULONG result)
+{
+ if((result & WMHI_CLASSMASK) == WMHI_INACTIVE) {
+ /* Window went inactive, so schedule to close it */
+ ami_schedule(0, ami_pageinfo_close_cb, ami_cw);
+ /* NB: do not return TRUE here as we're still open for now */
+ }
+ return FALSE;
+}
+
+/**
+ * callback for mouse action for pageinfo on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_pageinfo_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ bool did_something = false;
+ struct ami_pageinfo_window *pageinfo_win = (struct ami_pageinfo_window *)ami_cw;
+
+ if(page_info_mouse_action(pageinfo_win->pi, mouse_state, x, y, &did_something) == NSERROR_OK)
+ if (did_something == true) {
+ /* Something happened so we need to close ourselves */
+ ami_schedule(0, ami_pageinfo_close_cb, pageinfo_win);
+ }
+
+ return NSERROR_OK;
+}
+
+/**
+ * callback for keypress for pageinfo on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_pageinfo_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ struct ami_pageinfo_window *pageinfo_win = (struct ami_pageinfo_window *)ami_cw;
+
+ if (page_info_keypress(pageinfo_win->pi, nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
+
+/**
+ * callback on draw event for pageinfo on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param x the x coordinate to draw
+ * \param y the y coordinate to draw
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_pageinfo_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ struct ami_pageinfo_window *pageinfo_win = (struct ami_pageinfo_window *)ami_cw;
+
+ page_info_redraw(pageinfo_win->pi, x, y, r, ctx);
+
+ return NSERROR_OK;
+}
+
+static nserror
+ami_pageinfo_create_window(struct ami_pageinfo_window *pageinfo_win, ULONG left, ULONG top)
+{
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&pageinfo_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
+ struct Screen *scrn = ami_gui_get_screen();
+
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
+ }
+
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Activate, TRUE,
+ WA_DepthGadget, FALSE,
+ WA_DragBar, FALSE,
+ WA_CloseGadget, FALSE,
+ WA_SizeGadget, FALSE,
+ WA_Borderless, TRUE,
+ WA_Left, left,
+ WA_Top, top,
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_IDCMPUPDATE | IDCMP_INACTIVEWINDOW |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_SharedPort, ami_gui_get_shared_msgport(),
+ WINDOW_UserData, pageinfo_win,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_BOX,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+/* exported interface documented in amiga/pageinfo.h */
+nserror ami_pageinfo_open(struct browser_window *bw, ULONG left, ULONG top)
+{
+ struct ami_pageinfo_window *ncwin;
+ nserror res;
+ int width, height;
+
+ ncwin = calloc(1, sizeof(struct ami_pageinfo_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("PageInfo"));
+
+ res = ami_pageinfo_create_window(ncwin, left, top);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Page info init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_pageinfo_draw;
+ ncwin->core.key = ami_pageinfo_key;
+ ncwin->core.mouse = ami_pageinfo_mouse;
+ ncwin->core.close = ami_pageinfo_destroy;
+ ncwin->core.event = ami_pageinfo_event;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = page_info_create((struct core_window *)ncwin,
+ bw,
+ &ncwin->pi);
+
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ if(page_info_get_size(ncwin->pi, &width, &height) == NSERROR_OK) {
+ /* Set window to the correct size.
+ * TODO: this should really set the size of ncwin->core.objects[GID_CW_DRAW]
+ * and let the window adjust, here we've hardcoded to add 6x4px as that's
+ * what window.class does before v45.
+ */
+ SetAttrs(ncwin->core.objects[GID_CW_WIN], WA_InnerWidth, width + 6, WA_InnerHeight, height + 4, TAG_DONE);
+ }
+
+ return NSERROR_OK;
+}
+
diff --git a/frontends/amiga/sslcert.h b/frontends/amiga/pageinfo.h
index 392989f02..e48925e26 100644
--- a/frontends/amiga/sslcert.h
+++ b/frontends/amiga/pageinfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,23 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_SSLCERT_H
-#define AMIGA_SSLCERT_H
-struct nsurl;
-struct ssl_cert_info;
+#ifndef AMIGA_PAGEINFO_H
+#define AMIGA_PAGEINFO_H
/**
- * Prompt the user to verify a certificate with issues.
+ * Open the page info window
*
- * \param url The URL being verified.
- * \param certs The certificate to be verified
- * \param num The number of certificates to be verified.
- * \param cb Callback upon user decision.
- * \param cbpw Context pointer passed to cb
- * \return NSERROR_OK or error code if prompt creation failed.
+ * \param bw the browser window
+ * \return NSERROR_OK or error code if window creation failed.
*/
-nserror ami_cert_verify(struct nsurl *url,
- const struct ssl_cert_info *certs, unsigned long num,
- nserror (*cb)(bool proceed, void *pw), void *cbpw);
+nserror ami_pageinfo_open(struct browser_window *bw, ULONG left, ULONG top);
+
#endif
diff --git a/frontends/amiga/pkg/SearchEngines b/frontends/amiga/pkg/SearchEngines
index 3f4bdd95b..3095d43cf 100644
--- a/frontends/amiga/pkg/SearchEngines
+++ b/frontends/amiga/pkg/SearchEngines
@@ -1,2 +1,2 @@
-Aminet|www.aminet.net|http://aminet.net/search?query=%s|http://aminet.net/favicon.ico|
+Aminet|www.aminet.net|https://aminet.net/search?query=%s|https://aminet.net/favicon.ico|
OS4Depot|www.os4depot.net|http://www.os4depot.net/index.php?function=search&tool=simple&f_fields=%s|http://www.os4depot.net/favicon.ico|
diff --git a/frontends/amiga/pkg/netsurf.readme b/frontends/amiga/pkg/netsurf.readme
index a24eaf3b7..d2d83ac56 100755
--- a/frontends/amiga/pkg/netsurf.readme
+++ b/frontends/amiga/pkg/netsurf.readme
@@ -2,11 +2,11 @@ Short: Fast CSS capable web browser
Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young)
Author: NetSurf contributors (OS4 port by Chris Young)
Type: comm/www
-Version: 3.9
+Version: 3.11
Requires: dev/misc/guigfxlib.lha
Architecture: ppc-amigaos >= 4.0.0
-This is NetSurf 3.9 for AmigaOS 4 (native frontend).
+This is NetSurf 3.11 for AmigaOS 4 (native frontend).
For the latest version, visit http://www.netsurf-browser.org
*******************************************
diff --git a/frontends/amiga/pkg/netsurf_os3.readme b/frontends/amiga/pkg/netsurf_os3.readme
index 0b31275b7..53514f8db 100644
--- a/frontends/amiga/pkg/netsurf_os3.readme
+++ b/frontends/amiga/pkg/netsurf_os3.readme
@@ -2,14 +2,14 @@ Short: Fast CSS capable web browser
Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young)
Author: NetSurf contributors (OS4 port by Chris Young)
Type: comm/www
-Version: 3.9 BETA
-Requires: dev/misc/guigfxlib.lha util/libs/AmiSSL-4.3.lha
-Architecture: m68k-amigaos >= 3.5.0
+Version: 3.11 BETA
+Requires: dev/misc/guigfxlib.lha util/libs/AmiSSL-5.13-OS3.lha
+Architecture: m68k-amigaos >= 3.2.0
-This is NetSurf 3.9 BETA for AmigaOS 3.
+This is NetSurf 3.11 BETA for AmigaOS 3.
It is built off of the OS4 (Reaction) frontend.
-Requirements are AmigaOS 3.5 or 3.9, 32MB RAM.
+Requirements are AmigaOS 3.2, 3.5 or 3.9, 32MB RAM.
THIS IS EARLY BETA QUALITY SOFTWARE FOR TESTING ONLY.
ALL USE IS AT YOUR OWN RISK. IT *WILL* CRASH!
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index b6add47cb..8bc1712dd 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -126,11 +126,34 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(depth < 16) {
gg->palette_mapped = true;
if(force32bit == false) palette_mapped = true;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = false,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
}
#else
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
+
/* Friend BitMaps are weird.
* For OS4, we shouldn't use a friend BitMap here (see below).
* For OS3 AGA, we get no display blitted if we use a friend BitMap,
@@ -144,16 +167,12 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if((depth > 8) && (force32bit == false)) friend = scrn->RastPort.BitMap;
}
- /* OS3 is locked to using palette-mapped display even on RTG.
- * To change this, comment out the below and build with the similar OS4 lines above.
- * Various bits of RTG code are OS4-only and OS3 versions will need to be written,
- * however a brief test reveals a negative performance benefit, so this lock to a
- * palette-mapped display is most likely permanent.
- */
-#warning OS3 locked to palette-mapped modes
- gg->palette_mapped = true;
- palette_mapped = true;
- if(depth > 8) depth = 8;
+ if(depth < 16) {
+ gg->palette_mapped = true;
+ if(force32bit == false) palette_mapped = true;
+ } else {
+ gg->palette_mapped = false;
+ }
#endif
/* Probably need to fix this next line */
@@ -257,11 +276,7 @@ void ami_plot_ra_free(struct gui_globals *gg)
ami_memory_chip_free(gg->tmprasbuf);
free(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
- if(gg->palette_mapped == false) {
- if(gg->bm) ami_rtg_freebitmap(gg->bm);
- } else {
- if(gg->bm) FreeBitMap(gg->bm);
- }
+ if(gg->bm) ami_rtg_freebitmap(gg->bm);
if(gg->managed_pen_list == true) {
ami_plot_release_pens(gg->shared_pens);
diff --git a/frontends/amiga/plugin_hack.c b/frontends/amiga/plugin_hack.c
index 5d7ec19c1..a775936bb 100644
--- a/frontends/amiga/plugin_hack.c
+++ b/frontends/amiga/plugin_hack.c
@@ -35,6 +35,7 @@
#include "amiga/filetype.h"
#include "amiga/plugin_hack.h"
#include "content/content_protected.h"
+#include "content/content_factory.h"
#include "content/llcache.h"
@@ -52,9 +53,9 @@ static void amiga_plugin_hack_destroy(struct content *c);
static bool amiga_plugin_hack_redraw(struct content *c,
struct content_redraw_data *data, const struct rect *clip,
const struct redraw_context *ctx);
-static void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
+static nserror amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params);
-static void amiga_plugin_hack_close(struct content *c);
+static nserror amiga_plugin_hack_close(struct content *c);
static nserror amiga_plugin_hack_clone(const struct content *old, struct content **newc);
static content_type amiga_plugin_hack_content_type(void);
@@ -185,7 +186,7 @@ bool amiga_plugin_hack_redraw(struct content *c,
* object within a page
* \param params object parameters, or 0 if not an object
*/
-void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
+nserror amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
struct content *page, struct object_params *params)
{
NSLOG(netsurf, INFO, "amiga_plugin_hack_open %s",
@@ -198,13 +199,13 @@ void amiga_plugin_hack_open(struct content *c, struct browser_window *bw,
c->height = 0;
}
- return;
+ return NSERROR_OK;
}
-void amiga_plugin_hack_close(struct content *c)
+nserror amiga_plugin_hack_close(struct content *c)
{
NSLOG(netsurf, INFO, "amiga_plugin_hack_close");
- return;
+ return NSERROR_OK;
}
void amiga_plugin_hack_reformat(struct content *c, int width, int height)
diff --git a/frontends/amiga/resources/Themes/AISS/Theme b/frontends/amiga/resources/Themes/AISS/Theme
index 8c5af103c..f8265bf73 100755
--- a/frontends/amiga/resources/Themes/AISS/Theme
+++ b/frontends/amiga/resources/Themes/AISS/Theme
@@ -31,6 +31,11 @@ theme_tab_loading:*TBImages:list_download
theme_search:*TBImages:list_search
theme_fave:*TBImages:list_favouriteadd
theme_unfave:*TBImages:list_favourite
+theme_pageinfo_insecure:*TBImages:list_warning
+theme_pageinfo_internal:*TBImages:list_info
+theme_pageinfo_local:*TBImages:list_info
+theme_pageinfo_secure:*TBImages:list_securezone
+theme_pageinfo_warning:*TBImages:list_warning
ptr_default:*PROGDIR:Resources/Pointers/Default
ptr_point:*PROGDIR:Resources/Pointers/Point
ptr_caret:*PROGDIR:Resources/Pointers/Caret
diff --git a/frontends/amiga/resources/Themes/Default/Theme b/frontends/amiga/resources/Themes/Default/Theme
index 141e84f54..7e8e9c8d6 100755
--- a/frontends/amiga/resources/Themes/Default/Theme
+++ b/frontends/amiga/resources/Themes/Default/Theme
@@ -44,6 +44,11 @@ theme_tab_loading:
theme_search:search.png
theme_fave:*PROGDIR:Resources/icons/hotlist-add.png
theme_unfave:*PROGDIR:Resources/icons/hotlist-rmv.png
+theme_pageinfo_insecure:*PROGDIR:Resources/icons/16x16/actions/page-info-insecure.png
+theme_pageinfo_internal:*PROGDIR:Resources/icons/16x16/actions/page-info-internal.png
+theme_pageinfo_local:*PROGDIR:Resources/icons/16x16/actions/page-info-local.png
+theme_pageinfo_secure:*PROGDIR:Resources/icons/16x16/actions/page-info-secure.png
+theme_pageinfo_warning:*PROGDIR:Resources/icons/16x16/actions/page-info-warning.png
ptr_default:*PROGDIR:Resources/Pointers/Default
ptr_point:*PROGDIR:Resources/Pointers/Point
ptr_caret:*PROGDIR:Resources/Pointers/Caret
diff --git a/frontends/amiga/rtg.c b/frontends/amiga/rtg.c
index 5e1cac290..8618c0a33 100644
--- a/frontends/amiga/rtg.c
+++ b/frontends/amiga/rtg.c
@@ -26,9 +26,6 @@ struct BitMap *ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth,
ULONG flags, struct BitMap *friend, RGBFTYPE format)
{
if(P96Base == NULL) {
-#ifndef __amigaos4__
- if(depth > 8) depth = 8;
-#endif
return AllocBitMap(width, height, depth, flags, friend);
} else {
return p96AllocBitMap(width, height, depth, flags, friend, format);
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
deleted file mode 100644
index 854d6b085..000000000
--- a/frontends/amiga/sslcert.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright 2017 Chris Young <chris@unsatisfactorysoftware.co.uk>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * \file
- * Implementation of Amiga certificate viewing using core windows.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <proto/intuition.h>
-
-#include <classes/window.h>
-#include <gadgets/button.h>
-#include <gadgets/layout.h>
-#include <gadgets/scroller.h>
-#include <gadgets/space.h>
-#include <images/label.h>
-
-#include <intuition/icclass.h>
-#include <reaction/reaction_macros.h>
-
-#include "utils/log.h"
-#include "netsurf/keypress.h"
-#include "netsurf/plotters.h"
-#include "desktop/sslcert_viewer.h"
-#include "utils/messages.h"
-#include "utils/nsoption.h"
-
-#include "amiga/corewindow.h"
-#include "amiga/libs.h"
-#include "amiga/sslcert.h"
-#include "amiga/utf8.h"
-
-
-/**
- * Amiga certificate viewing window context
- */
-enum {
- GID_SSLCERT_ACCEPT = GID_CW_LAST,
- GID_SSLCERT_REJECT,
- GID_SSLCERT_LAST
-};
-
-#define GID_SSLCERT_SIZE GID_SSLCERT_LAST - GID_CW_LAST
-
-struct ami_crtvrfy_window {
- /** Amiga core window context */
- struct ami_corewindow core;
-
- /** Amiga GUI stuff */
- Object *sslcert_objects[GID_SSLCERT_LAST]; // technically wasting a few bytes here
-
- char *sslerr;
- char *sslaccept;
- char *sslreject;
-
- /** SSL certificate viewer context data */
- struct sslcert_session_data *ssl_data;
-};
-
-/**
- * destroy a previously created certificate view
- */
-static nserror
-ami_crtvrfy_destroy(struct ami_crtvrfy_window *crtvrfy_win)
-{
- nserror res;
-
- res = sslcert_viewer_fini(crtvrfy_win->ssl_data);
- if (res == NSERROR_OK) {
- ami_utf8_free(crtvrfy_win->sslerr);
- ami_utf8_free(crtvrfy_win->sslaccept);
- ami_utf8_free(crtvrfy_win->sslreject);
- res = ami_corewindow_fini(&crtvrfy_win->core); /* closes the window for us */
- }
- return res;
-}
-
-static void
-ami_crtvrfy_accept(struct ami_corewindow *ami_cw)
-{
- struct ami_crtvrfy_window *crtvrfy_win;
- /* technically degenerate container of */
- crtvrfy_win = (struct ami_crtvrfy_window *)ami_cw;
-
- sslcert_viewer_accept(crtvrfy_win->ssl_data);
-
- ami_crtvrfy_destroy(crtvrfy_win);
-}
-
-static void
-ami_crtvrfy_reject(struct ami_corewindow *ami_cw)
-{
- struct ami_crtvrfy_window *crtvrfy_win;
- /* technically degenerate container of */
- crtvrfy_win = (struct ami_crtvrfy_window *)ami_cw;
-
- sslcert_viewer_reject(crtvrfy_win->ssl_data);
-
- ami_crtvrfy_destroy(crtvrfy_win);
-}
-
-/**
- * callback for unknown events on Amiga core window
- * eg. buttons in the ssl cert window
- * (result & WMHI_CLASSMASK) gives the class of event (eg. WMHI_GADGETUP)
- * (result & WMHI_GADGETMASK) gives the gadget ID (eg. GID_SSLCERT_ACCEPT)
- *
- * \param ami_cw The Amiga core window structure.
- * \param result event as returned by RA_HandleInput()
- * \return TRUE if window closed during event processing
- */
-static BOOL
-ami_crtvrfy_event(struct ami_corewindow *ami_cw, ULONG result)
-{
- if((result & WMHI_CLASSMASK) == WMHI_GADGETUP) {
- switch(result & WMHI_GADGETMASK) {
- case GID_SSLCERT_ACCEPT:
- ami_crtvrfy_accept(ami_cw);
- return TRUE;
- break;
-
- case GID_SSLCERT_REJECT:
- ami_crtvrfy_reject(ami_cw);
- return TRUE;
- break;
- }
- }
- return FALSE;
-}
-
-/**
- * callback for mouse action for certificate verify on core window
- *
- * \param ami_cw The Amiga core window structure.
- * \param mouse_state netsurf mouse state on event
- * \param x location of event
- * \param y location of event
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-ami_crtvrfy_mouse(struct ami_corewindow *ami_cw,
- browser_mouse_state mouse_state,
- int x, int y)
-{
- struct ami_crtvrfy_window *crtvrfy_win;
- /* technically degenerate container of */
- crtvrfy_win = (struct ami_crtvrfy_window *)ami_cw;
-
- sslcert_viewer_mouse_action(crtvrfy_win->ssl_data, mouse_state, x, y);
-
- return NSERROR_OK;
-}
-
-/**
- * callback for keypress for certificate verify on core window
- *
- * \param ami_cw The Amiga core window structure.
- * \param nskey The netsurf key code
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-ami_crtvrfy_key(struct ami_corewindow *ami_cw, uint32_t nskey)
-{
- struct ami_crtvrfy_window *crtvrfy_win;
-
- /* technically degenerate container of */
- crtvrfy_win = (struct ami_crtvrfy_window *)ami_cw;
-
- if (sslcert_viewer_keypress(crtvrfy_win->ssl_data, nskey)) {
- return NSERROR_OK;
- }
- return NSERROR_NOT_IMPLEMENTED;
-}
-
-/**
- * callback on draw event for certificate verify on core window
- *
- * \param ami_cw The Amiga core window structure.
- * \param x the x coordinate to draw
- * \param y the y coordinate to draw
- * \param r The rectangle of the window that needs updating.
- * \param ctx The drawing context
- * \return NSERROR_OK on success otherwise apropriate error code
- */
-static nserror
-ami_crtvrfy_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
-{
- struct ami_crtvrfy_window *crtvrfy_win;
-
- /* technically degenerate container of */
- crtvrfy_win = (struct ami_crtvrfy_window *)ami_cw;
-
- sslcert_viewer_redraw(crtvrfy_win->ssl_data, x, y, r, ctx);
-
- return NSERROR_OK;
-}
-
-static nserror
-ami_crtvrfy_create_window(struct ami_crtvrfy_window *crtvrfy_win)
-{
- struct ami_corewindow *ami_cw = (struct ami_corewindow *)&crtvrfy_win->core;
- ULONG refresh_mode = WA_SmartRefresh;
- struct Screen *scrn = ami_gui_get_screen();
-
- if(nsoption_bool(window_simple_refresh) == true) {
- refresh_mode = WA_SimpleRefresh;
- }
-
- ami_cw->objects[GID_CW_WIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, ami_cw->wintitle,
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, FALSE,
- WA_SizeGadget, TRUE,
- WA_SizeBBottom, TRUE,
- WA_Height, scrn->Height / 2,
- WA_PubScreen, scrn,
- WA_ReportMouse, TRUE,
- refresh_mode, TRUE,
- WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
- IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
- IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
- WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
- WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
- IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
- WINDOW_SharedPort, ami_gui_get_shared_msgport(),
- WINDOW_UserData, crtvrfy_win,
- /* WINDOW_NewMenu, twin->menu, -> No menu for SSL Cert */
- WINDOW_IconifyGadget, FALSE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
- LAYOUT_AddImage, LabelObj,
- LABEL_Text, crtvrfy_win->sslerr,
- LabelEnd,
- LAYOUT_AddChild, ami_cw->objects[GID_CW_HSCROLLLAYOUT] = LayoutVObj,
- LAYOUT_AddChild, ami_cw->objects[GID_CW_VSCROLLLAYOUT] = LayoutHObj,
- LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
- GA_ID, GID_CW_DRAW,
- SPACE_Transparent, TRUE,
- SPACE_BevelStyle, BVS_DISPLAY,
- GA_RelVerify, TRUE,
- SpaceEnd,
- LAYOUT_AddChild, ami_cw->objects[GID_CW_VSCROLL] = ScrollerObj,
- GA_ID, GID_CW_VSCROLL,
- GA_RelVerify, TRUE,
- ICA_TARGET, ICTARGET_IDCMP,
- ScrollerEnd,
- LayoutEnd,
- LAYOUT_AddChild, ami_cw->objects[GID_CW_HSCROLL] = ScrollerObj,
- GA_ID, GID_CW_HSCROLL,
- GA_RelVerify, TRUE,
- ICA_TARGET, ICTARGET_IDCMP,
- SCROLLER_Orientation, SORIENT_HORIZ,
- ScrollerEnd,
- LayoutEnd,
- LAYOUT_AddChild, LayoutHObj,
- LAYOUT_AddChild, crtvrfy_win->sslcert_objects[GID_SSLCERT_ACCEPT] = ButtonObj,
- GA_ID, GID_SSLCERT_ACCEPT,
- GA_Text, crtvrfy_win->sslaccept,
- GA_RelVerify, TRUE,
- ButtonEnd,
- LAYOUT_AddChild, crtvrfy_win->sslcert_objects[GID_SSLCERT_REJECT] = ButtonObj,
- GA_ID, GID_SSLCERT_REJECT,
- GA_Text, crtvrfy_win->sslreject,
- GA_RelVerify, TRUE,
- ButtonEnd,
- EndGroup,
- CHILD_WeightedHeight, 0,
- EndGroup,
- EndWindow;
-
- if(ami_cw->objects[GID_CW_WIN] == NULL) {
- return NSERROR_NOMEM;
- }
-
- return NSERROR_OK;
-}
-
-/* exported interface documented in amiga/ssl_cert.h */
-nserror ami_cert_verify(struct nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
-{
- struct ami_crtvrfy_window *ncwin;
- nserror res;
-
- ncwin = calloc(1, sizeof(struct ami_crtvrfy_window));
- if (ncwin == NULL) {
- return NSERROR_NOMEM;
- }
-
- ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("SSLCerts"));
- ncwin->sslerr = ami_utf8_easy((char *)messages_get("SSLError"));
- ncwin->sslaccept = ami_utf8_easy((char *)messages_get("SSL_Certificate_Accept"));
- ncwin->sslreject = ami_utf8_easy((char *)messages_get("SSL_Certificate_Reject"));
-
- res = ami_crtvrfy_create_window(ncwin);
- if (res != NSERROR_OK) {
- NSLOG(netsurf, INFO, "SSL UI builder init failed");
- ami_utf8_free(ncwin->core.wintitle);
- ami_utf8_free(ncwin->sslerr);
- ami_utf8_free(ncwin->sslaccept);
- ami_utf8_free(ncwin->sslreject);
- free(ncwin);
- return res;
- }
-
- /* initialise Amiga core window */
- ncwin->core.draw = ami_crtvrfy_draw;
- ncwin->core.key = ami_crtvrfy_key;
- ncwin->core.mouse = ami_crtvrfy_mouse;
- ncwin->core.close = ami_crtvrfy_reject;
- ncwin->core.event = ami_crtvrfy_event;
-
- res = ami_corewindow_init(&ncwin->core);
- if (res != NSERROR_OK) {
- ami_utf8_free(ncwin->core.wintitle);
- ami_utf8_free(ncwin->sslerr);
- ami_utf8_free(ncwin->sslaccept);
- ami_utf8_free(ncwin->sslreject);
- DisposeObject(ncwin->core.objects[GID_CW_WIN]);
- free(ncwin);
- return res;
- }
-
- /* initialise certificate viewing interface */
- res = sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
- &ncwin->ssl_data);
- if (res != NSERROR_OK) {
- ami_utf8_free(ncwin->core.wintitle);
- ami_utf8_free(ncwin->sslerr);
- ami_utf8_free(ncwin->sslaccept);
- ami_utf8_free(ncwin->sslreject);
- DisposeObject(ncwin->core.objects[GID_CW_WIN]);
- free(ncwin);
- return res;
- }
-
- res = sslcert_viewer_init(ncwin->core.cb_table,
- (struct core_window *)ncwin,
- ncwin->ssl_data);
- if (res != NSERROR_OK) {
- ami_utf8_free(ncwin->core.wintitle);
- ami_utf8_free(ncwin->sslerr);
- ami_utf8_free(ncwin->sslaccept);
- ami_utf8_free(ncwin->sslreject);
- DisposeObject(ncwin->core.objects[GID_CW_WIN]);
- free(ncwin);
- return res;
- }
-
- return NSERROR_OK;
-}
-
diff --git a/frontends/amiga/stringview/stringview.c b/frontends/amiga/stringview/stringview.c
index 245782b43..60c694a3c 100755
--- a/frontends/amiga/stringview/stringview.c
+++ b/frontends/amiga/stringview/stringview.c
@@ -161,7 +161,7 @@ static uint32 myStringSearch( Class *cl, Object *obj )
if(searchString)
{
searchString += 3;
- if (bufpos >= searchString - data->SearchBuffer)
+ if (bufpos >= (uint32)(searchString - data->SearchBuffer))
bufpos -= searchString - data->SearchBuffer;
}
else
@@ -848,7 +848,7 @@ Class *MakeStringClass( void )
if ( cl )
{
- cl->cl_Dispatcher.h_Entry = (uint32(*)())myStringClassDispatcher;
+ cl->cl_Dispatcher.h_Entry = (uint32(*)(void))myStringClassDispatcher;
}
URLHistory_Init();
diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c
index 5d05e9535..fabb1e24c 100755
--- a/frontends/amiga/utf8.c
+++ b/frontends/amiga/utf8.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-2021 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -22,6 +22,7 @@
#include <string.h>
#include <sys/types.h>
+#include <proto/codesets.h>
#include <proto/exec.h>
#include <proto/utility.h>
@@ -31,20 +32,73 @@
#include "amiga/utf8.h"
+static nserror ami_utf8_codesets(const char *string, size_t len, char **result, bool to_local)
+{
+ char *out;
+ ULONG utf8_tag = CSA_SourceCodeset, local_tag = CSA_DestCodeset, len_tag = CSA_SourceLen;
+ static struct codeset *utf8_cs = NULL;
+ static struct codeset *local_cs = NULL;
+
+ if(local_cs == NULL) local_cs = CodesetsFind(NULL,
+#ifdef __amigaos4__
+ CSA_MIBenum, nsoption_int(local_codeset),
+#else
+ NULL,
+#endif
+ TAG_DONE);
+
+ if(utf8_cs == NULL) utf8_cs = CodesetsFind(NULL,
+ CSA_MIBenum, CS_MIBENUM_UTF_8,
+ TAG_DONE);
+
+ if(to_local == false) {
+ local_tag = CSA_SourceCodeset;
+ utf8_tag = CSA_DestCodeset;
+ }
+
+ if(len == 0) len_tag = TAG_IGNORE;
+
+ out = CodesetsConvertStr(CSA_Source, string,
+ len_tag, len,
+#ifdef __amigaos4__
+ local_tag, local_cs,
+#endif
+ utf8_tag, utf8_cs,
+ CSA_MapForeignChars, TRUE,
+ TAG_DONE);
+
+ if(out != NULL) {
+ *result = strdup(out);
+ CodesetsFreeA(out, NULL);
+ } else {
+ return NSERROR_BAD_ENCODING;
+ }
+
+ return NSERROR_OK;
+}
+
nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
{
- return utf8_from_enc(string, nsoption_charp(local_charset), len, result, NULL);
+ if(__builtin_expect((CodesetsBase == NULL), 0)) {
+ return utf8_from_enc(string, nsoption_charp(local_charset), len, result, NULL);
+ } else {
+ return ami_utf8_codesets(string, len, result, false);
+ }
}
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
{
- nserror err = NSERROR_NOMEM;
- char *local_charset = ASPrintf("%s//IGNORE", nsoption_charp(local_charset));
- if(local_charset) {
- err = utf8_to_enc(string, local_charset, len, result);
- FreeVec(local_charset);
+ if(__builtin_expect((CodesetsBase == NULL), 0)) {
+ nserror err = NSERROR_NOMEM;
+ char *local_charset = ASPrintf("%s//IGNORE", nsoption_charp(local_charset));
+ if(local_charset) {
+ err = utf8_to_enc(string, local_charset, len, result);
+ FreeVec(local_charset);
+ }
+ return err;
+ } else {
+ return ami_utf8_codesets(string, len, result, true);
}
- return err;
}
void ami_utf8_free(char *ptr)
diff --git a/frontends/amiga/version.c b/frontends/amiga/version.c
index 57258e0b5..ae898cb83 100644
--- a/frontends/amiga/version.c
+++ b/frontends/amiga/version.c
@@ -25,7 +25,7 @@
* problems created by "0" not being a valid AmigaOS revision number.
*/
#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "10"
+#define NETSURF_VERSION_MINOR_EXTERNAL "12"
#if defined(CI_BUILD)
#define NETSURF_VERSION_MINOR CI_BUILD
#else