netsurf: branch master updated. release/3.2-262-g784d893
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/784d893eb74a59eec212e...
...commit http://git.netsurf-browser.org/netsurf.git/commit/784d893eb74a59eec212e3d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/784d893eb74a59eec212e3d61...
The branch, master has been updated
via 784d893eb74a59eec212e3d61003b9eea53d5706 (commit)
from 36a3e58c061cd7328f3ccc7a0e2247760ca99aa1 (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=784d893eb74a59eec21...
commit 784d893eb74a59eec212e3d61003b9eea53d5706
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Avoid a crash on exit in kiosk mode
diff --git a/amiga/gui.c b/amiga/gui.c
index d91c7db..0cb8174 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1632,7 +1632,7 @@ static void ami_gui_refresh_favicon(void *p)
}
/* Gets the size that border gadget 1 (status) needs to be.
- * Returns the height of the size gadget as a convenience.
+ * Returns the width of the size gadget as a convenience.
*/
static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
{
@@ -3143,6 +3143,8 @@ static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List
struct Node *node;
struct Node *nnode;
+ if(nsoption_bool(kiosk_mode) == true) return;
+
if(IsListEmpty(speed_button_list)) return;
node = GetHead(speed_button_list);
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index d91c7db..0cb8174 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1632,7 +1632,7 @@ static void ami_gui_refresh_favicon(void *p)
}
/* Gets the size that border gadget 1 (status) needs to be.
- * Returns the height of the size gadget as a convenience.
+ * Returns the width of the size gadget as a convenience.
*/
static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
{
@@ -3143,6 +3143,8 @@ static void ami_gui_hotlist_toolbar_free(struct gui_window_2 *gwin, struct List
struct Node *node;
struct Node *nnode;
+ if(nsoption_bool(kiosk_mode) == true) return;
+
if(IsListEmpty(speed_button_list)) return;
node = GetHead(speed_button_list);
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-261-g36a3e58
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/36a3e58c061cd7328f3cc...
...commit http://git.netsurf-browser.org/netsurf.git/commit/36a3e58c061cd7328f3ccc7...
...tree http://git.netsurf-browser.org/netsurf.git/tree/36a3e58c061cd7328f3ccc7a0...
The branch, master has been updated
via 36a3e58c061cd7328f3ccc7a0e2247760ca99aa1 (commit)
via 340d74ae4fbef4825292614bc6df9b260287242c (commit)
via 80b195cdd50e98f3365bc57938bff7dbe4d0cc32 (commit)
from 17b87a60cffc067b7837b9db366b5cdd64d46810 (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=36a3e58c061cd7328f3...
commit 36a3e58c061cd7328f3ccc7a0e2247760ca99aa1
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Expand status bar to entire window width
diff --git a/amiga/gui.c b/amiga/gui.c
index 4d933f4..d91c7db 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -178,6 +178,7 @@ BOOL locked_screen = FALSE;
BOOL screen_closed = FALSE;
int screen_signal = -1;
ULONG sz_gad_width = 0;
+ULONG sz_gad_height = 0;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
@@ -200,8 +201,6 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
void ami_change_tab(struct gui_window_2 *gwin, int direction);
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
-static void ami_set_border_gadget_balance(struct gui_window_2 *gwin);
-static ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
void ami_quit_netsurf_delayed(void);
Object *ami_gui_splash_open(void);
void ami_gui_splash_close(Object *win_obj);
@@ -1632,6 +1631,45 @@ static void ami_gui_refresh_favicon(void *p)
gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
}
+/* Gets the size that border gadget 1 (status) needs to be.
+ * Returns the height of the size gadget as a convenience.
+ */
+static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
+{
+ ULONG available_width;
+
+ if((sz_gad_width == 0) || (sz_gad_height == 0)) {
+ struct DrawInfo *dri = GetScreenDrawInfo(scrn);
+ GetGUIAttrs(NULL, dri,
+ GUIA_SizeGadgetWidth, &sz_gad_width,
+ GUIA_SizeGadgetHeight, &sz_gad_height,
+ TAG_DONE);
+ FreeScreenDrawInfo(scrn, dri);
+ }
+
+ available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
+
+ *width = available_width;
+ *height = sz_gad_height;
+
+ return sz_gad_width;
+}
+
+static void ami_set_border_gadget_size(struct gui_window_2 *gwin)
+{
+ /* Reset gadget widths according to new calculation */
+ ULONG size1, size2, sz;
+
+ sz = ami_get_border_gadget_size(gwin, &size1, &size2);
+
+ RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
+ gwin->win, NULL,
+ GA_Width, size1,
+ TAG_DONE);
+
+ RefreshWindowFrame(gwin->win);
+}
+
static void ami_handle_msg(void)
{
ULONG result,storage = 0,x,y,xs,ys,width=800,height=600;
@@ -2329,7 +2367,7 @@ static void ami_handle_msg(void)
case AMINS_WINDOW:
ami_gui_vscroll_update(gwin);
- ami_set_border_gadget_balance(gwin);
+ ami_set_border_gadget_size(gwin);
ami_throbber_redraw_schedule(0, gwin->bw->window);
if(gwin->tabs)
@@ -3872,35 +3910,19 @@ gui_window_create(struct browser_window *bw,
if(nsoption_bool(kiosk_mode) == false)
{
- ULONG sz, size1, size2;
+ ULONG sz, width, height;
struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- sz = ami_get_border_gadget_balance(g->shared,
- (ULONG *)&size1, (ULONG *)&size2);
-/*
- g->shared->objects[GID_HSCROLL] = NewObject(
- NULL,
- "scrollergclass",
- GA_ID, GID_HSCROLL,
- PGA_Freedom, FREEHORIZ,
- GA_RelRight, 1 - size2 - sz,
- GA_Width, size2,
- GA_BottomBorder, TRUE,
- GA_Immediate, TRUE,
- ICA_TARGET, ICTARGET_IDCMP,
- GA_DrawInfo, dri,
- TAG_DONE);
+ sz = ami_get_border_gadget_size(g->shared,
+ (ULONG *)&width, (ULONG *)&height);
- GetAttr(GA_Height, (Object *)g->shared->objects[GID_HSCROLL],
- (ULONG *)&sz);
-*/ /* NB: sz should now be the height of the size gadget */
g->shared->objects[GID_STATUS] = NewObject(
NULL,
"frbuttonclass",
GA_ID, GID_STATUS,
GA_Left, scrn->WBorLeft + 2,
- GA_RelBottom, -((2 + sz + scrn->WBorBottom - scrn->RastPort.TxHeight)/2),
- GA_Width, size1,
+ GA_RelBottom, -((2 + height + scrn->WBorBottom - scrn->RastPort.TxHeight)/2),
+ GA_Width, width,
GA_DrawInfo, dri,
GA_BottomBorder, TRUE,
GA_ReadOnly, TRUE,
@@ -3915,7 +3937,6 @@ gui_window_create(struct browser_window *bw,
IA_Screen, scrn,
GAUGEIA_Level, 0,
TAG_DONE),
-// GA_Next, g->shared->objects[GID_HSCROLL],
TAG_DONE);
AddGList(g->shared->win, (struct Gadget *)g->shared->objects[GID_STATUS],
@@ -3925,7 +3946,7 @@ gui_window_create(struct browser_window *bw,
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
g->shared->win, NULL,
- GA_Width, size1,
+ GA_Width, width,
TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_STATUS],
@@ -3936,17 +3957,6 @@ gui_window_create(struct browser_window *bw,
ami_gui_hotlist_toolbar_add(g->shared); /* is this the right place for this? */
if(nsoption_bool(tab_always_show)) ami_toggletabbar(g->shared, true);
}
- else
- {
- GetAttr(WINDOW_HorizObject, g->shared->objects[OID_MAIN],
- (ULONG *)&g->shared->objects[OID_HSCROLL]);
-
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
- GA_ID, OID_HSCROLL,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
- }
g->shared->rmbtrapped = FALSE;
g->shared->bw = bw;
@@ -3969,52 +3979,6 @@ gui_window_create(struct browser_window *bw,
return g;
}
-static void ami_set_border_gadget_balance(struct gui_window_2 *gwin)
-{
- /* Reset gadget widths according to new calculation */
- ULONG size1, size2, sz;
-
- sz = ami_get_border_gadget_balance(gwin, &size1, &size2);
-
-/* RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_HSCROLL],
- gwin->win, NULL,
- GA_RelRight, - size2 - sz,
- GA_Width, size2,
- TAG_DONE);
-*/
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
- gwin->win, NULL,
- GA_Width, size1,
- TAG_DONE);
-
- RefreshWindowFrame(gwin->win);
-}
-
-static ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2)
-{
- /* Get the sizes that border gadget 1 (status) and 2 (hscroller) need to be.
- ** Returns the width of the size gadget as a convenience.
- */
-
- ULONG available_width;
- float gad1percent;
-
- if(sz_gad_width == 0) {
- struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- GetGUIAttrs(NULL, dri, GUIA_SizeGadgetWidth, &sz_gad_width, TAG_DONE);
- FreeScreenDrawInfo(scrn, dri);
- }
-
- available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
-
- gad1percent = nsoption_int(toolbar_status_size) / 10000.0;
-
- *size1 = (ULONG)(available_width * gad1percent);
- *size2 = (ULONG)(available_width * (1 - gad1percent));
-
- return sz_gad_width;
-}
-
void ami_close_all_tabs(struct gui_window_2 *gwin)
{
struct Node *tab;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=340d74ae4fbef482529...
commit 340d74ae4fbef4825292614bc6df9b260287242c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Make the new hscroller work properly
diff --git a/amiga/gui.c b/amiga/gui.c
index a617065..4d933f4 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3840,7 +3840,6 @@ gui_window_create(struct browser_window *bw,
IDCMP_RAWKEY | IDCMP_REFRESHWINDOW |
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
IDCMP_EXTENDEDMOUSE,
- WINDOW_HorizProp,1,
WINDOW_IDCMPHook,&g->shared->scrollerhook,
WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE |
IDCMP_EXTENDEDMOUSE | IDCMP_REFRESHWINDOW,
@@ -3977,12 +3976,12 @@ static void ami_set_border_gadget_balance(struct gui_window_2 *gwin)
sz = ami_get_border_gadget_balance(gwin, &size1, &size2);
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_HSCROLL],
+/* RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_HSCROLL],
gwin->win, NULL,
GA_RelRight, - size2 - sz,
GA_Width, size2,
TAG_DONE);
-
+*/
RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
gwin->win, NULL,
GA_Width, size1,
@@ -4655,11 +4654,9 @@ void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
{
if(gwin->objects[GID_HSCROLL])
{
- GetAttr(PGA_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
- }
- else if(gwin->objects[OID_HSCROLL])
- {
- GetAttr(SCROLLER_Top, gwin->objects[OID_HSCROLL], xs);
+ GetAttr(SCROLLER_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
+ } else {
+ *xs = 0;
}
*xs /= gwin->bw->scale;
@@ -4722,16 +4719,10 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Top, (ULONG)(sx * g->shared->bw->scale),
- TAG_DONE);
- }
- else if(g->shared->objects[OID_HSCROLL])
- {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
SCROLLER_Top, (ULONG)(sx * g->shared->bw->scale),
TAG_DONE);
}
+
ami_schedule_redraw(g->shared, true);
if(nsoption_bool(faster_scroll) == true) g->shared->redraw_scroll = true;
@@ -4772,14 +4763,6 @@ static void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
- PGA_Visible, bbox->Width,
- TAG_DONE);
- }
- else if(g->shared->objects[OID_HSCROLL])
- {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
SCROLLER_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
@@ -5022,7 +5005,6 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
switch( gid )
{
case GID_HSCROLL:
- case OID_HSCROLL:
case GID_VSCROLL:
if(nsoption_bool(faster_scroll) == true) gwin->redraw_scroll = true;
else gwin->redraw_scroll = false;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=80b195cdd50e98f3365...
commit 80b195cdd50e98f3365bc57938bff7dbe4d0cc32
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Move the hscrollbar inside the window
diff --git a/amiga/gui.c b/amiga/gui.c
index 03dae2c..a617065 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1435,6 +1435,45 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei
}
}
+/* Add a horizontal scroller, if not already present
+ * Returns true if changed, false otherwise */
+static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
+{
+ struct TagItem attrs[2];
+
+ if(gwin->objects[GID_HSCROLL] != NULL) return false;
+
+ attrs[0].ti_Tag = CHILD_MinWidth;
+ attrs[0].ti_Data = 0;
+ attrs[1].ti_Tag = TAG_DONE;
+ attrs[1].ti_Data = 0;
+
+ gwin->objects[GID_HSCROLL] = ScrollerObject,
+ GA_ID, GID_HSCROLL,
+ GA_RelVerify, TRUE,
+ SCROLLER_Orientation, SORIENT_HORIZ,
+ ICA_TARGET, ICTARGET_IDCMP,
+ ScrollerEnd;
+
+ IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD,
+ gwin->win, gwin->objects[GID_HSCROLL], attrs);
+
+ return true;
+}
+
+/* Remove the horizontal scroller, if present */
+static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
+{
+ if(gwin->objects[GID_HSCROLL] == NULL) return false;
+
+ IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD,
+ gwin->win, gwin->objects[GID_HSCROLL]);
+
+ gwin->objects[GID_HSCROLL] = NULL;
+
+ return true;
+}
+
/* Add a vertical scroller, if not already present
* Returns true if changed, false otherwise */
static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
@@ -1482,7 +1521,9 @@ static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
*/
static void ami_gui_vscroll_update(struct gui_window_2 *gwin)
{
- bool rethink = false;
+ int h = 1, w = 1, wh = 0, ww = 0;
+ bool rethinkv = false;
+ bool rethinkh = false;
browser_scrolling hscroll = BW_SCROLLING_YES;
browser_scrolling vscroll = BW_SCROLLING_YES;
@@ -1490,21 +1531,30 @@ static void ami_gui_vscroll_update(struct gui_window_2 *gwin)
/* We only bother with vscroll, as the hscroller is embedded in the
bottom window border with the status bar, so toggling it is pointless */
-
- if((vscroll == BW_SCROLLING_NO) || browser_window_is_frameset(gwin->bw) == true) {
- rethink = ami_gui_vscroll_remove(gwin);
+ if(browser_window_is_frameset(gwin->bw) == true) {
+ rethinkv = ami_gui_vscroll_remove(gwin);
+ rethinkh = ami_gui_hscroll_remove(gwin);
} else {
- int h, w, wh, ww;
if((browser_window_get_extents(gwin->bw, false, &w, &h) == NSERROR_OK)) {
gui_window_get_dimensions(gwin->bw->window, &ww, &wh, false);
- if (h > wh) rethink = ami_gui_vscroll_add(gwin);
- else rethink = ami_gui_vscroll_remove(gwin);
+ }
+
+ if(vscroll == BW_SCROLLING_NO) {
+ rethinkv = ami_gui_vscroll_remove(gwin);
+ } else {
+ if (h > wh) rethinkv = ami_gui_vscroll_add(gwin);
+ else rethinkv = ami_gui_vscroll_remove(gwin);
+ }
+
+ if(hscroll == BW_SCROLLING_NO) {
+ rethinkh = ami_gui_hscroll_remove(gwin);
} else {
- rethink = ami_gui_vscroll_add(gwin);
+ if (w > ww) rethinkh = ami_gui_hscroll_add(gwin);
+ else rethinkh = ami_gui_hscroll_remove(gwin);
}
}
- if(rethink) {
+ if(rethinkv || rethinkh) {
FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
@@ -3752,10 +3802,12 @@ gui_window_create(struct browser_window *bw,
LayoutEnd,
CHILD_WeightedHeight,0,
LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = HGroupObject,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
+ LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = VGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
+ GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
+ SpaceEnd,
+ EndGroup,
EndGroup,
EndGroup,
EndWindow;
@@ -3797,10 +3849,14 @@ gui_window_create(struct browser_window *bw,
WINDOW_BuiltInScroll,TRUE,
WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = HGroupObject,
LAYOUT_SpaceOuter, TRUE,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
+ LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = HGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = VGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
+ GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndGroup,
EndGroup,
EndWindow;
}
@@ -3822,7 +3878,7 @@ gui_window_create(struct browser_window *bw,
sz = ami_get_border_gadget_balance(g->shared,
(ULONG *)&size1, (ULONG *)&size2);
-
+/*
g->shared->objects[GID_HSCROLL] = NewObject(
NULL,
"scrollergclass",
@@ -3838,7 +3894,7 @@ gui_window_create(struct browser_window *bw,
GetAttr(GA_Height, (Object *)g->shared->objects[GID_HSCROLL],
(ULONG *)&sz);
-
+*/ /* NB: sz should now be the height of the size gadget */
g->shared->objects[GID_STATUS] = NewObject(
NULL,
"frbuttonclass",
@@ -3860,7 +3916,7 @@ gui_window_create(struct browser_window *bw,
IA_Screen, scrn,
GAUGEIA_Level, 0,
TAG_DONE),
- GA_Next, g->shared->objects[GID_HSCROLL],
+// GA_Next, g->shared->objects[GID_HSCROLL],
TAG_DONE);
AddGList(g->shared->win, (struct Gadget *)g->shared->objects[GID_STATUS],
diff --git a/amiga/gui.h b/amiga/gui.h
index 91dc2e7..c153015 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -70,6 +70,7 @@ enum
GID_HOTLISTLAYOUT,
GID_HOTLISTSEPBAR,
GID_HSCROLL,
+ GID_HSCROLLLAYOUT,
GID_VSCROLL,
GID_VSCROLLLAYOUT,
GID_LAST
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 246 ++++++++++++++++++++++++++++++-----------------------------
amiga/gui.h | 1 +
2 files changed, 125 insertions(+), 122 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 03dae2c..d91c7db 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -178,6 +178,7 @@ BOOL locked_screen = FALSE;
BOOL screen_closed = FALSE;
int screen_signal = -1;
ULONG sz_gad_width = 0;
+ULONG sz_gad_height = 0;
struct MsgPort *applibport = NULL;
ULONG applibsig = 0;
@@ -200,8 +201,6 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
void ami_change_tab(struct gui_window_2 *gwin, int direction);
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
-static void ami_set_border_gadget_balance(struct gui_window_2 *gwin);
-static ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
void ami_quit_netsurf_delayed(void);
Object *ami_gui_splash_open(void);
void ami_gui_splash_close(Object *win_obj);
@@ -1435,6 +1434,45 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei
}
}
+/* Add a horizontal scroller, if not already present
+ * Returns true if changed, false otherwise */
+static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
+{
+ struct TagItem attrs[2];
+
+ if(gwin->objects[GID_HSCROLL] != NULL) return false;
+
+ attrs[0].ti_Tag = CHILD_MinWidth;
+ attrs[0].ti_Data = 0;
+ attrs[1].ti_Tag = TAG_DONE;
+ attrs[1].ti_Data = 0;
+
+ gwin->objects[GID_HSCROLL] = ScrollerObject,
+ GA_ID, GID_HSCROLL,
+ GA_RelVerify, TRUE,
+ SCROLLER_Orientation, SORIENT_HORIZ,
+ ICA_TARGET, ICTARGET_IDCMP,
+ ScrollerEnd;
+
+ IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_ADDCHILD,
+ gwin->win, gwin->objects[GID_HSCROLL], attrs);
+
+ return true;
+}
+
+/* Remove the horizontal scroller, if present */
+static bool ami_gui_hscroll_remove(struct gui_window_2 *gwin)
+{
+ if(gwin->objects[GID_HSCROLL] == NULL) return false;
+
+ IDoMethod(gwin->objects[GID_HSCROLLLAYOUT], LM_REMOVECHILD,
+ gwin->win, gwin->objects[GID_HSCROLL]);
+
+ gwin->objects[GID_HSCROLL] = NULL;
+
+ return true;
+}
+
/* Add a vertical scroller, if not already present
* Returns true if changed, false otherwise */
static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
@@ -1482,7 +1520,9 @@ static bool ami_gui_vscroll_remove(struct gui_window_2 *gwin)
*/
static void ami_gui_vscroll_update(struct gui_window_2 *gwin)
{
- bool rethink = false;
+ int h = 1, w = 1, wh = 0, ww = 0;
+ bool rethinkv = false;
+ bool rethinkh = false;
browser_scrolling hscroll = BW_SCROLLING_YES;
browser_scrolling vscroll = BW_SCROLLING_YES;
@@ -1490,21 +1530,30 @@ static void ami_gui_vscroll_update(struct gui_window_2 *gwin)
/* We only bother with vscroll, as the hscroller is embedded in the
bottom window border with the status bar, so toggling it is pointless */
-
- if((vscroll == BW_SCROLLING_NO) || browser_window_is_frameset(gwin->bw) == true) {
- rethink = ami_gui_vscroll_remove(gwin);
+ if(browser_window_is_frameset(gwin->bw) == true) {
+ rethinkv = ami_gui_vscroll_remove(gwin);
+ rethinkh = ami_gui_hscroll_remove(gwin);
} else {
- int h, w, wh, ww;
if((browser_window_get_extents(gwin->bw, false, &w, &h) == NSERROR_OK)) {
gui_window_get_dimensions(gwin->bw->window, &ww, &wh, false);
- if (h > wh) rethink = ami_gui_vscroll_add(gwin);
- else rethink = ami_gui_vscroll_remove(gwin);
+ }
+
+ if(vscroll == BW_SCROLLING_NO) {
+ rethinkv = ami_gui_vscroll_remove(gwin);
+ } else {
+ if (h > wh) rethinkv = ami_gui_vscroll_add(gwin);
+ else rethinkv = ami_gui_vscroll_remove(gwin);
+ }
+
+ if(hscroll == BW_SCROLLING_NO) {
+ rethinkh = ami_gui_hscroll_remove(gwin);
} else {
- rethink = ami_gui_vscroll_add(gwin);
+ if (w > ww) rethinkh = ami_gui_hscroll_add(gwin);
+ else rethinkh = ami_gui_hscroll_remove(gwin);
}
}
- if(rethink) {
+ if(rethinkv || rethinkh) {
FlushLayoutDomainCache((struct Gadget *)gwin->objects[GID_MAIN]);
RethinkLayout((struct Gadget *)gwin->objects[GID_MAIN],
gwin->win, NULL, TRUE);
@@ -1582,6 +1631,45 @@ static void ami_gui_refresh_favicon(void *p)
gui_window_set_icon(gwin->bw->window, gwin->bw->window->favicon);
}
+/* Gets the size that border gadget 1 (status) needs to be.
+ * Returns the height of the size gadget as a convenience.
+ */
+static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height)
+{
+ ULONG available_width;
+
+ if((sz_gad_width == 0) || (sz_gad_height == 0)) {
+ struct DrawInfo *dri = GetScreenDrawInfo(scrn);
+ GetGUIAttrs(NULL, dri,
+ GUIA_SizeGadgetWidth, &sz_gad_width,
+ GUIA_SizeGadgetHeight, &sz_gad_height,
+ TAG_DONE);
+ FreeScreenDrawInfo(scrn, dri);
+ }
+
+ available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
+
+ *width = available_width;
+ *height = sz_gad_height;
+
+ return sz_gad_width;
+}
+
+static void ami_set_border_gadget_size(struct gui_window_2 *gwin)
+{
+ /* Reset gadget widths according to new calculation */
+ ULONG size1, size2, sz;
+
+ sz = ami_get_border_gadget_size(gwin, &size1, &size2);
+
+ RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
+ gwin->win, NULL,
+ GA_Width, size1,
+ TAG_DONE);
+
+ RefreshWindowFrame(gwin->win);
+}
+
static void ami_handle_msg(void)
{
ULONG result,storage = 0,x,y,xs,ys,width=800,height=600;
@@ -2279,7 +2367,7 @@ static void ami_handle_msg(void)
case AMINS_WINDOW:
ami_gui_vscroll_update(gwin);
- ami_set_border_gadget_balance(gwin);
+ ami_set_border_gadget_size(gwin);
ami_throbber_redraw_schedule(0, gwin->bw->window);
if(gwin->tabs)
@@ -3752,10 +3840,12 @@ gui_window_create(struct browser_window *bw,
LayoutEnd,
CHILD_WeightedHeight,0,
LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = HGroupObject,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
+ LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = VGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
+ GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
+ SpaceEnd,
+ EndGroup,
EndGroup,
EndGroup,
EndWindow;
@@ -3788,7 +3878,6 @@ gui_window_create(struct browser_window *bw,
IDCMP_RAWKEY | IDCMP_REFRESHWINDOW |
IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
IDCMP_EXTENDEDMOUSE,
- WINDOW_HorizProp,1,
WINDOW_IDCMPHook,&g->shared->scrollerhook,
WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE |
IDCMP_EXTENDEDMOUSE | IDCMP_REFRESHWINDOW,
@@ -3797,10 +3886,14 @@ gui_window_create(struct browser_window *bw,
WINDOW_BuiltInScroll,TRUE,
WINDOW_ParentGroup, g->shared->objects[GID_MAIN] = HGroupObject,
LAYOUT_SpaceOuter, TRUE,
- LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
- GA_ID,GID_BROWSER,
- SPACE_Transparent,TRUE,
- SpaceEnd,
+ LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = HGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = VGroupObject,
+ LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
+ GA_ID,GID_BROWSER,
+ SPACE_Transparent,TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndGroup,
EndGroup,
EndWindow;
}
@@ -3817,35 +3910,19 @@ gui_window_create(struct browser_window *bw,
if(nsoption_bool(kiosk_mode) == false)
{
- ULONG sz, size1, size2;
+ ULONG sz, width, height;
struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- sz = ami_get_border_gadget_balance(g->shared,
- (ULONG *)&size1, (ULONG *)&size2);
-
- g->shared->objects[GID_HSCROLL] = NewObject(
- NULL,
- "scrollergclass",
- GA_ID, GID_HSCROLL,
- PGA_Freedom, FREEHORIZ,
- GA_RelRight, 1 - size2 - sz,
- GA_Width, size2,
- GA_BottomBorder, TRUE,
- GA_Immediate, TRUE,
- ICA_TARGET, ICTARGET_IDCMP,
- GA_DrawInfo, dri,
- TAG_DONE);
-
- GetAttr(GA_Height, (Object *)g->shared->objects[GID_HSCROLL],
- (ULONG *)&sz);
+ sz = ami_get_border_gadget_size(g->shared,
+ (ULONG *)&width, (ULONG *)&height);
g->shared->objects[GID_STATUS] = NewObject(
NULL,
"frbuttonclass",
GA_ID, GID_STATUS,
GA_Left, scrn->WBorLeft + 2,
- GA_RelBottom, -((2 + sz + scrn->WBorBottom - scrn->RastPort.TxHeight)/2),
- GA_Width, size1,
+ GA_RelBottom, -((2 + height + scrn->WBorBottom - scrn->RastPort.TxHeight)/2),
+ GA_Width, width,
GA_DrawInfo, dri,
GA_BottomBorder, TRUE,
GA_ReadOnly, TRUE,
@@ -3860,7 +3937,6 @@ gui_window_create(struct browser_window *bw,
IA_Screen, scrn,
GAUGEIA_Level, 0,
TAG_DONE),
- GA_Next, g->shared->objects[GID_HSCROLL],
TAG_DONE);
AddGList(g->shared->win, (struct Gadget *)g->shared->objects[GID_STATUS],
@@ -3870,7 +3946,7 @@ gui_window_create(struct browser_window *bw,
SetGadgetAttrs((struct Gadget *)g->shared->objects[GID_STATUS],
g->shared->win, NULL,
- GA_Width, size1,
+ GA_Width, width,
TAG_DONE);
RefreshGadgets((APTR)g->shared->objects[GID_STATUS],
@@ -3881,17 +3957,6 @@ gui_window_create(struct browser_window *bw,
ami_gui_hotlist_toolbar_add(g->shared); /* is this the right place for this? */
if(nsoption_bool(tab_always_show)) ami_toggletabbar(g->shared, true);
}
- else
- {
- GetAttr(WINDOW_HorizObject, g->shared->objects[OID_MAIN],
- (ULONG *)&g->shared->objects[OID_HSCROLL]);
-
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
- GA_ID, OID_HSCROLL,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
- }
g->shared->rmbtrapped = FALSE;
g->shared->bw = bw;
@@ -3914,52 +3979,6 @@ gui_window_create(struct browser_window *bw,
return g;
}
-static void ami_set_border_gadget_balance(struct gui_window_2 *gwin)
-{
- /* Reset gadget widths according to new calculation */
- ULONG size1, size2, sz;
-
- sz = ami_get_border_gadget_balance(gwin, &size1, &size2);
-
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_HSCROLL],
- gwin->win, NULL,
- GA_RelRight, - size2 - sz,
- GA_Width, size2,
- TAG_DONE);
-
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)gwin->objects[GID_STATUS],
- gwin->win, NULL,
- GA_Width, size1,
- TAG_DONE);
-
- RefreshWindowFrame(gwin->win);
-}
-
-static ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2)
-{
- /* Get the sizes that border gadget 1 (status) and 2 (hscroller) need to be.
- ** Returns the width of the size gadget as a convenience.
- */
-
- ULONG available_width;
- float gad1percent;
-
- if(sz_gad_width == 0) {
- struct DrawInfo *dri = GetScreenDrawInfo(scrn);
- GetGUIAttrs(NULL, dri, GUIA_SizeGadgetWidth, &sz_gad_width, TAG_DONE);
- FreeScreenDrawInfo(scrn, dri);
- }
-
- available_width = gwin->win->Width - scrn->WBorLeft - sz_gad_width;
-
- gad1percent = nsoption_int(toolbar_status_size) / 10000.0;
-
- *size1 = (ULONG)(available_width * gad1percent);
- *size2 = (ULONG)(available_width * (1 - gad1percent));
-
- return sz_gad_width;
-}
-
void ami_close_all_tabs(struct gui_window_2 *gwin)
{
struct Node *tab;
@@ -4599,11 +4618,9 @@ void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
{
if(gwin->objects[GID_HSCROLL])
{
- GetAttr(PGA_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
- }
- else if(gwin->objects[OID_HSCROLL])
- {
- GetAttr(SCROLLER_Top, gwin->objects[OID_HSCROLL], xs);
+ GetAttr(SCROLLER_Top, (Object *)gwin->objects[GID_HSCROLL], xs);
+ } else {
+ *xs = 0;
}
*xs /= gwin->bw->scale;
@@ -4666,16 +4683,10 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Top, (ULONG)(sx * g->shared->bw->scale),
- TAG_DONE);
- }
- else if(g->shared->objects[OID_HSCROLL])
- {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
SCROLLER_Top, (ULONG)(sx * g->shared->bw->scale),
TAG_DONE);
}
+
ami_schedule_redraw(g->shared, true);
if(nsoption_bool(faster_scroll) == true) g->shared->redraw_scroll = true;
@@ -4716,14 +4727,6 @@ static void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
- PGA_Visible, bbox->Width,
- TAG_DONE);
- }
- else if(g->shared->objects[OID_HSCROLL])
- {
- RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[OID_HSCROLL],
- g->shared->win, NULL,
SCROLLER_Total, (ULONG)(content_get_width(g->shared->bw->current_content) * g->shared->bw->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
@@ -4966,7 +4969,6 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg
switch( gid )
{
case GID_HSCROLL:
- case OID_HSCROLL:
case GID_VSCROLL:
if(nsoption_bool(faster_scroll) == true) gwin->redraw_scroll = true;
else gwin->redraw_scroll = false;
diff --git a/amiga/gui.h b/amiga/gui.h
index 91dc2e7..c153015 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -70,6 +70,7 @@ enum
GID_HOTLISTLAYOUT,
GID_HOTLISTSEPBAR,
GID_HSCROLL,
+ GID_HSCROLLLAYOUT,
GID_VSCROLL,
GID_VSCROLLLAYOUT,
GID_LAST
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-258-g17b87a6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/17b87a60cffc067b7837b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/17b87a60cffc067b7837b9d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/17b87a60cffc067b7837b9db3...
The branch, master has been updated
via 17b87a60cffc067b7837b9db366b5cdd64d46810 (commit)
via 0c77d85f8976046b0c5cf2915f0618e1522099ac (commit)
from b751513d6f1515976238adf68598729b9021160f (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=17b87a60cffc067b783...
commit 17b87a60cffc067b7837b9db366b5cdd64d46810
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Offset new windows as per style guide
diff --git a/amiga/gui.c b/amiga/gui.c
index 76e4849..03dae2c 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3233,8 +3233,8 @@ static void ami_gui_search_ico_refresh(void *p)
* Count windows, and optionally tabs.
*
* \param window window to count tabs of
- * \param tabs if window > 0, contains the number of tabs in that window,
- * unchanged otherwise
+ * \param tabs if window > 0, will be updated to contain the number of tabs
+ * in that window, unchanged otherwise
* \return number of windows currently open
*/
int ami_gui_count_windows(int window, int *tabs)
@@ -3259,8 +3259,6 @@ int ami_gui_count_windows(int window, int *tabs)
return windows;
}
-
-
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;
@@ -3291,7 +3289,9 @@ gui_window_create(struct browser_window *bw,
gui_window_create_flags flags)
{
struct gui_window *g = NULL;
- ULONG curx=nsoption_int(window_x),cury=nsoption_int(window_y),curw=nsoption_int(window_width),curh=nsoption_int(window_height);
+ ULONG offset = 0;
+ ULONG curx = nsoption_int(window_x), cury = nsoption_int(window_y);
+ ULONG curw = nsoption_int(window_width), curh = nsoption_int(window_height);
char nav_west[100],nav_west_s[100],nav_west_g[100];
char nav_east[100],nav_east_s[100],nav_east_g[100];
char stop[100],stop_s[100],stop_g[100];
@@ -3310,14 +3310,23 @@ gui_window_create(struct browser_window *bw,
if (nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
bw->scale = 1.0;
- if(existing)
- {
- curx=existing->shared->win->LeftEdge;
- cury=existing->shared->win->TopEdge;
- curw=existing->shared->win->Width;
- curh=existing->shared->win->Height;
+ /* Offset the new window by titlebar + 1 as per AmigaOS style guide.
+ * If we don't have a clone window we offset by all windows open. */
+ offset = scrn->WBorTop + scrn->Font->ta_YSize + 1;
+
+ if(existing) {
+ curx = existing->shared->win->LeftEdge;
+ cury = existing->shared->win->TopEdge + offset;
+ curw = existing->shared->win->Width;
+ curh = existing->shared->win->Height;
+ } else {
+ if(nsoption_bool(kiosk_mode) == false) {
+ cury += offset * ami_gui_count_windows(0, NULL);
+ }
}
+ if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
+
g = AllocVecTags(sizeof(struct gui_window), AVT_ClearWithValue, 0, TAG_DONE);
if(!g)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0c77d85f8976046b0c5...
commit 0c77d85f8976046b0c5cf2915f0618e1522099ac
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Make window counting a generic function
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 7a367e8..120656f 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -537,29 +537,14 @@ STATIC VOID rx_reload(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
STATIC VOID rx_windows(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
{
int windows = 0, tabs = 0;
+ int window = 0;
struct nsObject *node, *nnode;
struct gui_window_2 *gwin;
+ if(cmd->ac_ArgList[0]) window = *(ULONG *)cmd->ac_ArgList[0];
cmd->ac_RC = 0;
- if(!IsMinListEmpty(window_list))
- {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- gwin = node->objstruct;
-
- if(node->Type == AMINS_WINDOW)
- {
- windows++;
- if((cmd->ac_ArgList[0]) && (*(ULONG *)cmd->ac_ArgList[0] == windows))
- tabs = gwin->tabs;
- }
- } while(node = nnode);
- }
+ windows = ami_gui_count_windows(window, &tabs);
if(cmd->ac_ArgList[0]) sprintf(result, "%d", tabs);
else sprintf(result, "%d", windows);
diff --git a/amiga/gui.c b/amiga/gui.c
index c63833a..76e4849 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3229,6 +3229,38 @@ static void ami_gui_search_ico_refresh(void *p)
search_web_select_provider(-1);
}
+/**
+ * Count windows, and optionally tabs.
+ *
+ * \param window window to count tabs of
+ * \param tabs if window > 0, contains the number of tabs in that window,
+ * unchanged otherwise
+ * \return number of windows currently open
+ */
+int ami_gui_count_windows(int window, int *tabs)
+{
+ int windows = 0;
+ struct nsObject *node, *nnode;
+ struct gui_window_2 *gwin;
+
+ if(!IsMinListEmpty(window_list)) {
+ node = (struct nsObject *)GetHead((struct List *)window_list);
+ do {
+ nnode=(struct nsObject *)GetSucc((struct Node *)node);
+
+ gwin = node->objstruct;
+
+ if(node->Type == AMINS_WINDOW) {
+ windows++;
+ if(window == windows) *tabs = gwin->tabs;
+ }
+ } while((node = nnode));
+ }
+ return windows;
+}
+
+
+
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;
diff --git a/amiga/gui.h b/amiga/gui.h
index 1de31ae..91dc2e7 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -168,6 +168,7 @@ bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail);
+int ami_gui_count_windows(int window, int *tabs);
struct TextFont *origrpfont;
struct MinList *window_list;
-----------------------------------------------------------------------
Summary of changes:
amiga/arexx.c | 21 +++------------------
amiga/gui.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-------
amiga/gui.h | 1 +
3 files changed, 52 insertions(+), 25 deletions(-)
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 7a367e8..120656f 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -537,29 +537,14 @@ STATIC VOID rx_reload(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
STATIC VOID rx_windows(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
{
int windows = 0, tabs = 0;
+ int window = 0;
struct nsObject *node, *nnode;
struct gui_window_2 *gwin;
+ if(cmd->ac_ArgList[0]) window = *(ULONG *)cmd->ac_ArgList[0];
cmd->ac_RC = 0;
- if(!IsMinListEmpty(window_list))
- {
- node = (struct nsObject *)GetHead((struct List *)window_list);
-
- do
- {
- nnode=(struct nsObject *)GetSucc((struct Node *)node);
-
- gwin = node->objstruct;
-
- if(node->Type == AMINS_WINDOW)
- {
- windows++;
- if((cmd->ac_ArgList[0]) && (*(ULONG *)cmd->ac_ArgList[0] == windows))
- tabs = gwin->tabs;
- }
- } while(node = nnode);
- }
+ windows = ami_gui_count_windows(window, &tabs);
if(cmd->ac_ArgList[0]) sprintf(result, "%d", tabs);
else sprintf(result, "%d", windows);
diff --git a/amiga/gui.c b/amiga/gui.c
index c63833a..03dae2c 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3229,6 +3229,36 @@ static void ami_gui_search_ico_refresh(void *p)
search_web_select_provider(-1);
}
+/**
+ * Count windows, and optionally tabs.
+ *
+ * \param window window to count tabs of
+ * \param tabs if window > 0, will be updated to contain the number of tabs
+ * in that window, unchanged otherwise
+ * \return number of windows currently open
+ */
+int ami_gui_count_windows(int window, int *tabs)
+{
+ int windows = 0;
+ struct nsObject *node, *nnode;
+ struct gui_window_2 *gwin;
+
+ if(!IsMinListEmpty(window_list)) {
+ node = (struct nsObject *)GetHead((struct List *)window_list);
+ do {
+ nnode=(struct nsObject *)GetSucc((struct Node *)node);
+
+ gwin = node->objstruct;
+
+ if(node->Type == AMINS_WINDOW) {
+ windows++;
+ if(window == windows) *tabs = gwin->tabs;
+ }
+ } while((node = nnode));
+ }
+ return windows;
+}
+
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;
@@ -3259,7 +3289,9 @@ gui_window_create(struct browser_window *bw,
gui_window_create_flags flags)
{
struct gui_window *g = NULL;
- ULONG curx=nsoption_int(window_x),cury=nsoption_int(window_y),curw=nsoption_int(window_width),curh=nsoption_int(window_height);
+ ULONG offset = 0;
+ ULONG curx = nsoption_int(window_x), cury = nsoption_int(window_y);
+ ULONG curw = nsoption_int(window_width), curh = nsoption_int(window_height);
char nav_west[100],nav_west_s[100],nav_west_g[100];
char nav_east[100],nav_east_s[100],nav_east_g[100];
char stop[100],stop_s[100],stop_g[100];
@@ -3278,14 +3310,23 @@ gui_window_create(struct browser_window *bw,
if (nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
bw->scale = 1.0;
- if(existing)
- {
- curx=existing->shared->win->LeftEdge;
- cury=existing->shared->win->TopEdge;
- curw=existing->shared->win->Width;
- curh=existing->shared->win->Height;
+ /* Offset the new window by titlebar + 1 as per AmigaOS style guide.
+ * If we don't have a clone window we offset by all windows open. */
+ offset = scrn->WBorTop + scrn->Font->ta_YSize + 1;
+
+ if(existing) {
+ curx = existing->shared->win->LeftEdge;
+ cury = existing->shared->win->TopEdge + offset;
+ curw = existing->shared->win->Width;
+ curh = existing->shared->win->Height;
+ } else {
+ if(nsoption_bool(kiosk_mode) == false) {
+ cury += offset * ami_gui_count_windows(0, NULL);
+ }
}
+ if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
+
g = AllocVecTags(sizeof(struct gui_window), AVT_ClearWithValue, 0, TAG_DONE);
if(!g)
diff --git a/amiga/gui.h b/amiga/gui.h
index 1de31ae..91dc2e7 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -168,6 +168,7 @@ bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail);
+int ami_gui_count_windows(int window, int *tabs);
struct TextFont *origrpfont;
struct MinList *window_list;
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-256-gb751513
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/b751513d6f1515976238a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/b751513d6f1515976238adf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/b751513d6f1515976238adf68...
The branch, master has been updated
via b751513d6f1515976238adf68598729b9021160f (commit)
from a01cb0f635589104f7de9423d4df34572ff105a8 (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=b751513d6f151597623...
commit b751513d6f1515976238adf68598729b9021160f
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Schedule redraws for 1cs to ensure they take place after reformats (which are scheduled by the core for 0cs)
diff --git a/amiga/gui.c b/amiga/gui.c
index 67d6c18..c63833a 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -4142,7 +4142,7 @@ static void ami_redraw_callback(void *p)
*/
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
{
- int ms = 0;
+ int ms = 1;
if(full_redraw) gwin->redraw_required = true;
ami_schedule(ms, ami_redraw_callback, gwin);
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 67d6c18..c63833a 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -4142,7 +4142,7 @@ static void ami_redraw_callback(void *p)
*/
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
{
- int ms = 0;
+ int ms = 1;
if(full_redraw) gwin->redraw_required = true;
ami_schedule(ms, ami_redraw_callback, gwin);
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-255-ga01cb0f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a01cb0f635589104f7de9...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a01cb0f635589104f7de942...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a01cb0f635589104f7de9423d...
The branch, master has been updated
via a01cb0f635589104f7de9423d4df34572ff105a8 (commit)
from 69c7b6b1f58f09815c9cd4bb67181a88d621adbf (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=a01cb0f635589104f7d...
commit a01cb0f635589104f7de9423d4df34572ff105a8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Don't need redraw_scheduld as the scheduler stops it being scheduled twice anyway
diff --git a/amiga/gui.c b/amiga/gui.c
index ea6ff2b..67d6c18 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -4131,8 +4131,6 @@ static void ami_redraw_callback(void *p)
gui_window_place_caret(gwin->bw->window, gwin->bw->window->c_x,
gwin->bw->window->c_y, gwin->bw->window->c_h, NULL);
}
-
- gwin->redraw_scheduled = false;
}
/**
@@ -4147,10 +4145,7 @@ void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
int ms = 0;
if(full_redraw) gwin->redraw_required = true;
- if(gwin->redraw_scheduled == true) return;
-
ami_schedule(ms, ami_redraw_callback, gwin);
- gwin->redraw_scheduled = true;
}
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin)
diff --git a/amiga/gui.h b/amiga/gui.h
index ef6ea10..1de31ae 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -101,7 +101,6 @@ struct gui_window_2 {
int temp;
bool redraw_scroll;
bool new_content;
- bool redraw_scheduled;
char *menulab[AMI_MENU_AREXX_MAX + 1];
Object *menuobj[AMI_MENU_AREXX_MAX + 1];
char menukey[AMI_MENU_AREXX_MAX + 1];
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 5 -----
amiga/gui.h | 1 -
2 files changed, 6 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index ea6ff2b..67d6c18 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -4131,8 +4131,6 @@ static void ami_redraw_callback(void *p)
gui_window_place_caret(gwin->bw->window, gwin->bw->window->c_x,
gwin->bw->window->c_y, gwin->bw->window->c_h, NULL);
}
-
- gwin->redraw_scheduled = false;
}
/**
@@ -4147,10 +4145,7 @@ void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw)
int ms = 0;
if(full_redraw) gwin->redraw_required = true;
- if(gwin->redraw_scheduled == true) return;
-
ami_schedule(ms, ami_redraw_callback, gwin);
- gwin->redraw_scheduled = true;
}
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin)
diff --git a/amiga/gui.h b/amiga/gui.h
index ef6ea10..1de31ae 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -101,7 +101,6 @@ struct gui_window_2 {
int temp;
bool redraw_scroll;
bool new_content;
- bool redraw_scheduled;
char *menulab[AMI_MENU_AREXX_MAX + 1];
Object *menuobj[AMI_MENU_AREXX_MAX + 1];
char menukey[AMI_MENU_AREXX_MAX + 1];
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-254-g69c7b6b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/69c7b6b1f58f09815c9cd...
...commit http://git.netsurf-browser.org/netsurf.git/commit/69c7b6b1f58f09815c9cd4b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/69c7b6b1f58f09815c9cd4bb6...
The branch, master has been updated
via 69c7b6b1f58f09815c9cd4bb67181a88d621adbf (commit)
from 14e282948996f75e87a14ab90f4b3ed54d9d6ad7 (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=69c7b6b1f58f09815c9...
commit 69c7b6b1f58f09815c9cd4bb67181a88d621adbf
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Fix button update, avoid forward decl
diff --git a/amiga/gui.c b/amiga/gui.c
index e210c98..ea6ff2b 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -195,7 +195,6 @@ static const __attribute__((used)) char *stack_cookie = "\0$STACK:98304\0";
const char * const versvn;
const char * const verdate;
-void ami_update_buttons(struct gui_window_2 *);
void ami_scroller_hook(struct Hook *,Object *,struct IntuiMessage *);
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
void ami_change_tab(struct gui_window_2 *gwin, int direction);
@@ -1036,6 +1035,64 @@ static void gui_init2(int argc, char** argv)
}
}
+static void ami_update_buttons(struct gui_window_2 *gwin)
+{
+ long back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
+ long storage = FALSE;
+
+ if(!browser_window_back_available(gwin->bw))
+ back=TRUE;
+
+ if(browser_window_forward_available(gwin->bw))
+ forward=FALSE;
+
+ if(!browser_window_stop_available(gwin->bw))
+ stop=TRUE;
+
+ if(!browser_window_reload_available(gwin->bw))
+ reload=TRUE;
+
+ if(nsoption_bool(kiosk_mode) == false)
+ {
+ if(gwin->tabs <= 1)
+ {
+ tabclose=TRUE;
+ OffMenu(gwin->win,AMI_MENU_CLOSETAB);
+ }
+ else
+ {
+ OnMenu(gwin->win,AMI_MENU_CLOSETAB);
+ }
+ }
+
+ GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&storage);
+ if(storage != back)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
+ gwin->win, NULL, GA_Disabled, back, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&storage);
+ if(storage != forward)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
+ gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&storage);
+ if(storage != reload)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
+ gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&storage);
+ if(storage != stop)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
+ gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
+
+ if((gwin->tabs) && (ClickTabBase->lib_Version < 53))
+ {
+ GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&storage);
+ if(storage != tabclose)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
+ gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
+ }
+}
void ami_gui_history(struct gui_window_2 *gwin, bool back)
{
@@ -2916,65 +2973,6 @@ void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
}
}
-void ami_update_buttons(struct gui_window_2 *gwin)
-{
- BOOL back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
- BOOL storage = FALSE;
-
- if(!browser_window_back_available(gwin->bw))
- back=TRUE;
-
- if(browser_window_forward_available(gwin->bw))
- forward=FALSE;
-
- if(!browser_window_stop_available(gwin->bw))
- stop=TRUE;
-
- if(!browser_window_reload_available(gwin->bw))
- reload=TRUE;
-
- if(nsoption_bool(kiosk_mode) == false)
- {
- if(gwin->tabs <= 1)
- {
- tabclose=TRUE;
- OffMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- else
- {
- OnMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- }
-
- GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&storage);
- if(storage != back)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
- gwin->win, NULL, GA_Disabled, back, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&storage);
- if(storage != forward)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
- gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&storage);
- if(storage != reload)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
- gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&storage);
- if(storage != stop)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
- gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
-
- if((gwin->tabs) && (ClickTabBase->lib_Version < 53))
- {
- GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&storage);
- if(storage != tabclose)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
- gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
- }
-}
-
static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
{
struct ami_gui_tb_userdata *tb_userdata = (struct ami_gui_tb_userdata *)userdata;
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 118 +++++++++++++++++++++++++++++------------------------------
1 file changed, 58 insertions(+), 60 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index e210c98..ea6ff2b 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -195,7 +195,6 @@ static const __attribute__((used)) char *stack_cookie = "\0$STACK:98304\0";
const char * const versvn;
const char * const verdate;
-void ami_update_buttons(struct gui_window_2 *);
void ami_scroller_hook(struct Hook *,Object *,struct IntuiMessage *);
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
void ami_change_tab(struct gui_window_2 *gwin, int direction);
@@ -1036,6 +1035,64 @@ static void gui_init2(int argc, char** argv)
}
}
+static void ami_update_buttons(struct gui_window_2 *gwin)
+{
+ long back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
+ long storage = FALSE;
+
+ if(!browser_window_back_available(gwin->bw))
+ back=TRUE;
+
+ if(browser_window_forward_available(gwin->bw))
+ forward=FALSE;
+
+ if(!browser_window_stop_available(gwin->bw))
+ stop=TRUE;
+
+ if(!browser_window_reload_available(gwin->bw))
+ reload=TRUE;
+
+ if(nsoption_bool(kiosk_mode) == false)
+ {
+ if(gwin->tabs <= 1)
+ {
+ tabclose=TRUE;
+ OffMenu(gwin->win,AMI_MENU_CLOSETAB);
+ }
+ else
+ {
+ OnMenu(gwin->win,AMI_MENU_CLOSETAB);
+ }
+ }
+
+ GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&storage);
+ if(storage != back)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
+ gwin->win, NULL, GA_Disabled, back, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&storage);
+ if(storage != forward)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
+ gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&storage);
+ if(storage != reload)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
+ gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
+
+ GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&storage);
+ if(storage != stop)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
+ gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
+
+ if((gwin->tabs) && (ClickTabBase->lib_Version < 53))
+ {
+ GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&storage);
+ if(storage != tabclose)
+ SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
+ gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
+ }
+}
void ami_gui_history(struct gui_window_2 *gwin, bool back)
{
@@ -2916,65 +2973,6 @@ void ami_gui_update_hotlist_button(struct gui_window_2 *gwin)
}
}
-void ami_update_buttons(struct gui_window_2 *gwin)
-{
- BOOL back=FALSE,forward=TRUE,tabclose=FALSE,stop=FALSE,reload=FALSE;
- BOOL storage = FALSE;
-
- if(!browser_window_back_available(gwin->bw))
- back=TRUE;
-
- if(browser_window_forward_available(gwin->bw))
- forward=FALSE;
-
- if(!browser_window_stop_available(gwin->bw))
- stop=TRUE;
-
- if(!browser_window_reload_available(gwin->bw))
- reload=TRUE;
-
- if(nsoption_bool(kiosk_mode) == false)
- {
- if(gwin->tabs <= 1)
- {
- tabclose=TRUE;
- OffMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- else
- {
- OnMenu(gwin->win,AMI_MENU_CLOSETAB);
- }
- }
-
- GetAttr(GA_Disabled, gwin->objects[GID_BACK], (uint32 *)&storage);
- if(storage != back)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_BACK],
- gwin->win, NULL, GA_Disabled, back, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_FORWARD], (uint32 *)&storage);
- if(storage != forward)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_FORWARD],
- gwin->win, NULL, GA_Disabled, forward, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_RELOAD], (uint32 *)&storage);
- if(storage != reload)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_RELOAD],
- gwin->win, NULL, GA_Disabled, reload, TAG_DONE);
-
- GetAttr(GA_Disabled, gwin->objects[GID_STOP], (uint32 *)&storage);
- if(storage != stop)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_STOP],
- gwin->win, NULL, GA_Disabled, stop, TAG_DONE);
-
- if((gwin->tabs) && (ClickTabBase->lib_Version < 53))
- {
- GetAttr(GA_Disabled, gwin->objects[GID_CLOSETAB], (uint32 *)&storage);
- if(storage != tabclose)
- SetGadgetAttrs((struct Gadget *)gwin->objects[GID_CLOSETAB],
- gwin->win, NULL, GA_Disabled, tabclose, TAG_DONE);
- }
-}
-
static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder)
{
struct ami_gui_tb_userdata *tb_userdata = (struct ami_gui_tb_userdata *)userdata;
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-253-g14e2829
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/14e282948996f75e87a14...
...commit http://git.netsurf-browser.org/netsurf.git/commit/14e282948996f75e87a14ab...
...tree http://git.netsurf-browser.org/netsurf.git/tree/14e282948996f75e87a14ab90...
The branch, master has been updated
via 14e282948996f75e87a14ab90f4b3ed54d9d6ad7 (commit)
from a913af5cf54400b441f3b1fbfc5d508cf85fea43 (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=14e282948996f75e87a...
commit 14e282948996f75e87a14ab90f4b3ed54d9d6ad7
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove the die API from the core.
The die() API for abnormal termination does not belong within the core
of netsurf and instead errors are propogated back to the callers.
This is the final part of this change and the API is now only used within
some parts of the frontends
diff --git a/amiga/misc.h b/amiga/misc.h
index db559f7..ce2d947 100644
--- a/amiga/misc.h
+++ b/amiga/misc.h
@@ -24,5 +24,14 @@ extern struct gui_file_table *amiga_file_table;
char *translate_escape_chars(const char *s);
int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
#endif
diff --git a/atari/misc.h b/atari/misc.h
index 8d1719c..418f283 100755
--- a/atari/misc.h
+++ b/atari/misc.h
@@ -66,4 +66,13 @@ const char * file_select(const char * title, const char * name);
*/
long nkc_to_input_key(short nkc, long * ucs4_out);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
#endif
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index a0b99e5..1b949d2 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -32,6 +32,7 @@
#include "desktop/plotters.h"
#include "desktop/mouse.h"
+#include "atari/misc.h"
#include "atari/bitmap.h"
#include "utils/nsoption.h"
#include "atari/plot/plot.h"
diff --git a/beos/gui.h b/beos/gui.h
index 6689bd8..215cda8 100644
--- a/beos/gui.h
+++ b/beos/gui.h
@@ -67,3 +67,12 @@ void nsbeos_gui_view_source(struct hlcache_handle *content);
image_id nsbeos_find_app_path(char *path);
void nsbeos_update_system_ui_colors(void);
+
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m
index 3bd5f43..d76aee1 100644
--- a/cocoa/NetsurfApp.m
+++ b/cocoa/NetsurfApp.m
@@ -49,6 +49,18 @@
static bool cocoa_done = false;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ [NSException raise: @"NetsurfDie" format: @"Error: %s", error];
+}
+
- (void) loadOptions;
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
diff --git a/cocoa/utils.m b/cocoa/utils.m
index 61226ad..b49e503 100644
--- a/cocoa/utils.m
+++ b/cocoa/utils.m
@@ -22,10 +22,6 @@
#define UNIMPL() NSLog( @"Function '%s' unimplemented", __func__ )
-void die(const char * const error)
-{
- [NSException raise: @"NetsurfDie" format: @"Error: %s", error];
-}
void warn_user(const char *warning, const char *detail)
{
diff --git a/content/urldb.c b/content/urldb.c
index c74dae3..650c7bc 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -343,7 +343,7 @@ static struct bloom_filter *url_bloom;
*
* \param filename Name of file containing data
*/
-void urldb_load(const char *filename)
+nserror urldb_load(const char *filename)
{
#define MAXIMUM_URL_LENGTH 4096
char s[MAXIMUM_URL_LENGTH];
@@ -365,24 +365,24 @@ void urldb_load(const char *filename)
fp = fopen(filename, "r");
if (!fp) {
LOG(("Failed to open file '%s' for reading", filename));
- return;
+ return NSERROR_NOT_FOUND;
}
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) {
fclose(fp);
- return;
+ return NSERROR_NEED_DATA;
}
version = atoi(s);
if (version < MIN_URL_FILE_VERSION) {
LOG(("Unsupported URL file version."));
fclose(fp);
- return;
+ return NSERROR_INVALID;
}
if (version > URL_FILE_VERSION) {
LOG(("Unknown URL file version."));
fclose(fp);
- return;
+ return NSERROR_INVALID;
}
while (fgets(host, sizeof host, fp)) {
@@ -417,7 +417,8 @@ void urldb_load(const char *filename)
h = urldb_add_host(host);
if (!h) {
LOG(("Failed adding host: '%s'", host));
- die("Memory exhausted whilst loading URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
/* load the non-corrupt data */
@@ -467,8 +468,8 @@ void urldb_load(const char *filename)
*/
if (nsurl_create(url, &nsurl) != NSERROR_OK) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
if (url_bloom != NULL) {
@@ -480,8 +481,8 @@ void urldb_load(const char *filename)
if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY,
&path_query, &len) != NSERROR_OK) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
scheme_lwc = nsurl_get_component(nsurl, NSURL_SCHEME);
@@ -491,8 +492,8 @@ void urldb_load(const char *filename)
fragment_lwc, nsurl);
if (!p) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
nsurl_unref(nsurl);
lwc_string_unref(scheme_lwc);
@@ -533,6 +534,8 @@ void urldb_load(const char *filename)
fclose(fp);
LOG(("Successfully loaded URL file"));
#undef MAXIMUM_URL_LENGTH
+
+ return NSERROR_OK;
}
/**
diff --git a/content/urldb.h b/content/urldb.h
index d600430..c0fece2 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -68,7 +68,7 @@ struct bitmap;
void urldb_destroy(void);
/* Persistence support */
-void urldb_load(const char *filename);
+nserror urldb_load(const char *filename);
void urldb_save(const char *filename);
void urldb_set_url_persistence(nsurl *url, bool persist);
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 992b192..180c261 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -97,6 +97,19 @@ static struct gui_drag {
} gui_drag;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char *error)
+{
+ LOG(("%s", error));
+ exit(1);
+}
+
/* queue a redraw operation, co-ordinates are relative to the window */
static void
fb_queue_redraw(struct fbtk_widget_s *widget, int x0, int y0, int x1, int y1)
diff --git a/framebuffer/misc.c b/framebuffer/misc.c
index 0a45b28..406a959 100644
--- a/framebuffer/misc.c
+++ b/framebuffer/misc.c
@@ -30,9 +30,4 @@ void warn_user(const char *warning, const char *detail)
LOG(("%s %s", warning, detail));
}
-void die(const char *error)
-{
- LOG(("%s", error));
- exit(1);
-}
diff --git a/gtk/gui.c b/gtk/gui.c
index da993ac..eeba466 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -106,6 +106,19 @@ static void nsgtk_PDF_no_pass(GtkButton *w, gpointer data);
char **respaths; /** resource search path vector */
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ fprintf(stderr, "%s", error);
+ exit(EXIT_FAILURE);
+}
+
/** Create an array of valid paths to search for resources.
*
* The idea is that all the complex path computation to find resources
@@ -584,11 +597,6 @@ void warn_user(const char *warning, const char *detail)
gtk_widget_show_all(GTK_WIDGET(nsgtk_warning_window));
}
-void die(const char * const error)
-{
- fprintf(stderr, "%s", error);
- exit(EXIT_FAILURE);
-}
static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
diff --git a/monkey/dispatch.c b/monkey/dispatch.c
index 9d02256..c70070d 100644
--- a/monkey/dispatch.c
+++ b/monkey/dispatch.c
@@ -35,15 +35,18 @@ typedef struct cmdhandler {
static monkey_cmdhandler_t *handler_ring = NULL;
-void
+nserror
monkey_register_handler(const char *cmd, handle_command_fn fn)
{
monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- die("Unable to allocate handler");
+ if (ret == NULL) {
+ LOG(("Unable to allocate handler"));
+ return NSERROR_NOMEM;
+ }
ret->cmd = strdup(cmd);
ret->fn = fn;
RING_INSERT(handler_ring, ret);
+ return NSERROR_OK;
}
void
diff --git a/monkey/dispatch.h b/monkey/dispatch.h
index fe8f4e2..dc6e50a 100644
--- a/monkey/dispatch.h
+++ b/monkey/dispatch.h
@@ -21,7 +21,7 @@
typedef void (*handle_command_fn)(int argc, char **argv);
-void monkey_register_handler(const char *cmd, handle_command_fn fn);
+nserror monkey_register_handler(const char *cmd, handle_command_fn fn);
void monkey_process_command(void);
diff --git a/monkey/main.c b/monkey/main.c
index 77ef831..289017d 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -42,6 +42,19 @@ char **respaths; /** resource search path vector */
static bool monkey_done = false;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ fprintf(stderr, "DIE %s\n", error);
+ exit(EXIT_FAILURE);
+}
+
/* Stolen from gtk/gui.c */
static char **
nsmonkey_init_resource(const char *resource_path)
@@ -174,8 +187,16 @@ main(int argc, char **argv)
urldb_load_cookies(nsoption_charp(cookie_file));
monkey_prepare_input();
- monkey_register_handler("QUIT", quit_handler);
- monkey_register_handler("WINDOW", monkey_window_handle_command);
+
+ ret = monkey_register_handler("QUIT", quit_handler);
+ if (ret != NSERROR_OK) {
+ die("quit handler failed to register");
+ }
+
+ ret = monkey_register_handler("WINDOW", monkey_window_handle_command);
+ if (ret != NSERROR_OK) {
+ die("window handler fialed to register");
+ }
fprintf(stdout, "GENERIC STARTED\n");
diff --git a/monkey/utils.c b/monkey/utils.c
index e1a702f..102f8ac 100644
--- a/monkey/utils.c
+++ b/monkey/utils.c
@@ -28,8 +28,3 @@ void warn_user(const char *warning, const char *detail)
fprintf(stderr, "WARN %s %s\n", warning, detail);
}
-void die(const char * const error)
-{
- fprintf(stderr, "DIE %s\n", error);
- exit(EXIT_FAILURE);
-}
diff --git a/riscos/gui.h b/riscos/gui.h
index 9077afe..9e7704f 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -120,6 +120,15 @@ void ro_gui_drag_box_start(wimp_pointer *pointer);
bool ro_gui_prequit(void);
const char *ro_gui_default_language(void);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
/* in download.c */
void ro_gui_download_init(void);
void ro_gui_download_datasave_ack(wimp_message *message);
diff --git a/utils/utils.h b/utils/utils.h
index 9be859e..b908432 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -257,7 +257,6 @@ nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...);
int dir_sort_alpha(const struct dirent **d1, const struct dirent **d2);
/* Platform specific functions */
-void die(const char * const error) __attribute__ ((noreturn));
void warn_user(const char *warning, const char *detail);
void PDF_Password(char **owner_pass, char **user_pass, char *path);
diff --git a/windows/main.c b/windows/main.c
index 09198d5..86e06b1 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -43,6 +43,18 @@ static char **respaths; /** resource search path vector. */
char *options_file_location;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char *error)
+{
+ exit(1);
+}
+
static nsurl *gui_get_resource_url(const char *path)
{
char buf[PATH_MAX];
diff --git a/windows/misc.c b/windows/misc.c
index 3bf06f8..ad7ce0d 100644
--- a/windows/misc.c
+++ b/windows/misc.c
@@ -37,8 +37,4 @@ void warn_user(const char *warning, const char *detail)
MessageBox(NULL, message, "Warning", MB_ICONWARNING);
}
-void die(const char *error)
-{
- exit(1);
-}
-----------------------------------------------------------------------
Summary of changes:
amiga/misc.h | 9 +++++++++
atari/misc.h | 9 +++++++++
atari/plot/plot.c | 1 +
beos/gui.h | 9 +++++++++
cocoa/NetsurfApp.m | 12 ++++++++++++
cocoa/utils.m | 4 ----
content/urldb.c | 27 +++++++++++++++------------
content/urldb.h | 2 +-
framebuffer/gui.c | 13 +++++++++++++
framebuffer/misc.c | 5 -----
gtk/gui.c | 18 +++++++++++++-----
monkey/dispatch.c | 9 ++++++---
monkey/dispatch.h | 2 +-
monkey/main.c | 25 +++++++++++++++++++++++--
monkey/utils.c | 5 -----
riscos/gui.h | 9 +++++++++
utils/utils.h | 1 -
windows/main.c | 12 ++++++++++++
windows/misc.c | 4 ----
19 files changed, 133 insertions(+), 43 deletions(-)
diff --git a/amiga/misc.h b/amiga/misc.h
index db559f7..ce2d947 100644
--- a/amiga/misc.h
+++ b/amiga/misc.h
@@ -24,5 +24,14 @@ extern struct gui_file_table *amiga_file_table;
char *translate_escape_chars(const char *s);
int32 ami_warn_user_multi(const char *body, const char *opt1, const char *opt2, struct Window *win);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
#endif
diff --git a/atari/misc.h b/atari/misc.h
index 8d1719c..418f283 100755
--- a/atari/misc.h
+++ b/atari/misc.h
@@ -66,4 +66,13 @@ const char * file_select(const char * title, const char * name);
*/
long nkc_to_input_key(short nkc, long * ucs4_out);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
#endif
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index a0b99e5..1b949d2 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -32,6 +32,7 @@
#include "desktop/plotters.h"
#include "desktop/mouse.h"
+#include "atari/misc.h"
#include "atari/bitmap.h"
#include "utils/nsoption.h"
#include "atari/plot/plot.h"
diff --git a/beos/gui.h b/beos/gui.h
index 6689bd8..215cda8 100644
--- a/beos/gui.h
+++ b/beos/gui.h
@@ -67,3 +67,12 @@ void nsbeos_gui_view_source(struct hlcache_handle *content);
image_id nsbeos_find_app_path(char *path);
void nsbeos_update_system_ui_colors(void);
+
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
diff --git a/cocoa/NetsurfApp.m b/cocoa/NetsurfApp.m
index 3bd5f43..d76aee1 100644
--- a/cocoa/NetsurfApp.m
+++ b/cocoa/NetsurfApp.m
@@ -49,6 +49,18 @@
static bool cocoa_done = false;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ [NSException raise: @"NetsurfDie" format: @"Error: %s", error];
+}
+
- (void) loadOptions;
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
diff --git a/cocoa/utils.m b/cocoa/utils.m
index 61226ad..b49e503 100644
--- a/cocoa/utils.m
+++ b/cocoa/utils.m
@@ -22,10 +22,6 @@
#define UNIMPL() NSLog( @"Function '%s' unimplemented", __func__ )
-void die(const char * const error)
-{
- [NSException raise: @"NetsurfDie" format: @"Error: %s", error];
-}
void warn_user(const char *warning, const char *detail)
{
diff --git a/content/urldb.c b/content/urldb.c
index c74dae3..650c7bc 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -343,7 +343,7 @@ static struct bloom_filter *url_bloom;
*
* \param filename Name of file containing data
*/
-void urldb_load(const char *filename)
+nserror urldb_load(const char *filename)
{
#define MAXIMUM_URL_LENGTH 4096
char s[MAXIMUM_URL_LENGTH];
@@ -365,24 +365,24 @@ void urldb_load(const char *filename)
fp = fopen(filename, "r");
if (!fp) {
LOG(("Failed to open file '%s' for reading", filename));
- return;
+ return NSERROR_NOT_FOUND;
}
if (!fgets(s, MAXIMUM_URL_LENGTH, fp)) {
fclose(fp);
- return;
+ return NSERROR_NEED_DATA;
}
version = atoi(s);
if (version < MIN_URL_FILE_VERSION) {
LOG(("Unsupported URL file version."));
fclose(fp);
- return;
+ return NSERROR_INVALID;
}
if (version > URL_FILE_VERSION) {
LOG(("Unknown URL file version."));
fclose(fp);
- return;
+ return NSERROR_INVALID;
}
while (fgets(host, sizeof host, fp)) {
@@ -417,7 +417,8 @@ void urldb_load(const char *filename)
h = urldb_add_host(host);
if (!h) {
LOG(("Failed adding host: '%s'", host));
- die("Memory exhausted whilst loading URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
/* load the non-corrupt data */
@@ -467,8 +468,8 @@ void urldb_load(const char *filename)
*/
if (nsurl_create(url, &nsurl) != NSERROR_OK) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
if (url_bloom != NULL) {
@@ -480,8 +481,8 @@ void urldb_load(const char *filename)
if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY,
&path_query, &len) != NSERROR_OK) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
scheme_lwc = nsurl_get_component(nsurl, NSURL_SCHEME);
@@ -491,8 +492,8 @@ void urldb_load(const char *filename)
fragment_lwc, nsurl);
if (!p) {
LOG(("Failed inserting '%s'", url));
- die("Memory exhausted whilst loading "
- "URL file");
+ fclose(fp);
+ return NSERROR_NOMEM;
}
nsurl_unref(nsurl);
lwc_string_unref(scheme_lwc);
@@ -533,6 +534,8 @@ void urldb_load(const char *filename)
fclose(fp);
LOG(("Successfully loaded URL file"));
#undef MAXIMUM_URL_LENGTH
+
+ return NSERROR_OK;
}
/**
diff --git a/content/urldb.h b/content/urldb.h
index d600430..c0fece2 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -68,7 +68,7 @@ struct bitmap;
void urldb_destroy(void);
/* Persistence support */
-void urldb_load(const char *filename);
+nserror urldb_load(const char *filename);
void urldb_save(const char *filename);
void urldb_set_url_persistence(nsurl *url, bool persist);
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 992b192..180c261 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -97,6 +97,19 @@ static struct gui_drag {
} gui_drag;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char *error)
+{
+ LOG(("%s", error));
+ exit(1);
+}
+
/* queue a redraw operation, co-ordinates are relative to the window */
static void
fb_queue_redraw(struct fbtk_widget_s *widget, int x0, int y0, int x1, int y1)
diff --git a/framebuffer/misc.c b/framebuffer/misc.c
index 0a45b28..406a959 100644
--- a/framebuffer/misc.c
+++ b/framebuffer/misc.c
@@ -30,9 +30,4 @@ void warn_user(const char *warning, const char *detail)
LOG(("%s %s", warning, detail));
}
-void die(const char *error)
-{
- LOG(("%s", error));
- exit(1);
-}
diff --git a/gtk/gui.c b/gtk/gui.c
index da993ac..eeba466 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -106,6 +106,19 @@ static void nsgtk_PDF_no_pass(GtkButton *w, gpointer data);
char **respaths; /** resource search path vector */
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ fprintf(stderr, "%s", error);
+ exit(EXIT_FAILURE);
+}
+
/** Create an array of valid paths to search for resources.
*
* The idea is that all the complex path computation to find resources
@@ -584,11 +597,6 @@ void warn_user(const char *warning, const char *detail)
gtk_widget_show_all(GTK_WIDGET(nsgtk_warning_window));
}
-void die(const char * const error)
-{
- fprintf(stderr, "%s", error);
- exit(EXIT_FAILURE);
-}
static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
diff --git a/monkey/dispatch.c b/monkey/dispatch.c
index 9d02256..c70070d 100644
--- a/monkey/dispatch.c
+++ b/monkey/dispatch.c
@@ -35,15 +35,18 @@ typedef struct cmdhandler {
static monkey_cmdhandler_t *handler_ring = NULL;
-void
+nserror
monkey_register_handler(const char *cmd, handle_command_fn fn)
{
monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1);
- if (ret == NULL)
- die("Unable to allocate handler");
+ if (ret == NULL) {
+ LOG(("Unable to allocate handler"));
+ return NSERROR_NOMEM;
+ }
ret->cmd = strdup(cmd);
ret->fn = fn;
RING_INSERT(handler_ring, ret);
+ return NSERROR_OK;
}
void
diff --git a/monkey/dispatch.h b/monkey/dispatch.h
index fe8f4e2..dc6e50a 100644
--- a/monkey/dispatch.h
+++ b/monkey/dispatch.h
@@ -21,7 +21,7 @@
typedef void (*handle_command_fn)(int argc, char **argv);
-void monkey_register_handler(const char *cmd, handle_command_fn fn);
+nserror monkey_register_handler(const char *cmd, handle_command_fn fn);
void monkey_process_command(void);
diff --git a/monkey/main.c b/monkey/main.c
index 77ef831..289017d 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -42,6 +42,19 @@ char **respaths; /** resource search path vector */
static bool monkey_done = false;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char * const error)
+{
+ fprintf(stderr, "DIE %s\n", error);
+ exit(EXIT_FAILURE);
+}
+
/* Stolen from gtk/gui.c */
static char **
nsmonkey_init_resource(const char *resource_path)
@@ -174,8 +187,16 @@ main(int argc, char **argv)
urldb_load_cookies(nsoption_charp(cookie_file));
monkey_prepare_input();
- monkey_register_handler("QUIT", quit_handler);
- monkey_register_handler("WINDOW", monkey_window_handle_command);
+
+ ret = monkey_register_handler("QUIT", quit_handler);
+ if (ret != NSERROR_OK) {
+ die("quit handler failed to register");
+ }
+
+ ret = monkey_register_handler("WINDOW", monkey_window_handle_command);
+ if (ret != NSERROR_OK) {
+ die("window handler fialed to register");
+ }
fprintf(stdout, "GENERIC STARTED\n");
diff --git a/monkey/utils.c b/monkey/utils.c
index e1a702f..102f8ac 100644
--- a/monkey/utils.c
+++ b/monkey/utils.c
@@ -28,8 +28,3 @@ void warn_user(const char *warning, const char *detail)
fprintf(stderr, "WARN %s %s\n", warning, detail);
}
-void die(const char * const error)
-{
- fprintf(stderr, "DIE %s\n", error);
- exit(EXIT_FAILURE);
-}
diff --git a/riscos/gui.h b/riscos/gui.h
index 9077afe..9e7704f 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -120,6 +120,15 @@ void ro_gui_drag_box_start(wimp_pointer *pointer);
bool ro_gui_prequit(void);
const char *ro_gui_default_language(void);
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+void die(const char * const error) __attribute__ ((noreturn));
+
/* in download.c */
void ro_gui_download_init(void);
void ro_gui_download_datasave_ack(wimp_message *message);
diff --git a/utils/utils.h b/utils/utils.h
index 9be859e..b908432 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -257,7 +257,6 @@ nserror snstrjoin(char **str, size_t *size, char sep, size_t nelm, ...);
int dir_sort_alpha(const struct dirent **d1, const struct dirent **d2);
/* Platform specific functions */
-void die(const char * const error) __attribute__ ((noreturn));
void warn_user(const char *warning, const char *detail);
void PDF_Password(char **owner_pass, char **user_pass, char *path);
diff --git a/windows/main.c b/windows/main.c
index 09198d5..86e06b1 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -43,6 +43,18 @@ static char **respaths; /** resource search path vector. */
char *options_file_location;
+/**
+ * Cause an abnormal program termination.
+ *
+ * \note This never returns and is intended to terminate without any cleanup.
+ *
+ * \param error The message to display to the user.
+ */
+static void die(const char *error)
+{
+ exit(1);
+}
+
static nsurl *gui_get_resource_url(const char *path)
{
char buf[PATH_MAX];
diff --git a/windows/misc.c b/windows/misc.c
index 3bf06f8..ad7ce0d 100644
--- a/windows/misc.c
+++ b/windows/misc.c
@@ -37,8 +37,4 @@ void warn_user(const char *warning, const char *detail)
MessageBox(NULL, message, "Warning", MB_ICONWARNING);
}
-void die(const char *error)
-{
- exit(1);
-}
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-252-ga913af5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a913af5cf54400b441f3b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a913af5cf54400b441f3b1f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a913af5cf54400b441f3b1fbf...
The branch, master has been updated
via a913af5cf54400b441f3b1fbfc5d508cf85fea43 (commit)
from 2da8ef3e8347c83dd279425cdbe1946a4e982846 (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=a913af5cf54400b441f...
commit a913af5cf54400b441f3b1fbfc5d508cf85fea43
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix url variable name.
diff --git a/amiga/launch.c b/amiga/launch.c
index b3678f9..e1a4946 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -95,7 +95,7 @@ BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
if(IsMinListEmpty(list)) return FALSE;
- url_scheme = nsurl_get_component(ns_url, NSURL_SCHEME);
+ url_scheme = nsurl_get_component(url, NSURL_SCHEME);
node = (struct ami_protocol *)GetHead((struct List *)list);
-----------------------------------------------------------------------
Summary of changes:
amiga/launch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amiga/launch.c b/amiga/launch.c
index b3678f9..e1a4946 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -95,7 +95,7 @@ BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
if(IsMinListEmpty(list)) return FALSE;
- url_scheme = nsurl_get_component(ns_url, NSURL_SCHEME);
+ url_scheme = nsurl_get_component(url, NSURL_SCHEME);
node = (struct ami_protocol *)GetHead((struct List *)list);
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-251-g2da8ef3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2da8ef3e8347c83dd2794...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2da8ef3e8347c83dd279425...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2da8ef3e8347c83dd279425cd...
The branch, master has been updated
via 2da8ef3e8347c83dd279425cdbe1946a4e982846 (commit)
from 64d591676b638b43831f5ae78a6c59a7753c62df (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=2da8ef3e8347c83dd27...
commit 2da8ef3e8347c83dd279425cdbe1946a4e982846
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add missed semicolon, and ensure nsurl is unreffed.
diff --git a/amiga/launch.c b/amiga/launch.c
index 67d74e4..b3678f9 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -46,7 +46,7 @@ struct ami_protocol
struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
- nsurl *ns_url
+ nsurl *ns_url;
struct ami_protocol *ami_p =
(struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
@@ -56,10 +56,10 @@ struct ami_protocol *ami_openurl_add_protocol(const char *url)
}
ami_p->protocol = nsurl_get_component(ns_url, NSURL_SCHEME);
+ nsurl_unref(ns_url);
if (ami_p->protocol == NULL)
{
FreeVec(ami_p);
- nsurl_unref(ns_url);
return NULL;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/launch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/amiga/launch.c b/amiga/launch.c
index 67d74e4..b3678f9 100755
--- a/amiga/launch.c
+++ b/amiga/launch.c
@@ -46,7 +46,7 @@ struct ami_protocol
struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
- nsurl *ns_url
+ nsurl *ns_url;
struct ami_protocol *ami_p =
(struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
@@ -56,10 +56,10 @@ struct ami_protocol *ami_openurl_add_protocol(const char *url)
}
ami_p->protocol = nsurl_get_component(ns_url, NSURL_SCHEME);
+ nsurl_unref(ns_url);
if (ami_p->protocol == NULL)
{
FreeVec(ami_p);
- nsurl_unref(ns_url);
return NULL;
}
--
NetSurf Browser
8 years, 3 months
netsurf: branch master updated. release/3.2-250-g64d5916
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/64d591676b638b43831f5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/64d591676b638b43831f5ae...
...tree http://git.netsurf-browser.org/netsurf.git/tree/64d591676b638b43831f5ae78...
The branch, master has been updated
via 64d591676b638b43831f5ae78a6c59a7753c62df (commit)
from 1ccfcfe953d9a5144746bfafcf5d37a8229ca998 (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=64d591676b638b43831...
commit 64d591676b638b43831f5ae78a6c59a7753c62df
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove unused url_components stuff.
diff --git a/utils/url.c b/utils/url.c
index d1b6805..e1903a8 100644
--- a/utils/url.c
+++ b/utils/url.c
@@ -31,15 +31,6 @@
#include "utils/utils.h"
#include "utils/url.h"
-struct url_components_internal {
- char *buffer; /* buffer used for all the following data */
- char *scheme;
- char *authority;
- char *path;
- char *query;
- char *fragment;
-};
-
regex_t url_re, url_up_re;
@@ -154,138 +145,6 @@ out_true:
return true;
}
-/**
- * Split a URL into separate components
- *
- * URLs passed to this function are assumed to be valid and no error checking
- * or recovery is attempted.
- *
- * See RFC 3986 for reference.
- *
- * \param url A valid absolute or relative URL.
- * \param result Pointer to buffer to hold components.
- * \return NSERROR_OK on success
- */
-static nserror
-url_get_components(const char *url, struct url_components *result)
-{
- int storage_length;
- char *storage_end;
- const char *scheme;
- const char *authority;
- const char *path;
- const char *query;
- const char *fragment;
- struct url_components_internal *internal;
-
- assert(url);
-
- /* clear our return value */
- internal = (struct url_components_internal *)result;
- memset(result, 0x00, sizeof(struct url_components));
-
- /* get enough storage space for a URL with termination at each node */
- storage_length = strlen(url) + 8;
- internal->buffer = malloc(storage_length);
- if (!internal->buffer)
- return NSERROR_NOMEM;
- storage_end = internal->buffer;
-
- /* look for a valid scheme */
- scheme = url;
- if (isalpha(*scheme)) {
- for (scheme = url + 1;
- ((*scheme != ':') && (*scheme != '\0'));
- scheme++) {
- if (!isalnum(*scheme) && (*scheme != '+') &&
- (*scheme != '-') && (*scheme != '.'))
- break;
- }
-
- if (*scheme == ':') {
- memcpy(storage_end, url, scheme - url);
- storage_end[scheme - url] = '\0';
- result->scheme = storage_end;
- storage_end += scheme - url + 1;
- scheme++;
- } else {
- scheme = url;
- }
- }
-
-
- /* look for an authority */
- authority = scheme;
- if ((authority[0] == '/') && (authority[1] == '/')) {
- authority = strpbrk(scheme + 2, "/?#");
- if (!authority)
- authority = scheme + strlen(scheme);
- memcpy(storage_end, scheme + 2, authority - scheme - 2);
- storage_end[authority - scheme - 2] = '\0';
- result->authority = storage_end;
- storage_end += authority - scheme - 1;
- }
-
-
- /* look for a path */
- path = authority;
- if ((*path != '?') && (*path != '#') && (*path != '\0')) {
- path = strpbrk(path, "?#");
- if (!path)
- path = authority + strlen(authority);
- memcpy(storage_end, authority, path - authority);
- storage_end[path - authority] = '\0';
- result->path = storage_end;
- storage_end += path - authority + 1;
- }
-
-
- /* look for a query */
- query = path;
- if (*query == '?') {
- query = strchr(query, '#');
- if (!query)
- query = path + strlen(path);
- memcpy(storage_end, path + 1, query - path - 1);
- storage_end[query - path - 1] = '\0';
- result->query = storage_end;
- storage_end += query - path;
- }
-
-
- /* look for a fragment */
- fragment = query;
- if (*fragment == '#') {
- fragment = query + strlen(query);
-
- /* make a copy of the result for the caller */
- memcpy(storage_end, query + 1, fragment - query - 1);
- storage_end[fragment - query - 1] = '\0';
- result->fragment = storage_end;
- storage_end += fragment - query;
- }
-
- assert((result->buffer + storage_length) >= storage_end);
- return NSERROR_OK;
-}
-
-
-/**
- * Release some url components from memory
- *
- * \param result pointer to buffer containing components
- */
-static void url_destroy_components(const struct url_components *components)
-{
- const struct url_components_internal *internal;
-
- assert(components);
-
- internal = (const struct url_components_internal *)components;
- if (internal->buffer)
- free(internal->buffer);
-}
-
/* exported interface documented in utils/url.h */
nserror url_nice(const char *url, char **result,
diff --git a/utils/url.h b/utils/url.h
index 9f8de4e..a2efbec 100644
--- a/utils/url.h
+++ b/utils/url.h
@@ -33,16 +33,6 @@
/** File url prefix length. */
#define FILE_SCHEME_PREFIX_LEN 8
-/** Split out components of a url. */
-struct url_components {
- const char *buffer;
- const char *scheme;
- const char *authority;
- const char *path;
- const char *query;
- const char *fragment;
-};
-
/**
* Initialise URL routines.
-----------------------------------------------------------------------
Summary of changes:
utils/url.c | 141 -----------------------------------------------------------
utils/url.h | 10 -----
2 files changed, 151 deletions(-)
diff --git a/utils/url.c b/utils/url.c
index d1b6805..e1903a8 100644
--- a/utils/url.c
+++ b/utils/url.c
@@ -31,15 +31,6 @@
#include "utils/utils.h"
#include "utils/url.h"
-struct url_components_internal {
- char *buffer; /* buffer used for all the following data */
- char *scheme;
- char *authority;
- char *path;
- char *query;
- char *fragment;
-};
-
regex_t url_re, url_up_re;
@@ -154,138 +145,6 @@ out_true:
return true;
}
-/**
- * Split a URL into separate components
- *
- * URLs passed to this function are assumed to be valid and no error checking
- * or recovery is attempted.
- *
- * See RFC 3986 for reference.
- *
- * \param url A valid absolute or relative URL.
- * \param result Pointer to buffer to hold components.
- * \return NSERROR_OK on success
- */
-static nserror
-url_get_components(const char *url, struct url_components *result)
-{
- int storage_length;
- char *storage_end;
- const char *scheme;
- const char *authority;
- const char *path;
- const char *query;
- const char *fragment;
- struct url_components_internal *internal;
-
- assert(url);
-
- /* clear our return value */
- internal = (struct url_components_internal *)result;
- memset(result, 0x00, sizeof(struct url_components));
-
- /* get enough storage space for a URL with termination at each node */
- storage_length = strlen(url) + 8;
- internal->buffer = malloc(storage_length);
- if (!internal->buffer)
- return NSERROR_NOMEM;
- storage_end = internal->buffer;
-
- /* look for a valid scheme */
- scheme = url;
- if (isalpha(*scheme)) {
- for (scheme = url + 1;
- ((*scheme != ':') && (*scheme != '\0'));
- scheme++) {
- if (!isalnum(*scheme) && (*scheme != '+') &&
- (*scheme != '-') && (*scheme != '.'))
- break;
- }
-
- if (*scheme == ':') {
- memcpy(storage_end, url, scheme - url);
- storage_end[scheme - url] = '\0';
- result->scheme = storage_end;
- storage_end += scheme - url + 1;
- scheme++;
- } else {
- scheme = url;
- }
- }
-
-
- /* look for an authority */
- authority = scheme;
- if ((authority[0] == '/') && (authority[1] == '/')) {
- authority = strpbrk(scheme + 2, "/?#");
- if (!authority)
- authority = scheme + strlen(scheme);
- memcpy(storage_end, scheme + 2, authority - scheme - 2);
- storage_end[authority - scheme - 2] = '\0';
- result->authority = storage_end;
- storage_end += authority - scheme - 1;
- }
-
-
- /* look for a path */
- path = authority;
- if ((*path != '?') && (*path != '#') && (*path != '\0')) {
- path = strpbrk(path, "?#");
- if (!path)
- path = authority + strlen(authority);
- memcpy(storage_end, authority, path - authority);
- storage_end[path - authority] = '\0';
- result->path = storage_end;
- storage_end += path - authority + 1;
- }
-
-
- /* look for a query */
- query = path;
- if (*query == '?') {
- query = strchr(query, '#');
- if (!query)
- query = path + strlen(path);
- memcpy(storage_end, path + 1, query - path - 1);
- storage_end[query - path - 1] = '\0';
- result->query = storage_end;
- storage_end += query - path;
- }
-
-
- /* look for a fragment */
- fragment = query;
- if (*fragment == '#') {
- fragment = query + strlen(query);
-
- /* make a copy of the result for the caller */
- memcpy(storage_end, query + 1, fragment - query - 1);
- storage_end[fragment - query - 1] = '\0';
- result->fragment = storage_end;
- storage_end += fragment - query;
- }
-
- assert((result->buffer + storage_length) >= storage_end);
- return NSERROR_OK;
-}
-
-
-/**
- * Release some url components from memory
- *
- * \param result pointer to buffer containing components
- */
-static void url_destroy_components(const struct url_components *components)
-{
- const struct url_components_internal *internal;
-
- assert(components);
-
- internal = (const struct url_components_internal *)components;
- if (internal->buffer)
- free(internal->buffer);
-}
-
/* exported interface documented in utils/url.h */
nserror url_nice(const char *url, char **result,
diff --git a/utils/url.h b/utils/url.h
index 9f8de4e..a2efbec 100644
--- a/utils/url.h
+++ b/utils/url.h
@@ -33,16 +33,6 @@
/** File url prefix length. */
#define FILE_SCHEME_PREFIX_LEN 8
-/** Split out components of a url. */
-struct url_components {
- const char *buffer;
- const char *scheme;
- const char *authority;
- const char *path;
- const char *query;
- const char *fragment;
-};
-
/**
* Initialise URL routines.
--
NetSurf Browser
8 years, 3 months