From 38966b1daa6aba9593ca4748e3a016a2488b384e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 15 Apr 2013 23:58:29 +0100 Subject: remove include --- amiga/gui.c | 1 - 1 file changed, 1 deletion(-) diff --git a/amiga/gui.c b/amiga/gui.c index fbe46d0b5..e2616cf21 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -17,7 +17,6 @@ */ /* NetSurf core includes */ -#include "content/hlcache.h" #include "content/urldb.h" #include "css/utils.h" #include "desktop/browser_private.h" -- cgit v1.2.3 From 6549c066837eeb5e022f697450e743d40404c3d8 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 18 Jun 2013 20:13:59 +0100 Subject: Fix ARexx OPEN NEWTAB --- amiga/arexx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amiga/arexx.c b/amiga/arexx.c index ed05f6c16..436aa8f49 100644 --- a/amiga/arexx.c +++ b/amiga/arexx.c @@ -262,7 +262,7 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu BROWSER_WINDOW_TAB, url, NULL, - NULL, + bw, NULL); } else if(cmd->ac_ArgList[1]) -- cgit v1.2.3 From ba297a71796a61dfd4d50a3611587cd01550c4e0 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 22 Jun 2013 13:16:15 +0100 Subject: Create a helper launch script, and make launch-handler use it --- amiga/dist/Install | 59 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/amiga/dist/Install b/amiga/dist/Install index 3977629d8..61defec03 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -426,6 +426,7 @@ " by launching a web browser.\n\n" "The installation will update the configuration of " "OS4.1 to allow URLs to be opened by NetSurf.") + (default 1) ) ) ) @@ -610,6 +611,54 @@ (p_setmimetype "zip" "application/x-zip") (p_setmimetype "js" "application/javascript") +(complete 97) + +(if (>= osver 53) + (if (= (exists "Rexx:NetSurf") 0) + ( + (textfile + (prompt "Creating NetSurf launch helper") + (help @textfile-help) + (dest "Rexx:NetSurf") + (append "/*\n" +" * Copyright 2013 Chris Young \n" +" *\n" +" * This file is part of NetSurf, http://www.netsurf-browser.org/\n" +" *\n" +" * NetSurf is free software; you can redistribute it and/or modify\n" +" * it under the terms of the GNU General Public License as published by\n" +" * the Free Software Foundation; version 2 of the License.\n" +" *\n" +" * NetSurf is distributed in the hope that it will be useful,\n" +" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +" * GNU General Public License for more details.\n" +" *\n" +" * You should have received a copy of the GNU General Public License\n" +" * along with this program. If not, see .\n" +" */\n" +"\n" +"/* This is a convenience script for launching NetSurf from the Shell.\n" +" * If NetSurf is already running it will open the supplied URL in a new tab.\n" +" * This can be used in URL Prefs in place of directly calling APPDIR:NetSurf.\n" +" */\n" +"\n" +"options results\n" +"parse arg url\n" +"\n" +"if show('P', 'NETSURF') then do\n" +" address NETSURF 'OPEN' url 'NEWTAB'\n" +" address NETSURF 'TOFRONT'\n" +"end\n" +"else do\n" +" address command 'APPDIR:NetSurf URL' url\n" +"end\n") + ) + (protect "Rexx:NetSurf" "+se") + ) + ) +) + (complete 98) (if (= #addlaunchhandler 1) @@ -621,23 +670,23 @@ (working "Adding NetSurf to launch-handler config") (if (= (p_chk_launch-handler "FILE.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"URL=*\"file:///%s*\"\"") + (p_fitr "ENVARC:launch-handler/URL/FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"file:///%s*\"\"") ) (if (= (p_chk_launch-handler "HTTP.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"URL=*\"http://%s*\"\"") + (p_fitr "ENVARC:launch-handler/URL/HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://%s*\"\"") ) (if (= (p_chk_launch-handler "HTTPS.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"URL=*\"https://%s*\"\"") + (p_fitr "ENVARC:launch-handler/URL/HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"https://%s*\"\"") ) (if (= (p_chk_launch-handler "WWW.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"URL=*\"http://www.%s*\"\"") + (p_fitr "ENVARC:launch-handler/URL/WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://www.%s*\"\"") ) ; (if (= (p_chk_launch-handler "FTP.LH") 0) -; (p_fitr "ENVARC:launch-handler/URL/FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"URL=*\"ftp://%s*\"\"") +; (p_fitr "ENVARC:launch-handler/URL/FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"ftp://%s*\"\"") ; ) ) ) -- cgit v1.2.3 From 6358290e78e340ee82c26ab8e327b48db1f8c43e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 22 Jun 2013 13:17:33 +0100 Subject: Correct the readme a bit --- amiga/dist/netsurf.readme | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/amiga/dist/netsurf.readme b/amiga/dist/netsurf.readme index 47a938170..bd37b2e62 100755 --- a/amiga/dist/netsurf.readme +++ b/amiga/dist/netsurf.readme @@ -2,13 +2,10 @@ Short: Fast CSS capable web browser Uploader: chris@unsatisfactorysoftware.co.uk (Chris Young) Author: NetSurf contributors (OS4 port by Chris Young) Type: comm/www -Version: 3.0 development +Version: 3.1 development Architecture: ppc-amigaos >= 4.0.0 -Install manually with Installer script only - -INTENTIONALLY NOT AVAILABLE VIA AMIUPDATE - -This is a test build of NetSurf 3.0 for AmigaOS 4. +This is a test build of NetSurf 3.1 for AmigaOS 4. It is beta software, which means it is unstable and missing features - use at your own risk! -- cgit v1.2.3 From 59dc2931565c56ee2d037568758db23bf4893169 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 25 Jun 2013 19:01:41 +0100 Subject: fix status/toolbar bottom split position and setting user option in gtk --- gtk/scaffolding.c | 63 ++++++++++++++----------------- gtk/window.c | 110 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 104 insertions(+), 69 deletions(-) diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 566197dcd..016e24fcd 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -127,7 +127,6 @@ struct gtk_scaffolding { GtkImage *throbber; struct gtk_search *search; GtkWidget *webSearchEntry; - GtkPaned *status_pane; int offset; int toolbarmem; @@ -545,7 +544,7 @@ static void nsgtk_window_tabs_remove(GtkNotebook *notebook, */ static void nsgtk_openfile_open(const char *filename) { - struct browser_window *bw; + struct browser_window *bw; char *urltxt; nsurl *url; nserror error; @@ -639,11 +638,11 @@ MULTIHANDLER(newtab) } else if (nsoption_bool(new_blank)) { /** @todo what the heck is this for? */ GtkWidget *window = gtk_notebook_get_nth_page(g->notebook, -1); - nsgtk_widget_override_background_color(window, - GTK_STATE_NORMAL, + nsgtk_widget_override_background_color(window, + GTK_STATE_NORMAL, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF); } - + return TRUE; } @@ -1016,7 +1015,7 @@ MENUHANDLER(link_openwin) } if (error != NSERROR_OK) { warn_user(messages_get_errorcode(error), 0); - } + } return TRUE; } @@ -1050,7 +1049,7 @@ MENUHANDLER(link_opentab) } if (error != NSERROR_OK) { warn_user(messages_get_errorcode(error), 0); - } + } temp_open_background = -1; @@ -1285,10 +1284,6 @@ MULTIHANDLER(savewindowsize) { int x,y,w,h; - if (GTK_IS_PANED(g->status_pane)) { - nsoption_set_int(toolbar_status_size, - gtk_paned_get_position(g->status_pane)); - } gtk_window_get_position(g->window, &x, &y); gtk_window_get_size(g->window, &w, &h); @@ -1682,7 +1677,7 @@ BUTTONHANDLER(history) #if GTK_CHECK_VERSION(3,0,0) -static gboolean +static gboolean nsgtk_history_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) { struct rect clip; @@ -1721,7 +1716,7 @@ nsgtk_history_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) #else /* signal handler functions for the local history window */ -static gboolean +static gboolean nsgtk_history_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer g) { struct rect clip; @@ -1820,25 +1815,25 @@ static bool nsgtk_new_scaffolding_popup(struct gtk_scaffolding *g, GtkAccelGroup SIG_CONNECT(nmenu->popup_menu, "hide", nsgtk_window_popup_menu_hidden, g); - g_signal_connect(nmenu->savelink_menuitem, "activate", + g_signal_connect(nmenu->savelink_menuitem, "activate", G_CALLBACK(nsgtk_on_savelink_activate_menu), g); - g_signal_connect(nmenu->opentab_menuitem, "activate", + g_signal_connect(nmenu->opentab_menuitem, "activate", G_CALLBACK(nsgtk_on_link_opentab_activate_menu), g); - g_signal_connect(nmenu->openwin_menuitem, "activate", + g_signal_connect(nmenu->openwin_menuitem, "activate", G_CALLBACK(nsgtk_on_link_openwin_activate_menu), g); - g_signal_connect(nmenu->cut_menuitem, "activate", + g_signal_connect(nmenu->cut_menuitem, "activate", G_CALLBACK(nsgtk_on_cut_activate_menu), g); - g_signal_connect(nmenu->copy_menuitem, "activate", + g_signal_connect(nmenu->copy_menuitem, "activate", G_CALLBACK(nsgtk_on_copy_activate_menu), g); - g_signal_connect(nmenu->paste_menuitem, "activate", + g_signal_connect(nmenu->paste_menuitem, "activate", G_CALLBACK(nsgtk_on_paste_activate_menu), g); - g_signal_connect(nmenu->customize_menuitem, "activate", + g_signal_connect(nmenu->customize_menuitem, "activate", G_CALLBACK(nsgtk_on_customize_activate_menu), g); /* set initial popup menu visibility */ @@ -1942,10 +1937,10 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) * or some sensible default if they're not set yet. */ if (nsoption_int(window_width) > 0) { - gtk_window_move(g->window, - nsoption_int(window_x), + gtk_window_move(g->window, + nsoption_int(window_x), nsoption_int(window_y)); - gtk_window_resize(g->window, + gtk_window_resize(g->window, nsoption_int(window_width), nsoption_int(window_height)); } else { @@ -1962,7 +1957,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) GtkIconSize tooliconsize; GtkToolbarStyle toolbarstyle; - g_object_get(settings, + g_object_get(settings, "gtk-toolbar-icon-size", &tooliconsize, "gtk-toolbar-style", &toolbarstyle, NULL); @@ -2077,8 +2072,8 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr)) /* connect history window signals to their handlers */ - nsgtk_connect_draw_event(GTK_WIDGET(g->history_window->drawing_area), - G_CALLBACK(nsgtk_history_draw_event), + nsgtk_connect_draw_event(GTK_WIDGET(g->history_window->drawing_area), + G_CALLBACK(nsgtk_history_draw_event), g->history_window); /*CONNECT(g->history_window->drawing_area, "motion_notify_event", nsgtk_history_motion_notify_event, g->history_window);*/ @@ -2107,12 +2102,10 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) CONNECT(g->search->entry, "key-press-event", nsgtk_search_entry_key, g); CONNECT(g->search->buttons[2], "clicked", nsgtk_search_close_button_clicked, g); - CONNECT(g->search->caseSens, "toggled", nsgtk_search_entry_changed, - g); - + CONNECT(g->search->caseSens, "toggled", nsgtk_search_entry_changed, g); CONNECT(g->tool_bar, "popup-context-menu", - nsgtk_window_tool_bar_clicked, g); + nsgtk_window_tool_bar_clicked, g); /* create popup menu */ nsgtk_new_scaffolding_popup(g, group); @@ -2242,13 +2235,13 @@ nsgtk_scaffolding_set_icon(struct gui_window *gw) GdkPixbuf *icon_pixbuf = nsgtk_get_icon(gw); /* check icon needs to be shown */ - if ((icon_pixbuf == NULL) || + if ((icon_pixbuf == NULL) || (sc->top_level != gw)) { return; } - nsgtk_entry_set_icon_from_pixbuf(sc->url_bar, - GTK_ENTRY_ICON_PRIMARY, + nsgtk_entry_set_icon_from_pixbuf(sc->url_bar, + GTK_ENTRY_ICON_PRIMARY, icon_pixbuf); gtk_widget_show_all(GTK_WIDGET(sc->buttons[URL_BAR_ITEM]->button)); @@ -2260,7 +2253,7 @@ void gui_window_set_search_ico(hlcache_handle *ico) nsgtk_scaffolding *current; GdkPixbuf *srch_pixbuf; - if ((ico == NULL) && + if ((ico == NULL) && (ico = search_web_ico()) == NULL) { return; } @@ -2278,7 +2271,7 @@ void gui_window_set_search_ico(hlcache_handle *ico) /* add ico to each window's toolbar */ for (current = scaf_list; current != NULL; current = current->next) { - nsgtk_entry_set_icon_from_pixbuf(current->webSearchEntry, + nsgtk_entry_set_icon_from_pixbuf(current->webSearchEntry, GTK_ENTRY_ICON_PRIMARY, srch_pixbuf); } diff --git a/gtk/window.c b/gtk/window.c index 5edace8f3..6a5cce160 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -44,6 +44,10 @@ #include "utils/log.h" #include "utils/utils.h" +/* helper macro to conenct signals to callbacks */ +#define CONNECT(obj, sig, callback, ptr) \ + g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr)) + extern const GdkPixdata menu_cursor_pixdata; struct gui_window { @@ -83,9 +87,12 @@ struct gui_window { /** statusbar */ GtkLabel *status_bar; - /** scrollbar paned */ + /** status pane */ GtkPaned *paned; + /** has the status pane had its first size operation yet? */ + bool paned_sized; + /** to allow disactivation / resume of normal window behaviour */ gulong signalhandler[NSGTK_WINDOW_SIGNAL_COUNT]; @@ -147,7 +154,7 @@ float nsgtk_get_scale_for_gui(struct gui_window *g) #if GTK_CHECK_VERSION(3,0,0) -static gboolean +static gboolean nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) { struct gui_window *gw = data; @@ -202,7 +209,7 @@ nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) #else -static gboolean +static gboolean nsgtk_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { struct gui_window *gw = data; @@ -480,7 +487,7 @@ static gboolean nsgtk_window_keypress_event(GtkWidget *widget, if (browser_window_key_press(g->bw, nskey)) return TRUE; - if ((event->state & 0x7) != 0) + if ((event->state & 0x7) != 0) return TRUE; double value; @@ -591,17 +598,49 @@ static gboolean nsgtk_window_size_allocate_event(GtkWidget *widget, g->bw->reformat_pending = true; browser_reformat_pending = true; - if (g->paned != NULL) { - /* Set status bar / scroll bar proportion according to - * option_toolbar_status_size */ - /* TODO: Probably want to detect when the user adjusts the - * status bar width, remember that proportion for the - * window, and use that here. */ - gtk_paned_set_position(g->paned, - (nsoption_int(toolbar_status_size) * - allocation->width) / 10000); + + return TRUE; +} + + +/** when the pane position is changed update the user option + * + * The slightly awkward implementation with the first allocation flag + * is necessary because the initial window creation does not cause an + * allocate-event signal so the position value in the pane is incorrect + * and we cannot know what it should be until after the allocation + * (which did not generate a signal) is done as the user position is a + * percentage of pane total width not an absolute value. + */ +static void +nsgtk_paned_notify__position(GObject *gobject, GParamSpec *pspec, gpointer data) +{ + struct gui_window *g = data; + GtkAllocation pane_alloc; + + gtk_widget_get_allocation(GTK_WIDGET(g->paned), &pane_alloc); + + if (g->paned_sized == false) + { + g->paned_sized = true; + gtk_paned_set_position(g->paned, + (nsoption_int(toolbar_status_size) * pane_alloc.width) / 10000); + return; } + nsoption_set_int(toolbar_status_size, + ((gtk_paned_get_position(g->paned) * 10000) / (pane_alloc.width - 1))); +} + +/** Set status bar / scroll bar proportion according to user option + * when pane is resized. + */ +static gboolean nsgtk_paned_size_allocate_event(GtkWidget *widget, + GtkAllocation *allocation, gpointer data) +{ + gtk_paned_set_position(GTK_PANED(widget), + (nsoption_int(toolbar_status_size) * allocation->width) / 10000); + return TRUE; } @@ -611,6 +650,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, bool new_tab) { struct gui_window *g; /**< what we're creating to return */ + GError* error = NULL; g = calloc(1, sizeof(*g)); if (!g) { @@ -621,7 +661,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, LOG(("Creating gui window %p for browser window %p", g, bw)); g->bw = bw; - g->paned = NULL; g->mouse.state = 0; g->current_pointer = GUI_POINTER_DEFAULT; if (clone != NULL) { @@ -630,8 +669,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, bw->scale = (float) nsoption_int(scale) / 100.0; } - g->careth = 0; - + /* attach scaffold */ if (new_tab) { assert(clone != NULL); g->scaffold = clone->window->scaffold; @@ -639,7 +677,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, /* Now construct and attach a scaffold */ g->scaffold = nsgtk_new_scaffolding(g); } - if (g->scaffold == NULL) { warn_user("NoMemory", 0); free(g); @@ -649,10 +686,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, /* Construct our primary elements */ /* top-level document (not a frame) => create a new tab */ - GError* error = NULL; GtkBuilder* xml = gtk_builder_new(); - if (!gtk_builder_add_from_file(xml, - glade_file_location->tabcontents, + if (!gtk_builder_add_from_file(xml, + glade_file_location->tabcontents, &error)) { g_warning ("Couldn't load builder file: %s", error->message); g_error_free(error); @@ -706,28 +742,35 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, nsgtk_widget_set_can_focus(GTK_WIDGET(g->layout), TRUE); /* set the default background colour of the drawing area to white. */ - nsgtk_widget_override_background_color(GTK_WIDGET(g->layout), + nsgtk_widget_override_background_color(GTK_WIDGET(g->layout), GTK_STATE_NORMAL, 0, 0xffff, 0xffff, 0xffff); - nsgtk_connect_draw_event(GTK_WIDGET(g->layout), G_CALLBACK(nsgtk_window_draw_event), g); + nsgtk_connect_draw_event(GTK_WIDGET(g->layout), + G_CALLBACK(nsgtk_window_draw_event), g); -#define CONNECT(obj, sig, callback, ptr) \ - g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr)) - - CONNECT(g->layout, "motion_notify_event", + /* layout signals */ + CONNECT(g->layout, "motion-notify-event", nsgtk_window_motion_notify_event, g); g->signalhandler[NSGTK_WINDOW_SIGNAL_CLICK] = - CONNECT(g->layout, "button_press_event", + CONNECT(g->layout, "button-press-event", nsgtk_window_button_press_event, g); - CONNECT(g->layout, "button_release_event", + CONNECT(g->layout, "button-release-event", nsgtk_window_button_release_event, g); - CONNECT(g->layout, "key_press_event", + CONNECT(g->layout, "key-press-event", nsgtk_window_keypress_event, g); - CONNECT(g->layout, "size_allocate", + CONNECT(g->layout, "size-allocate", nsgtk_window_size_allocate_event, g); CONNECT(g->layout, "scroll-event", nsgtk_window_scroll_event, g); + + /* status pane signals */ + CONNECT(g->paned, "size-allocate", + nsgtk_paned_size_allocate_event, g); + + CONNECT(g->paned, "notify::position", + nsgtk_paned_notify__position, g); + return g; } @@ -813,8 +856,8 @@ void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon) if (icon_bitmap != NULL) { LOG(("Using %p bitmap", icon_bitmap)); gw->icon = nsgdk_pixbuf_get_from_surface(icon_bitmap->surface, 16, 16); - } - } + } + } if (gw->icon == NULL) { LOG(("Using default favicon")); @@ -1029,7 +1072,7 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) gtk_widget_get_display( GTK_WIDGET(g->layout)), cursortype); - gdk_window_set_cursor(nsgtk_widget_get_window(GTK_WIDGET(g->layout)), + gdk_window_set_cursor(nsgtk_widget_get_window(GTK_WIDGET(g->layout)), cursor); if (!nullcursor) @@ -1100,4 +1143,3 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, LOG(("width: %i", *width)); LOG(("height: %i", *height)); } - -- cgit v1.2.3