Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/5eb7ee97ed641e152c488dab6c33c37d0635e48b
...commit
http://git.netsurf-browser.org/netsurf.git/commit/5eb7ee97ed641e152c488dab6c33c37d0635e48b
...tree
http://git.netsurf-browser.org/netsurf.git/tree/5eb7ee97ed641e152c488dab6c33c37d0635e48b
The branch, chris/amiga-corewindow has been updated
via 5eb7ee97ed641e152c488dab6c33c37d0635e48b (commit)
via 3b1ef784fd53095213fa8b89806982567359dca4 (commit)
via eb63c1cc50847b88e598cdf0f775814a43a2799e (commit)
via a5222b579b8202f130e0afceb570b6e700385efe (commit)
via e3b2f792c0250d219dc56976f8305a05b6b04e36 (commit)
via 24b7fdf4382dcef274092b4735093fc390815455 (commit)
from 2bd8eb8c0b468799109191e63e939ea7bd69f8a1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=5eb7ee97ed641e152c488dab6c33c37d0635e48b
commit 5eb7ee97ed641e152c488dab6c33c37d0635e48b
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Basic conversion of cookie manager to core window
slightly broken; blank window until resized; scroll bar wrong; no menu
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
old mode 100755
new mode 100644
index 15f6dce..29e41de
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <[email protected]>
+ * Copyright 2017 Chris Young <[email protected]>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,26 +16,216 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <proto/exec.h>
+/**
+ * \file
+ * Implementation of Amiga cookie viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
+
+#include <reaction/reaction_macros.h>
#include "desktop/cookie_manager.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/libs.h"
+#include "amiga/utf8.h"
+
+
+/**
+ * Amiga cookie viewer window context
+ */
+struct ami_cookie_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+};
+
+static struct ami_cookie_window *cookie_window = NULL;
+
+/**
+ * destroy a previously created cookie view
+ */
+static nserror
+ami_cookies_destroy(void)
+{
+ nserror res;
+
+ if(cookie_window == NULL)
+ return NSERROR_OK;
+
+ res = cookie_manager_fini();
+ if (res == NSERROR_OK) {
+ res = ami_corewindow_fini(&cookie_window->core); /* closes the
window for us */
+ cookie_window = NULL;
+ }
+ return res;
+}
+
+
+/**
+ * callback for mouse action for cookie viewer 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_cookies_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ cookie_manager_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
-#include "amiga/cookies.h"
-#include "amiga/tree.h"
+/**
+ * callback for keypress for cookies viewer on core window
+ *
+ * \param example_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_cookies_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (cookie_manager_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
-struct treeview_window *cookies_window;
+/**
+ * callback on draw event for cookies viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \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_cookies_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r,
struct redraw_context *ctx)
+{
+ cookie_manager_redraw(x, y, r, ctx);
-void ami_cookies_initialise(void)
+ return NSERROR_OK;
+}
+
+static nserror
+ami_cookies_create_window(struct ami_cookie_window *cookie_win)
{
- cookies_window = ami_tree_create(TREE_COOKIES, NULL);
+ struct ami_corewindow *ami_cw = (struct ami_corewindow
*)&cookie_win->core;
+
+ 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, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(cookies_window_ypos),
+ WA_Left, nsoption_int(cookies_window_xpos),
+ WA_Width, nsoption_int(cookies_window_xsize),
+ WA_Height, nsoption_int(cookies_window_ysize),
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_GADGETUP |
IDCMP_IDCMPUPDATE |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, cookie_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_AddChild, ami_cw->objects[GID_CW_DRAW] =
SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
- if(!cookies_window) return;
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
}
-void ami_cookies_free()
+/* exported interface documented in amiga/cookies.h */
+nserror ami_cookies_present(void)
{
- ami_tree_destroy(cookies_window);
- cookies_window = NULL;
+ struct ami_cookie_window *ncwin;
+ nserror res;
+
+ if(cookie_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_cookie_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+
+ res = ami_cookies_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_cookies_draw;
+ ncwin->core.key = ami_cookies_key;
+ ncwin->core.mouse = ami_cookies_mouse;
+ ncwin->core.close = ami_cookies_destroy;
+ ncwin->core.event = NULL;
+
+ 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 = cookie_manager_init(ncwin->core.cb_table, (struct core_window
*)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ cookie_window = ncwin;
+
+ return NSERROR_OK;
}
+
diff --git a/frontends/amiga/cookies.h b/frontends/amiga/cookies.h
old mode 100755
new mode 100644
index 157091d..6858e4c
--- a/frontends/amiga/cookies.h
+++ b/frontends/amiga/cookies.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <[email protected]>
+ * Copyright 2017 Chris Young <[email protected]>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -18,11 +18,8 @@
#ifndef AMIGA_COOKIES_H
#define AMIGA_COOKIES_H
-#include "amiga/desktop-tree.h"
-#include "amiga/tree.h"
-void ami_cookies_initialise(void);
-void ami_cookies_free(void);
-
-extern struct treeview_window *cookies_window;
+/** Open the cookie viewer */
+nserror ami_cookies_present(void);
#endif
+
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 38b980a..e5d289a 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -627,7 +627,7 @@ ami_cw_update_size(struct core_window *cw, int width, int
height)
if(ami_cw->objects[GID_CW_VSCROLL]) {
ami_cw_toggle_scrollbar(ami_cw, true, true);
RefreshSetGadgetAttrs((struct Gadget
*)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL,
- SCROLLER_Total, (ULONG)height,
+ SCROLLER_Total, height,
SCROLLER_Visible, win_h,
TAG_DONE);
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index f94090b..3af51a0 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -536,6 +536,17 @@ STRPTR ami_gui_get_screen_title(void)
static void ami_set_screen_defaults(struct Screen *screen)
{
+ /* various window size/position defaults */
+ int width = screen->Width / 2;
+ int height = screen->Height / 2;
+ int top = (screen->Height / 2) - (height / 2);
+ int left = (screen->Width / 2) - (width / 2);
+
+ nsoption_default_set_int(cookies_window_ypos, top);
+ nsoption_default_set_int(cookies_window_xpos, left);
+ nsoption_default_set_int(cookies_window_xsize, width);
+ nsoption_default_set_int(cookies_window_ysize, height);
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1003,7 +1014,6 @@ static void gui_init2(int argc, char** argv)
/**/
ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_cookies_initialise();
ami_global_history_initialise();
search_web_select_provider(nsoption_int(search_provider));
@@ -3028,7 +3038,6 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_cookies_free();
ami_global_history_free();
#ifdef __amigaos4__
if(IApplication && ami_appid)
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index dc5514b..cd72269 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -358,7 +358,7 @@ HOOKF(void, ami_menu_item_browser_globalhistory, APTR,
window, struct IntuiMessa
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(cookies_window,AMI_TREE_COOKIES);
+ ami_cookies_present();
}
HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index d56a1fe..28f3a4d 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -313,7 +313,7 @@ nserror ami_cert_verify(struct nsurl *url,
return res;
}
- /* initialise example core window */
+ /* initialise Amiga core window */
ncwin->core.draw = ami_crtvrfy_draw;
ncwin->core.key = ami_crtvrfy_key;
ncwin->core.mouse = ami_crtvrfy_mouse;
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/cookies.c | 216 +++++++++++++++++++++++++++++--
frontends/amiga/cookies.h | 11 +-
frontends/amiga/corewindow.c | 2 +-
frontends/amiga/gui.c | 13 +-
frontends/amiga/menu.c | 2 +-
frontends/amiga/sslcert.c | 2 +-
frontends/framebuffer/Makefile.defaults | 2 +-
frontends/framebuffer/font_freetype.c | 9 +-
frontends/framebuffer/font_internal.c | 8 +-
frontends/windows/font.c | 24 ++--
10 files changed, 244 insertions(+), 45 deletions(-)
mode change 100755 => 100644 frontends/amiga/cookies.c
mode change 100755 => 100644 frontends/amiga/cookies.h
diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c
old mode 100755
new mode 100644
index 15f6dce..29e41de
--- a/frontends/amiga/cookies.c
+++ b/frontends/amiga/cookies.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <[email protected]>
+ * Copyright 2017 Chris Young <[email protected]>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,26 +16,216 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <proto/exec.h>
+/**
+ * \file
+ * Implementation of Amiga cookie viewer using core windows.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <proto/intuition.h>
+
+#include <classes/window.h>
+#include <gadgets/layout.h>
+#include <gadgets/space.h>
+
+#include <reaction/reaction_macros.h>
#include "desktop/cookie_manager.h"
-#include "netsurf/mouse.h"
-#include "netsurf/window.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/nsoption.h"
+
+#include "amiga/corewindow.h"
+#include "amiga/libs.h"
+#include "amiga/utf8.h"
+
+
+/**
+ * Amiga cookie viewer window context
+ */
+struct ami_cookie_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
+};
+
+static struct ami_cookie_window *cookie_window = NULL;
+
+/**
+ * destroy a previously created cookie view
+ */
+static nserror
+ami_cookies_destroy(void)
+{
+ nserror res;
+
+ if(cookie_window == NULL)
+ return NSERROR_OK;
+
+ res = cookie_manager_fini();
+ if (res == NSERROR_OK) {
+ res = ami_corewindow_fini(&cookie_window->core); /* closes the
window for us */
+ cookie_window = NULL;
+ }
+ return res;
+}
+
+
+/**
+ * callback for mouse action for cookie viewer 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_cookies_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ cookie_manager_mouse_action(mouse_state, x, y);
+
+ return NSERROR_OK;
+}
-#include "amiga/cookies.h"
-#include "amiga/tree.h"
+/**
+ * callback for keypress for cookies viewer on core window
+ *
+ * \param example_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_cookies_key(struct ami_corewindow *ami_cw, uint32_t nskey)
+{
+ if (cookie_manager_keypress(nskey)) {
+ return NSERROR_OK;
+ }
+ return NSERROR_NOT_IMPLEMENTED;
+}
-struct treeview_window *cookies_window;
+/**
+ * callback on draw event for cookies viewer on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \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_cookies_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r,
struct redraw_context *ctx)
+{
+ cookie_manager_redraw(x, y, r, ctx);
-void ami_cookies_initialise(void)
+ return NSERROR_OK;
+}
+
+static nserror
+ami_cookies_create_window(struct ami_cookie_window *cookie_win)
{
- cookies_window = ami_tree_create(TREE_COOKIES, NULL);
+ struct ami_corewindow *ami_cw = (struct ami_corewindow
*)&cookie_win->core;
+
+ 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, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Top, nsoption_int(cookies_window_ypos),
+ WA_Left, nsoption_int(cookies_window_xpos),
+ WA_Width, nsoption_int(cookies_window_xsize),
+ WA_Height, nsoption_int(cookies_window_ysize),
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_GADGETUP |
IDCMP_IDCMPUPDATE |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, cookie_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_AddChild, ami_cw->objects[GID_CW_DRAW] =
SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
- if(!cookies_window) return;
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
}
-void ami_cookies_free()
+/* exported interface documented in amiga/cookies.h */
+nserror ami_cookies_present(void)
{
- ami_tree_destroy(cookies_window);
- cookies_window = NULL;
+ struct ami_cookie_window *ncwin;
+ nserror res;
+
+ if(cookie_window != NULL) {
+ //windowtofront()
+ return NSERROR_OK;
+ }
+
+ ncwin = calloc(1, sizeof(struct ami_cookie_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("Cookies"));
+
+ res = ami_cookies_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
+ }
+
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_cookies_draw;
+ ncwin->core.key = ami_cookies_key;
+ ncwin->core.mouse = ami_cookies_mouse;
+ ncwin->core.close = ami_cookies_destroy;
+ ncwin->core.event = NULL;
+
+ 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 = cookie_manager_init(ncwin->core.cb_table, (struct core_window
*)ncwin);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ cookie_window = ncwin;
+
+ return NSERROR_OK;
}
+
diff --git a/frontends/amiga/cookies.h b/frontends/amiga/cookies.h
old mode 100755
new mode 100644
index 157091d..6858e4c
--- a/frontends/amiga/cookies.h
+++ b/frontends/amiga/cookies.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <[email protected]>
+ * Copyright 2017 Chris Young <[email protected]>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -18,11 +18,8 @@
#ifndef AMIGA_COOKIES_H
#define AMIGA_COOKIES_H
-#include "amiga/desktop-tree.h"
-#include "amiga/tree.h"
-void ami_cookies_initialise(void);
-void ami_cookies_free(void);
-
-extern struct treeview_window *cookies_window;
+/** Open the cookie viewer */
+nserror ami_cookies_present(void);
#endif
+
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 38b980a..e5d289a 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -627,7 +627,7 @@ ami_cw_update_size(struct core_window *cw, int width, int
height)
if(ami_cw->objects[GID_CW_VSCROLL]) {
ami_cw_toggle_scrollbar(ami_cw, true, true);
RefreshSetGadgetAttrs((struct Gadget
*)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL,
- SCROLLER_Total, (ULONG)height,
+ SCROLLER_Total, height,
SCROLLER_Visible, win_h,
TAG_DONE);
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index f94090b..3af51a0 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -536,6 +536,17 @@ STRPTR ami_gui_get_screen_title(void)
static void ami_set_screen_defaults(struct Screen *screen)
{
+ /* various window size/position defaults */
+ int width = screen->Width / 2;
+ int height = screen->Height / 2;
+ int top = (screen->Height / 2) - (height / 2);
+ int left = (screen->Width / 2) - (width / 2);
+
+ nsoption_default_set_int(cookies_window_ypos, top);
+ nsoption_default_set_int(cookies_window_xpos, left);
+ nsoption_default_set_int(cookies_window_xsize, width);
+ nsoption_default_set_int(cookies_window_ysize, height);
+
nsoption_default_set_int(window_x, 0);
nsoption_default_set_int(window_y, screen->BarHeight + 1);
nsoption_default_set_int(window_width, screen->Width);
@@ -1003,7 +1014,6 @@ static void gui_init2(int argc, char** argv)
/**/
ami_hotlist_initialise(nsoption_charp(hotlist_file));
- ami_cookies_initialise();
ami_global_history_initialise();
search_web_select_provider(nsoption_int(search_provider));
@@ -3028,7 +3038,6 @@ static void gui_quit(void)
urldb_save(nsoption_charp(url_file));
urldb_save_cookies(nsoption_charp(cookie_file));
ami_hotlist_free(nsoption_charp(hotlist_file));
- ami_cookies_free();
ami_global_history_free();
#ifdef __amigaos4__
if(IApplication && ami_appid)
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index dc5514b..cd72269 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -358,7 +358,7 @@ HOOKF(void, ami_menu_item_browser_globalhistory, APTR,
window, struct IntuiMessa
HOOKF(void, ami_menu_item_browser_cookies, APTR, window, struct IntuiMessage *)
{
- ami_tree_open(cookies_window,AMI_TREE_COOKIES);
+ ami_cookies_present();
}
HOOKF(void, ami_menu_item_browser_foreimg, APTR, window, struct IntuiMessage *)
diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c
index d56a1fe..28f3a4d 100644
--- a/frontends/amiga/sslcert.c
+++ b/frontends/amiga/sslcert.c
@@ -313,7 +313,7 @@ nserror ami_cert_verify(struct nsurl *url,
return res;
}
- /* initialise example core window */
+ /* initialise Amiga core window */
ncwin->core.draw = ami_crtvrfy_draw;
ncwin->core.key = ami_crtvrfy_key;
ncwin->core.mouse = ami_crtvrfy_mouse;
diff --git a/frontends/framebuffer/Makefile.defaults
b/frontends/framebuffer/Makefile.defaults
index 92d837e..cc712e9 100644
--- a/frontends/framebuffer/Makefile.defaults
+++ b/frontends/framebuffer/Makefile.defaults
@@ -47,5 +47,5 @@ NETSURF_FRAMEBUFFER_RESOURCES := $(PREFIX)/share/netsurf/
NETSURF_FB_RESPATH :=
$${HOME}/.netsurf/:$${NETSURFRES}:$(NETSURF_FRAMEBUFFER_RESOURCES):./frontends/framebuffer/res
# freetype compiled in font serch path
-NETSURF_FB_FONTPATH :=
/usr/share/fonts/truetype/ttf-dejavu:/usr/share/fonts/truetype/msttcorefonts
+NETSURF_FB_FONTPATH :=
/usr/share/fonts/truetype/dejavu:/usr/share/fonts/truetype/msttcorefonts
diff --git a/frontends/framebuffer/font_freetype.c
b/frontends/framebuffer/font_freetype.c
index 9235ad4..3239820 100644
--- a/frontends/framebuffer/font_freetype.c
+++ b/frontends/framebuffer/font_freetype.c
@@ -444,8 +444,7 @@ fb_font_width(const plot_font_style_t *fstyle,
*width += glyph->advance.x >> 16;
}
-
- return true;
+ return NSERROR_OK;
}
@@ -481,7 +480,7 @@ fb_font_position(const plot_font_style_t *fstyle,
*actual_x = prev_x;
*char_offset = nxtchr;
- return true;
+ return NSERROR_OK;
}
@@ -537,7 +536,7 @@ fb_font_split(const plot_font_style_t *fstyle,
* found a space; return previous space */
*actual_x = last_space_x;
*char_offset = last_space_idx;
- return true;
+ return NSERROR_OK;
}
nxtchr = utf8_next(string, length, nxtchr);
@@ -545,7 +544,7 @@ fb_font_split(const plot_font_style_t *fstyle,
*char_offset = nxtchr;
- return true;
+ return NSERROR_OK;
}
static struct gui_layout_table layout_table = {
diff --git a/frontends/framebuffer/font_internal.c
b/frontends/framebuffer/font_internal.c
index 9164a29..3fd3ac6 100644
--- a/frontends/framebuffer/font_internal.c
+++ b/frontends/framebuffer/font_internal.c
@@ -364,7 +364,7 @@ fb_font_width(const plot_font_style_t *fstyle,
}
*width *= fb_get_font_size(fstyle);
- return true;
+ return NSERROR_OK;
}
@@ -397,7 +397,7 @@ fb_font_position(const plot_font_style_t *fstyle,
*actual_x = x_pos;
*char_offset = nxtchr;
- return true;
+ return NSERROR_OK;
}
@@ -455,7 +455,7 @@ fb_font_split(const plot_font_style_t *fstyle,
* found a space; return previous space */
*actual_x = last_space_x;
*char_offset = last_space_idx;
- return true;
+ return NSERROR_OK;
}
nxtchr = utf8_next(string, length, nxtchr);
@@ -463,7 +463,7 @@ fb_font_split(const plot_font_style_t *fstyle,
*char_offset = nxtchr;
- return true;
+ return NSERROR_OK;
}
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index 551a0eb..1e99a78 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -138,7 +138,7 @@ HFONT get_font(const plot_font_style_t *style)
* \param[in] string UTF-8 string to measure
* \param[in] length length of string, in bytes
* \param[out] width updated to width of string[0..length)
- * \return true on success and width updated else false
+ * \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
win32_font_width(const plot_font_style_t *style,
@@ -150,7 +150,7 @@ win32_font_width(const plot_font_style_t *style,
HFONT font;
HFONT fontbak;
SIZE s;
- bool ret = true;
+ nserror ret = NSERROR_OK;
if (length == 0) {
*width = 0;
@@ -163,7 +163,7 @@ win32_font_width(const plot_font_style_t *style,
if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) {
*width = s.cx;
} else {
- ret = false;
+ ret = NSERROR_UNKNOWN;
}
font = SelectObject(hdc, fontbak);
DeleteObject(font);
@@ -183,7 +183,7 @@ win32_font_width(const plot_font_style_t *style,
* \param x x coordinate to search for
* \param char_offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
+ * \return NSERROR_OK on success otherwise apropriate error code
*/
static nserror
win32_font_position(const plot_font_style_t *style,
@@ -198,7 +198,7 @@ win32_font_position(const plot_font_style_t *style,
HFONT fontbak;
SIZE s;
int offset;
- bool ret = true;
+ nserror ret = NSERROR_OK;
if ((length == 0) || (x < 1)) {
*char_offset = 0;
@@ -213,7 +213,7 @@ win32_font_position(const plot_font_style_t *style,
*char_offset = (size_t)offset;
*actual_x = s.cx;
} else {
- ret = false;
+ ret = NSERROR_UNKNOWN;
}
font = SelectObject(hdc, fontbak);
DeleteObject(font);
@@ -234,7 +234,7 @@ win32_font_position(const plot_font_style_t *style,
* \param x width available
* \param char_offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
- * \return true on success, false on error and error reported
+ * \return NSERROR_OK on success otherwise apropriate error code
*
* On exit, [char_offset == 0 ||
* string[char_offset] == ' ' ||
@@ -249,13 +249,14 @@ win32_font_split(const plot_font_style_t *style,
int *actual_x)
{
int c_off;
- bool ret = false;
+ nserror ret = NSERROR_UNKNOWN;
if (win32_font_position(style, string, length, x, char_offset,
actual_x)) {
c_off = *char_offset;
if (*char_offset == length) {
- ret = true;
+ ret = NSERROR_OK;
} else {
+ bool success;
while ((string[*char_offset] != ' ') &&
(*char_offset > 0)) {
(*char_offset)--;
@@ -269,7 +270,10 @@ win32_font_split(const plot_font_style_t *style,
}
}
- ret = win32_font_width(style, string, *char_offset,
actual_x);
+ success = win32_font_width(style, string, *char_offset,
actual_x);
+ if (success) {
+ ret = NSERROR_OK;
+ }
}
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org