Thread: [Vimprobable-users] [PATCH 0/4] Site-specific browser settings
Vimprobable is a lean web browser optimised for full keyboard control
Brought to you by:
hanness
From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:22
|
This (highly experimental) patchset allows site-specific browser settings to be defined in vimprobablerc. Any :set command can be issued on a website basis. This allows for whitelisting or blacklisting approaches to deviate from the standard settings for certain websites. For example, to turn off your proxy and enable JavaScript, enter site http://www.example.org proxy=false|scripts=true in vimprobablerc. An abstract description can be found in vimprobablerc(5). Hannes Schueller (4): moving all internal flags into a new global struct of the type VSettings read per-site settings from the rc file applying per-site settings on URL match and reverting when visiting another site handle cases of various 'defined' sites being visited subsequently by reverting back to standard settings in between in order to ensure consistent states config.h | 158 +++++++++++++++++++++++++-------------------- keymap.h | 6 +- main.c | 196 ++++++++++++++++++++++++++++++++++++++++--------------- utilities.c | 29 +++++++-- vimprobable.h | 57 +++++++++++++++-- vimprobablerc.5 | 18 +++++ 6 files changed, 329 insertions(+), 135 deletions(-) -- 1.7.2.5 |
From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:35
|
--- config.h | 158 ++++++++++++++++++++++++++++++++------------------------- keymap.h | 6 +- main.c | 127 +++++++++++++++++++++++++++------------------ utilities.c | 4 +- vimprobable.h | 52 +++++++++++++++++-- 5 files changed, 216 insertions(+), 131 deletions(-) diff --git a/config.h b/config.h index ce79178..1623fa1 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,6 @@ /* (c) 2009 by Leon Winter - (c) 2009-2011 by Hannes Schueller + (c) 2009-2012 by Hannes Schueller (c) 2009-2010 by Matto Fransen (c) 2010-2011 by Hans-Peter Deifel (c) 2010-2011 by Thomas Adam @@ -13,20 +13,54 @@ #define INTERNAL_VERSION "Vimprobable2/"VERSION /* general settings */ -char startpage[MAX_SETTING_SIZE] = "http://www.vimprobable.org/"; -char useragent[MAX_SETTING_SIZE] = "Vimprobable2/" VERSION; -char acceptlanguage[MAX_SETTING_SIZE] = ""; -static const gboolean enablePlugins = TRUE; /* TRUE keeps plugins enabled */ -static const gboolean enableJava = TRUE; /* FALSE disables Java applets */ -static const gboolean enablePagecache = FALSE; /* TRUE turns on the page cache. */ -static gboolean escape_input_on_load = TRUE; /* TRUE will disable automatic focusing of input fields via Javascript*/ - -/* appearance */ -char statusbgcolor[MAX_SETTING_SIZE] = "#000000"; /* background color for status bar */ -char statuscolor[MAX_SETTING_SIZE] = "#ffffff"; /* color for status bar */ -char sslbgcolor[MAX_SETTING_SIZE] = "#b0ff00"; /* background color for status bar with SSL url */ -char sslinvalidbgcolor[MAX_SETTING_SIZE]= "#ff0000"; /* background color for status bar with unverified SSL url */ -char sslcolor[MAX_SETTING_SIZE] = "#000000"; /* color for status bar with SSL url */ +VSettings cursettings = { + .startpage = "http://www.vimprobable.org/", + .useragent = "Vimprobable2/" VERSION, + .acceptLanguage = "", + .enableScripts = "true", /* TRUE keeps JavaScript enabled */ + .enablePlugins = "true", /* TRUE keeps plugins enabled */ + .enableJava = "true", /* FALSE disables Java applets */ + .enablePagecache = "false", /* TRUE turns on the page cache. */ + .escapeInputOnLoad = "true", /* TRUE will disable automatic focusing of input fields via Javascript */ + .enableImages = "true", + .shrinkImages = "true", + .backgrounds = "true", + .defaultEncoding = "iso-8859-1", + /* website fonts */ + .defaultFont = "sans-serif", + .cursiveFont = "serif", + .fantasyFont = "serif", + .monoFont = "monospace", + .sansFont = "sans-serif", + .serifFont = "serif", + .fontSize = "12", + .monoFontSize = "10", + .minimumFontSize = "5", + /* site customisation */ + .caret = "false", + .webInspector = "false", + .stylesheet = "%svimprobable/style.css", /* %s will be replaced with config_base */ + /* browser appearance */ + .statusBgColor = "#000000", /* background color for status bar */ + .statusColor = "#ffffff", /* color for status bar */ + .SSLBgColor = "#b0ff00", /* background color for status bar with SSL url */ + .SSLInvalidBgColor = "#ff0000", /* background color for status bar with unverified SSL url */ + .SSLColor = "#000000", /* color for status bar with SSL url */ + .scrollbars = "false", + .statusBar = "true", + .inputBox = "true", + /* browser behaviour */ + .defaultSearch = "i", /* shortcut of the default search engine */ + + .useProxy = "true", /* TRUE if you're going to use a proxy (whose address + is specified in http_proxy environment variable), false otherwise */ + .completionCase = "true", + .escapeInput = "true", + /* SSL verification */ + .strictSSL = "true", /* FALSE will accept any SSL certificate at face value */ + .caBundle = "/etc/ssl/certs/ca-certificates.crt" + +}; /* normal, warning, error */ static const char *urlboxfont[] = { "monospace normal 8", "monospace normal 8", "monospace bold 8"}; @@ -76,28 +110,13 @@ static URIHandler uri_handlers[] = { /* downloads directory */ #define DOWNLOADS_PATH "%s", getenv("HOME") -/* font size */ -#define DEFAULT_FONT_SIZE 12 - -/* user styles */ -#define USER_STYLESHEET "%s/vimprobable/style.css", config_base - -/* ssl */ -static gboolean strict_ssl = TRUE; /* FALSE will accept any SSL certificate at face value */ -static char ca_bundle[MAX_SETTING_SIZE] = "/etc/ssl/certs/ca-certificates.crt"; - -/* proxy */ -static const gboolean use_proxy = TRUE; /* TRUE if you're going to use a proxy (whose address - is specified in http_proxy environment variable), false otherwise */ /* scrolling */ static unsigned int scrollstep = 40; /* cursor difference in pixel */ static unsigned int pagingkeep = 40; /* pixels kept when paging */ -#define DISABLE_SCROLLBAR /* searching */ #define ENABLE_MATCH_HIGHLITING static const int searchoptions = CaseInsensitive | Wrapping; -gboolean complete_case_sensitive = TRUE; /* search engines */ static Searchengine searchengines[] = { @@ -108,8 +127,6 @@ static Searchengine searchengines[] = { { "dd", "https://duckduckgo.com/html/?q=%s&t=Vimprobable" }, }; -static char defaultsearch[MAX_SETTING_SIZE] = "i"; - /* command mapping */ Command commands[COMMANDSIZE] = { /* command, function, argument */ @@ -169,43 +186,44 @@ static Mouse mouse[] = { /* settings (arguments of :set command) */ static Setting browsersettings[] = { /* public name, internal variable webkit setting integer value? boolean value? colour value? reload page? */ - { "useragent", useragent, "user-agent", FALSE, FALSE, FALSE, FALSE }, - { "scripts", NULL, "enable-scripts", FALSE, TRUE, FALSE, FALSE }, - { "plugins", NULL, "enable-plugins", FALSE, TRUE, FALSE, FALSE }, - { "pagecache", NULL, "enable-page-cache", FALSE, TRUE, FALSE, FALSE }, - { "java", NULL, "enable-java-applet", FALSE, TRUE, FALSE, FALSE }, - { "images", NULL, "auto-load-images", FALSE, TRUE, FALSE, FALSE }, - { "shrinkimages", NULL, "auto-shrink-images", FALSE, TRUE, FALSE, FALSE }, - { "cursivefont", NULL, "cursive-font-family", FALSE, FALSE, FALSE, FALSE }, - { "defaultencoding", NULL, "default-encoding", FALSE, FALSE, FALSE, FALSE }, - { "defaultfont", NULL, "default-font-family", FALSE, FALSE, FALSE, FALSE }, - { "fontsize", NULL, "default-font-size", TRUE, FALSE, FALSE, FALSE }, - { "monofontsize", NULL, "default-monospace-font-size", TRUE, FALSE, FALSE, FALSE }, - { "caret", NULL, "enable-caret-browsing", FALSE, TRUE, FALSE, FALSE }, - { "fantasyfont", NULL, "fantasy-font-family", FALSE, FALSE, FALSE, FALSE }, - { "minimumfontsize", NULL, "minimum-font-size", TRUE, FALSE, FALSE, FALSE }, - { "monofont", NULL, "monospace-font-family", FALSE, FALSE, FALSE, FALSE }, - { "backgrounds", NULL, "print-backgrounds", FALSE, TRUE, FALSE, FALSE }, - { "sansfont", NULL, "sans-serif-font-family", FALSE, FALSE, FALSE, FALSE }, - { "seriffont", NULL, "serif-font-family", FALSE, FALSE, FALSE, FALSE }, - { "stylesheet", NULL, "user-stylesheet-uri", FALSE, FALSE, FALSE, FALSE }, - { "resizetextareas", NULL, "resizable-text-areas", FALSE, TRUE, FALSE, FALSE }, - { "webinspector", NULL, "enable-developer-extras", FALSE, TRUE, FALSE, FALSE }, - - { "homepage", startpage, "", FALSE, FALSE, FALSE, FALSE }, - { "statusbgcolor", statusbgcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "statuscolor", statuscolor, "", FALSE, FALSE, TRUE, TRUE }, - { "sslbgcolor", sslbgcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "sslcolor", sslcolor, "", FALSE, FALSE, TRUE, TRUE }, - { "acceptlanguage", acceptlanguage, "", FALSE, FALSE, FALSE, FALSE }, - { "defaultsearch", defaultsearch, "", FALSE, FALSE, FALSE, FALSE }, + { "useragent", cursettings.useragent, "user-agent", FALSE, FALSE, FALSE, FALSE }, + { "scripts", cursettings.enableScripts, "enable-scripts", FALSE, TRUE, FALSE, FALSE }, + { "plugins", cursettings.enablePlugins, "enable-plugins", FALSE, TRUE, FALSE, FALSE }, + { "pagecache", cursettings.enablePagecache, "enable-page-cache", FALSE, TRUE, FALSE, FALSE }, + { "java", cursettings.enableJava, "enable-java-applet", FALSE, TRUE, FALSE, FALSE }, + { "images", cursettings.enableImages, "auto-load-images", FALSE, TRUE, FALSE, FALSE }, + { "shrinkimages", cursettings.shrinkImages, "auto-shrink-images", FALSE, TRUE, FALSE, FALSE }, + { "defaultencoding", cursettings.defaultEncoding, "default-encoding", FALSE, FALSE, FALSE, FALSE }, + { "defaultfont", cursettings.defaultFont, "default-font-family", FALSE, FALSE, FALSE, FALSE }, + { "cursivefont", cursettings.cursiveFont, "cursive-font-family", FALSE, FALSE, FALSE, FALSE }, + { "fantasyfont", cursettings.fantasyFont, "fantasy-font-family", FALSE, FALSE, FALSE, FALSE }, + { "monofont", cursettings.monoFont, "monospace-font-family", FALSE, FALSE, FALSE, FALSE }, + { "sansfont", cursettings.sansFont, "sans-serif-font-family", FALSE, FALSE, FALSE, FALSE }, + { "seriffont", cursettings.serifFont, "serif-font-family", FALSE, FALSE, FALSE, FALSE }, + { "fontsize", cursettings.fontSize, "default-font-size", TRUE, FALSE, FALSE, FALSE }, + { "monofontsize", cursettings.monoFontSize, "default-monospace-font-size", TRUE, FALSE, FALSE, FALSE }, + { "minimumfontsize", cursettings.minimumFontSize, "minimum-font-size", TRUE, FALSE, FALSE, FALSE }, + { "caret", cursettings.caret, "enable-caret-browsing", FALSE, TRUE, FALSE, FALSE }, + { "backgrounds", cursettings.backgrounds, "print-backgrounds", FALSE, TRUE, FALSE, FALSE }, + { "stylesheet", cursettings.stylesheet, "user-stylesheet-uri", FALSE, FALSE, FALSE, FALSE }, + { "resizetextareas", cursettings.resizeTextAreas, "resizable-text-areas", FALSE, TRUE, FALSE, FALSE }, + { "webinspector", cursettings.webInspector, "enable-developer-extras", FALSE, TRUE, FALSE, FALSE }, + + { "homepage", cursettings.startpage, "", FALSE, FALSE, FALSE, FALSE }, + { "statusbgcolor", cursettings.statusBgColor, "", FALSE, FALSE, TRUE, TRUE }, + { "statuscolor", cursettings.statusColor, "", FALSE, FALSE, TRUE, TRUE }, + { "sslbgcolor", cursettings.SSLBgColor, "", FALSE, FALSE, TRUE, TRUE }, + { "sslinvalidbgcolor",cursettings.SSLInvalidBgColor, "", FALSE, FALSE, TRUE, TRUE }, + { "sslcolor", cursettings.SSLColor, "", FALSE, FALSE, TRUE, TRUE }, + { "acceptlanguage", cursettings.acceptLanguage, "", FALSE, FALSE, FALSE, FALSE }, + { "defaultsearch", cursettings.defaultSearch, "", FALSE, FALSE, FALSE, FALSE }, { "qmark", NULL, "", FALSE, FALSE, FALSE, FALSE }, - { "proxy", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "scrollbars", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "statusbar", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "inputbox", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "completioncase", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "escapeinput", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "strictssl", NULL, "", FALSE, TRUE, FALSE, FALSE }, - { "cabundle", ca_bundle, "", FALSE, FALSE, FALSE, FALSE }, + { "proxy", cursettings.useProxy, "", FALSE, TRUE, FALSE, FALSE }, + { "scrollbars", cursettings.scrollbars, "", FALSE, TRUE, FALSE, FALSE }, + { "statusbar", cursettings.statusBar, "", FALSE, TRUE, FALSE, FALSE }, + { "inputbox", cursettings.inputBox, "", FALSE, TRUE, FALSE, FALSE }, + { "completioncase", cursettings.completionCase, "", FALSE, TRUE, FALSE, FALSE }, + { "escapeinput", cursettings.escapeInput, "", FALSE, TRUE, FALSE, FALSE }, + { "strictssl", cursettings.strictSSL, "", FALSE, TRUE, FALSE, FALSE }, + { "cabundle", cursettings.caBundle, "", FALSE, FALSE, FALSE, FALSE }, }; diff --git a/keymap.h b/keymap.h index 7ba5d0b..3038e1d 100644 --- a/keymap.h +++ b/keymap.h @@ -1,6 +1,6 @@ /* (c) 2009 by Leon Winter - (c) 2009-2011 by Hannes Schueller + (c) 2009-2012 by Hannes Schueller (c) 2009-2010 by Matto Fransen (c) 2010-2011 by Hans-Peter Deifel (c) 2010-2011 by Thomas Adam @@ -80,8 +80,8 @@ Key keys[] = { { 0, GDK_g, GDK_u, descend, {NthSubdir} }, { 0, GDK_g, GDK_U, descend, {Rootdir} }, - { 0, GDK_g, GDK_h, open_arg, {TargetCurrent, startpage} }, - { 0, GDK_g, GDK_H, open_arg, {TargetNew, startpage} }, + { 0, GDK_g, GDK_h, open_arg, {TargetCurrent, cursettings.startpage} }, + { 0, GDK_g, GDK_H, open_arg, {TargetNew, cursettings.startpage} }, { 0, 0, GDK_p, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK} }, { 0, 0, GDK_P, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, diff --git a/main.c b/main.c index 029ac7c..aecd7a8 100644 --- a/main.c +++ b/main.c @@ -221,7 +221,7 @@ webview_load_finished_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpointer gboolean scripts; g_object_get(settings, "enable-scripts", &scripts, NULL); - if (escape_input_on_load && scripts && !manual_focus && !gtk_widget_is_focus(inputbox)) { + if (cursettings.escapeInputOnLoad && scripts && !manual_focus && !gtk_widget_is_focus(inputbox)) { Arg a = { .i = Silent, .s = g_strdup("hints.clearFocus();") }; script(&a); g_free(a.s); @@ -1228,7 +1228,7 @@ open_arg(const Arg *arg) { strcpy(new, "file://"); memcpy(&new[sizeof("file://") - 1], s, len + 1); } else if (p || !strchr(s, '.')) { /* whitespaces or no dot? */ - search_uri = find_uri_for_searchengine(defaultsearch); + search_uri = find_uri_for_searchengine(cursettings.defaultSearch); if (search_uri != NULL) { search_term = soup_uri_encode(s, "&"); new = g_strdup_printf(search_uri, search_term); @@ -1926,21 +1926,17 @@ process_set_line(char *line) { if (strlen(browsersettings[i].webkit) > 0) { /* activate appropriate webkit setting */ if (browsersettings[i].boolval) { - g_object_set((GObject*)settings, browsersettings[i].webkit, boolval, NULL); + g_object_set(G_OBJECT(settings), browsersettings[i].webkit, boolval, NULL); } else if (browsersettings[i].intval) { - g_object_set((GObject*)settings, browsersettings[i].webkit, atoi(my_pair.value), NULL); + g_object_set(G_OBJECT(settings), browsersettings[i].webkit, atoi(my_pair.value), NULL); } else { - g_object_set((GObject*)settings, browsersettings[i].webkit, my_pair.value, NULL); + g_object_set(G_OBJECT(settings), browsersettings[i].webkit, my_pair.value, NULL); } webkit_web_view_set_settings(webview, settings); } - if (strlen(my_pair.what) == 14) { - if (strncmp("acceptlanguage", my_pair.what, 14) == 0) { - g_object_set(G_OBJECT(session), "accept-language", acceptlanguage, NULL); - } else if (strncmp("completioncase", my_pair.what, 14) == 0) { - complete_case_sensitive = boolval; - } + if (strlen(my_pair.what) == 14 && strncmp("acceptlanguage", my_pair.what, 14) == 0) { + g_object_set(G_OBJECT(session), "accept-language", cursettings.acceptLanguage, NULL); } else if (strlen(my_pair.what) == 5 && strncmp("proxy", my_pair.what, 5) == 0) { toggle_proxy(boolval); } else if (strlen(my_pair.what) == 10 && strncmp("scrollbars", my_pair.what, 10) == 0) { @@ -1949,22 +1945,14 @@ process_set_line(char *line) { gtk_widget_set_visible(GTK_WIDGET(statusbar), boolval); } else if (strlen(my_pair.what) == 8 && strncmp("inputbox", my_pair.what, 8) == 0) { gtk_widget_set_visible(inputbox, boolval); - } else if (strlen(my_pair.what) == 11 && strncmp("escapeinput", my_pair.what, 11) == 0) { - escape_input_on_load = boolval; } /* SSL certificate checking */ if (strlen(my_pair.what) == 9 && strncmp("strictssl", my_pair.what, 9) == 0) { - if (boolval) { - strict_ssl = TRUE; - g_object_set(G_OBJECT(session), "ssl-strict", TRUE, NULL); - } else { - strict_ssl = FALSE; - g_object_set(G_OBJECT(session), "ssl-strict", FALSE, NULL); - } + g_object_set(G_OBJECT(session), "ssl-strict", boolval, NULL); } if (strlen(my_pair.what) == 8 && strncmp("cabundle", my_pair.what, 8) == 0) { - g_object_set(G_OBJECT(session), SOUP_SESSION_SSL_CA_FILE, ca_bundle, NULL); + g_object_set(G_OBJECT(session), SOUP_SESSION_SSL_CA_FILE, cursettings.caBundle, NULL); } /* reload page? */ @@ -2170,13 +2158,13 @@ update_url(const char *uri) { msg = webkit_network_request_get_message(request); ssl_ok = soup_message_get_flags(msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED; if (ssl_ok) - sslactivecolor = sslbgcolor; + sslactivecolor = cursettings.SSLBgColor; else - sslactivecolor = sslinvalidbgcolor; + sslactivecolor = cursettings.SSLInvalidBgColor; } - gdk_color_parse(ssl ? sslactivecolor : statusbgcolor, &color); + gdk_color_parse(ssl ? sslactivecolor : cursettings.statusBgColor, &color); gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &color); - gdk_color_parse(ssl ? sslcolor : statuscolor, &color); + gdk_color_parse(ssl ? cursettings.SSLColor : cursettings.statusColor, &color); gtk_widget_modify_fg(GTK_WIDGET(status_url), GTK_STATE_NORMAL, &color); gtk_widget_modify_fg(GTK_WIDGET(status_state), GTK_STATE_NORMAL, &color); } @@ -2292,20 +2280,21 @@ setup_gui() { clipboards[0] = gtk_clipboard_get(GDK_SELECTION_PRIMARY); clipboards[1] = gtk_clipboard_get(GDK_NONE); setup_settings(); - gdk_color_parse(statusbgcolor, &bg); + gdk_color_parse(cursettings.statusBgColor, &bg); gtk_widget_modify_bg(eventbox, GTK_STATE_NORMAL, &bg); gtk_widget_set_name(GTK_WIDGET(window), "Vimprobable2"); gtk_window_set_geometry_hints(window, NULL, &hints, GDK_HINT_MIN_SIZE); keymap = gdk_keymap_get_default(); -#ifdef DISABLE_SCROLLBAR - viewport = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(viewport), GTK_POLICY_NEVER, GTK_POLICY_NEVER); -#else - /* Ensure we still see scrollbars. */ - GtkWidget *viewport = gtk_scrolled_window_new(adjust_h, adjust_v); -#endif + GtkWidget *viewport; + if (strncmp(cursettings.scrollbars, "true", 4) == 0) { + /* Ensure we still see scrollbars. */ + viewport = gtk_scrolled_window_new(adjust_h, adjust_v); + } else { + viewport = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(viewport), GTK_POLICY_NEVER, GTK_POLICY_NEVER); + } setup_signals(); gtk_container_add(GTK_CONTAINER(viewport), GTK_WIDGET(webview)); @@ -2338,27 +2327,63 @@ setup_gui() { void setup_settings() { WebKitWebSettings *settings = (WebKitWebSettings*)webkit_web_settings_new(); - char *filename, *file_url; + char *file_url, temp[MAX_SETTING_SIZE]; + gchar *line; + int i, len; session = webkit_get_default_session(); - g_object_set(G_OBJECT(session), "ssl-ca-file", ca_bundle, NULL); - g_object_set(G_OBJECT(session), "ssl-strict", strict_ssl, NULL); - g_object_set(G_OBJECT(settings), "default-font-size", DEFAULT_FONT_SIZE, NULL); - g_object_set(G_OBJECT(settings), "enable-scripts", enablePlugins, NULL); - g_object_set(G_OBJECT(settings), "enable-plugins", enablePlugins, NULL); - g_object_set(G_OBJECT(settings), "enable-java-applet", enableJava, NULL); - g_object_set(G_OBJECT(settings), "enable-page-cache", enablePagecache, NULL); - filename = g_strdup_printf(USER_STYLESHEET); - file_url = g_strdup_printf("file://%s", filename); - g_object_set(G_OBJECT(settings), "user-stylesheet-uri", file_url, NULL); - g_free(file_url); - g_free(filename); - g_object_set(G_OBJECT(settings), "user-agent", useragent, NULL); g_object_get(G_OBJECT(settings), "zoom-step", &zoomstep, NULL); webkit_web_view_set_settings(webview, settings); - + line = g_strconcat("cabundle=", cursettings.caBundle, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("strictssl=", cursettings.strictSSL, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("fontsize=", cursettings.fontSize, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("scripts=", cursettings.enableScripts, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("plugins=", cursettings.enablePlugins, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("java=", cursettings.enableJava, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("pagecache=", cursettings.enablePagecache, NULL); + process_set_line(line); + g_free(line); + line = g_strconcat("useragent=", cursettings.useragent, NULL); + process_set_line(line); + g_free(line); + /* user stylesheet */ + memset(temp, 0, MAX_SETTING_SIZE); + file_url = cursettings.stylesheet; + len = strlen(file_url); + for (i = 0; i < len; i++) { + if (strncmp(file_url, "%s", 2) == 0) { + strncat(temp, config_base, strlen(config_base)); + file_url += 2; + } else { + strncat(temp, file_url, 1); + file_url++; + } + } + if (temp[0] == '/') { + file_url = g_strdup_printf("file://%s", temp); + } else { + file_url = g_strdup_printf("%s", temp); + } + line = g_strconcat("stylesheet=", file_url, NULL); + process_set_line(line); + g_free(line); + g_free(file_url); /* proxy */ - toggle_proxy(use_proxy); + line = g_strconcat("proxy=", cursettings.useProxy, NULL); + process_set_line(line); + g_free(line); } void @@ -2369,7 +2394,7 @@ setup_signals() { g_signal_connect_after(G_OBJECT(session), "request-started", G_CALLBACK(new_generic_request), NULL); #endif /* Accept-language header */ - g_object_set(G_OBJECT(session), "accept-language", acceptlanguage, NULL); + g_object_set(G_OBJECT(session), "accept-language", cursettings.acceptLanguage, NULL); /* window */ g_object_connect(G_OBJECT(window), "signal::destroy", G_CALLBACK(window_destroyed_cb), NULL, @@ -2622,7 +2647,7 @@ main(int argc, char *argv[]) { if (argc > 1) { strncpy(url, argv[argc - 1], 255); } else { - strncpy(url, startpage, 255); + strncpy(url, cursettings.startpage, 255); } a.i = TargetCurrent; diff --git a/utilities.c b/utilities.c index 9bb4f49..78f4586 100644 --- a/utilities.c +++ b/utilities.c @@ -18,8 +18,8 @@ extern Command commands[COMMANDSIZE]; extern KeyList *keylistroot; extern Key keys[]; extern char *error_msg; -extern gboolean complete_case_sensitive; extern char *config_base; +extern VSettings cursettings; static GList *dynamic_searchengines = NULL, *dynamic_uri_handlers = NULL; void add_modkeys(char key); @@ -546,7 +546,7 @@ complete_list(const char *searchfor, const int mode, Listelement *elementlist) candidatepointer = candidatelist; while (candidatepointer != NULL) { strncpy(s, candidatepointer->element, sizeof(s)); - if (!complete_case_sensitive) { + if (!cursettings.completionCase) { g_strdown(s); } if (!strlen(searchfor) || strstr(s, searchfor) != NULL) { diff --git a/vimprobable.h b/vimprobable.h index 5a6c2df..16d4ee9 100644 --- a/vimprobable.h +++ b/vimprobable.h @@ -10,6 +10,11 @@ /* macros */ #define LENGTH(x) (sizeof(x)/sizeof(x[0])) +/* maximum size of internal string variable handled by :set + * if you set this to anything lower than 8, colour values + * will stop working */ +#define MAX_SETTING_SIZE 1024 + /* enums */ enum { ModeNormal, ModePassThrough, ModeSendKey, ModeInsert, ModeHints }; /* modes */ enum { TargetCurrent, TargetNew }; /* target */ @@ -97,6 +102,48 @@ typedef struct { } Arg; typedef struct { + char startpage[MAX_SETTING_SIZE]; + char useragent[MAX_SETTING_SIZE]; + char acceptLanguage[MAX_SETTING_SIZE]; + char enableScripts[MAX_SETTING_SIZE]; + char enablePlugins[MAX_SETTING_SIZE]; + char enableJava[MAX_SETTING_SIZE]; + char enablePagecache[MAX_SETTING_SIZE]; + char escapeInputOnLoad[MAX_SETTING_SIZE]; + char enableImages[MAX_SETTING_SIZE]; + char shrinkImages[MAX_SETTING_SIZE]; + char backgrounds[MAX_SETTING_SIZE]; + char webInspector[MAX_SETTING_SIZE]; + char defaultEncoding[MAX_SETTING_SIZE]; + char defaultFont[MAX_SETTING_SIZE]; + char cursiveFont[MAX_SETTING_SIZE]; + char fantasyFont[MAX_SETTING_SIZE]; + char monoFont[MAX_SETTING_SIZE]; + char sansFont[MAX_SETTING_SIZE]; + char serifFont[MAX_SETTING_SIZE]; + char fontSize[MAX_SETTING_SIZE]; + char monoFontSize[MAX_SETTING_SIZE]; + char minimumFontSize[MAX_SETTING_SIZE]; + char caret[MAX_SETTING_SIZE]; + char stylesheet[MAX_SETTING_SIZE]; + char resizeTextAreas[MAX_SETTING_SIZE]; + char statusBgColor[MAX_SETTING_SIZE]; + char statusColor[MAX_SETTING_SIZE]; + char SSLBgColor[MAX_SETTING_SIZE]; + char SSLInvalidBgColor[MAX_SETTING_SIZE]; + char SSLColor[MAX_SETTING_SIZE]; + char defaultSearch[MAX_SETTING_SIZE]; + char useProxy[MAX_SETTING_SIZE]; + char scrollbars[MAX_SETTING_SIZE]; + char statusBar[MAX_SETTING_SIZE]; + char inputBox[MAX_SETTING_SIZE]; + char completionCase[MAX_SETTING_SIZE]; + char escapeInput[MAX_SETTING_SIZE]; + char strictSSL[MAX_SETTING_SIZE]; + char caBundle[MAX_SETTING_SIZE]; +} VSettings; + +typedef struct { guint mask; guint modkey; guint key; @@ -184,10 +231,5 @@ enum ConfigFileError { /* Command size */ #define COMMANDSIZE 1024 -/* maximum size of internal string variable handled by :set - * if you set this to anything lower than 8, colour values - * will stop working */ -#define MAX_SETTING_SIZE 1024 - /* completion list size */ #define MAX_LIST_SIZE 40 -- 1.7.2.5 |
From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:40
|
--- utilities.c | 24 ++++++++++++++++++++++-- vimprobable.h | 5 +++++ vimprobablerc.5 | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/utilities.c b/utilities.c index 78f4586..856eb36 100644 --- a/utilities.c +++ b/utilities.c @@ -20,7 +20,7 @@ extern Key keys[]; extern char *error_msg; extern char *config_base; extern VSettings cursettings; -static GList *dynamic_searchengines = NULL, *dynamic_uri_handlers = NULL; +static GList *dynamic_searchengines = NULL, *dynamic_uri_handlers = NULL, *site_settings = NULL; void add_modkeys(char key); @@ -721,6 +721,7 @@ read_rcfile(const char *config) gboolean found_malformed_lines = FALSE; Searchengine *new; URIHandler *newhandler; + SSettings *newsettings; if (access(config, F_OK) != 0) return FILE_NOT_FOUND; @@ -738,7 +739,26 @@ read_rcfile(const char *config) continue; t = strlen(s); s[t - 1] = '\0'; - if (strncmp(s, "searchengine", 12) == 0) { + if (strncmp(s, "site ", 5) == 0) { + buffer = (s + 4); + while (buffer[0] == ' ') + buffer++; + /* split line at whitespace */ + index = split_string_at_whitespace(buffer); + if (index < 0 || buffer[0] == '\0' || buffer[index] == '\0') { + fprintf(stderr, "site settings: syntax error on line %d\n", linum); + found_malformed_lines = TRUE; + continue; + } + newsettings = malloc(sizeof(SSettings)); + if (newsettings == NULL) { + fprintf(stderr, "Memory exhausted while loading site settings.\n"); + exit(EXIT_FAILURE); + } + newsettings->url = g_strdup(buffer); + newsettings->settings = g_strdup(buffer+index); + site_settings = g_list_prepend(site_settings, newsettings); + } else if (strncmp(s, "searchengine", 12) == 0) { buffer = (s + 12); while (buffer[0] == ' ') buffer++; diff --git a/vimprobable.h b/vimprobable.h index 16d4ee9..f24bc56 100644 --- a/vimprobable.h +++ b/vimprobable.h @@ -144,6 +144,11 @@ typedef struct { } VSettings; typedef struct { + char *url; + char *settings; +} SSettings; + +typedef struct { guint mask; guint modkey; guint key; diff --git a/vimprobablerc.5 b/vimprobablerc.5 index f69dda9..cf1773c 100644 --- a/vimprobablerc.5 +++ b/vimprobablerc.5 @@ -263,6 +263,24 @@ handler <URI schema> <handler command with exactly one %s> where the %s serves as a placeholder for the rest of the URI. +.SH PER-SITE SETTINGS + +You can define overrides for many internal settings on a website basis. This +includes anything you can define interactively using the :set command. This +is useful to define exceptions to the default settings using a whitelist or +blacklist approach. + +The following syntax must be used in the configuration file +(without the angle brackets): + +.RS 4 +site <URL schema> <list of settings separated by pipe symbols (|)> +.RE + +where any site which begins with the defined URL schema will use the defined +special settings. Visiting another URL again in the same browser window will +automatically revert the browser to the default settings. + .SH BUGS There has not been any significant bug-hunting yet. .SH AUTHORS -- 1.7.2.5 |
From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:44
|
--- main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- utilities.c | 7 ++--- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index aecd7a8..63b9245 100644 --- a/main.c +++ b/main.c @@ -101,6 +101,7 @@ gboolean process_keypress(GdkEventKey *event); void fill_suggline(char * suggline, const char * command, const char *fill_with); GtkWidget * fill_eventbox(const char * completion_line); static void mop_up(void); +void apply_settings(char *uri); #include "main.h" @@ -143,7 +144,8 @@ char *error_msg = NULL; char *config_base = NULL; static gboolean manual_focus = FALSE; -GList *activeDownloads; +GList *activeDownloads, *siteSettings = NULL; +char backupsettings[MAX_SETTING_SIZE] = ""; #include "config.h" #include "keymap.h" @@ -1240,6 +1242,7 @@ open_arg(const Arg *arg) { memcpy(&new[sizeof("http://") - 1], s, len + 1); } } + apply_settings(new); webkit_web_view_load_uri(webview, new); g_free(new); } else @@ -2557,6 +2560,61 @@ load_all_cookies(void) #endif void +apply_settings(char *uri) { + SSettings *s; + GList *l; + char temp[MAX_SETTING_SIZE], *temp2, temp3[MAX_SETTING_SIZE]; + guint i, j, len, len2, len3; + + /* check for site-specific settings */ + if (siteSettings != NULL) { + len = g_list_length(siteSettings); + for (i = 0; i < len; i++) { + l = g_list_nth(siteSettings, i); + s = (SSettings *)l->data; + if (strlen(uri) >= strlen(s->url) && strncmp(s->url, uri, strlen(s->url)) == 0) { + /* match found */ + memset(temp, 0, MAX_SETTING_SIZE); + strncpy(temp, s->settings, MAX_SETTING_SIZE); + temp2 = strtok(temp, "|"); + while (temp2 != NULL) { + /* remember current standard settings */ + memset(temp3, 0, MAX_SETTING_SIZE); + len2 = strcspn(temp2, "="); + len3 = LENGTH(browsersettings); + for (j = 0; j < len3; j++) { + if (strlen(browsersettings[j].name) == len2 && strncmp(browsersettings[j].name, temp2, len2) == 0) { + strncat(backupsettings, "|", 1); + strncat(backupsettings, temp2, len2 + 1); + strncat(backupsettings, browsersettings[j].var, strlen(browsersettings[j].var)); + } + } + /* apply the setting */ + process_set_line(temp2); + temp2 = strtok(NULL, "|"); + } + return; + } + } + if (strlen(backupsettings) > 0) { + /* revert to standard settings + * the string has to be applied from right to left + * this ensures that if various values have been set for the same key in the meantime, + * we will still get back to the most basic state + */ + temp2 = strrchr(backupsettings, '|'); + while (temp2 != NULL) { + process_set_line(temp2 + 1); + memset(temp2, 0, strlen(temp2)); + temp2 = strrchr(backupsettings, '|'); + } + /* erase remembered settings */ + memset(backupsettings, 0, MAX_SETTING_SIZE); + } + } +} + +void mop_up(void) { /* Free up any nasty globals before exiting. */ #ifdef ENABLE_COOKIE_SUPPORT diff --git a/utilities.c b/utilities.c index 856eb36..4a7e1df 100644 --- a/utilities.c +++ b/utilities.c @@ -12,7 +12,7 @@ #include "main.h" #include "utilities.h" -extern GList *commandhistory; +extern GList *commandhistory, *siteSettings; extern int commandpointer; extern Command commands[COMMANDSIZE]; extern KeyList *keylistroot; @@ -20,7 +20,7 @@ extern Key keys[]; extern char *error_msg; extern char *config_base; extern VSettings cursettings; -static GList *dynamic_searchengines = NULL, *dynamic_uri_handlers = NULL, *site_settings = NULL; +static GList *dynamic_searchengines = NULL, *dynamic_uri_handlers = NULL; void add_modkeys(char key); @@ -757,7 +757,7 @@ read_rcfile(const char *config) } newsettings->url = g_strdup(buffer); newsettings->settings = g_strdup(buffer+index); - site_settings = g_list_prepend(site_settings, newsettings); + siteSettings = g_list_prepend(siteSettings, newsettings); } else if (strncmp(s, "searchengine", 12) == 0) { buffer = (s + 12); while (buffer[0] == ' ') @@ -862,4 +862,3 @@ open_handler(char *uri) { } return FALSE; } - -- 1.7.2.5 |
From: Hannes S. <ha...@yl...> - 2012-04-12 21:29:50
|
--- main.c | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 63b9245..29e01c6 100644 --- a/main.c +++ b/main.c @@ -102,6 +102,7 @@ void fill_suggline(char * suggline, const char * command, const char *fill_with) GtkWidget * fill_eventbox(const char * completion_line); static void mop_up(void); void apply_settings(char *uri); +void revert_settings(void); #include "main.h" @@ -2566,8 +2567,11 @@ apply_settings(char *uri) { char temp[MAX_SETTING_SIZE], *temp2, temp3[MAX_SETTING_SIZE]; guint i, j, len, len2, len3; - /* check for site-specific settings */ if (siteSettings != NULL) { + /* to ensure consistency in case several defined sites are visited one after another, + * temporarily revert back to standard settings */ + revert_settings(); + /* check for site-specific settings */ len = g_list_length(siteSettings); for (i = 0; i < len; i++) { l = g_list_nth(siteSettings, i); @@ -2596,21 +2600,26 @@ apply_settings(char *uri) { return; } } - if (strlen(backupsettings) > 0) { - /* revert to standard settings - * the string has to be applied from right to left - * this ensures that if various values have been set for the same key in the meantime, - * we will still get back to the most basic state - */ + } +} + +void revert_settings(void) { + char *temp2; + + if (strlen(backupsettings) > 0) { + /* revert to standard settings + * the string has to be applied from right to left + * this ensures that if various values have been set for the same key in the meantime, + * we will still get back to the most basic state + */ + temp2 = strrchr(backupsettings, '|'); + while (temp2 != NULL) { + process_set_line(temp2 + 1); + memset(temp2, 0, strlen(temp2)); temp2 = strrchr(backupsettings, '|'); - while (temp2 != NULL) { - process_set_line(temp2 + 1); - memset(temp2, 0, strlen(temp2)); - temp2 = strrchr(backupsettings, '|'); - } - /* erase remembered settings */ - memset(backupsettings, 0, MAX_SETTING_SIZE); } + /* erase remembered settings */ + memset(backupsettings, 0, MAX_SETTING_SIZE); } } -- 1.7.2.5 |
From: Daniel C. <dan...@gm...> - 2012-04-15 16:13:25
Attachments:
signature.asc
|
Hi Hannes! At the moment the per site settings aren't applied if a site is requested via link click or hinting, it works only for urls entered to url box. I suppose we have to use a callback to set the settings when a page is opened by hinting or a javascript. In the function read_rcfile() a splitting for the site is done via index = split_string_at_whitespace(buffer); How can set values containing whitespace (for example useragent) per site if we split it by whitespace? Daniel |
From: Hannes S. <ha...@yl...> - 2012-04-15 16:19:54
Attachments:
signature.asc
|
Daniel Carl <dan...@gm...> wrote: > At the moment the per site settings aren't applied if a site is > requested via link click or hinting, it works only for urls entered > to url box. I suppose we have to use a callback to set the settings > when a page is opened by hinting or a javascript. Good catch - this needs to be adapted. Will need to consider what the b est way is (suggestions welcome). > In the function read_rcfile() a splitting for the site is done via > index = split_string_at_whitespace(buffer); > > How can set values containing whitespace (for example useragent) per > site if we split it by whitespace? This should not be a problem. The function only looks for the first occurence of whitespace, i.e. the separation between the URL and the settings. URLs can't contain whitespace, so there is no danger. The settings are separated with pipe symbols exactly due to this reason. So I don't see why setting a custom useragent (and other configuration options) should not work. Hannes |
From: Daniel C. <dan...@gm...> - 2012-04-15 17:28:30
Attachments:
signature.asc
|
Hi Hannes! On Sun, Apr 15, 2012 at 06:19:32PM +0200, Hannes Schüller wrote: > This should not be a problem. The function only looks for the first > occurence of whitespace, i.e. the separation between the URL and the > settings. URLs can't contain whitespace, so there is no danger. The > settings are separated with pipe symbols exactly due to this reason. So > I don't see why setting a custom useragent (and other configuration > options) should not work. You're right, I didn't took the time to get into the function. Daniel |
From: Daniel C. <dan...@gm...> - 2012-04-16 00:45:21
Attachments:
signature.asc
moved_apply_settings.patch
|
Hi! On Sun, Apr 15, 2012 at 06:19:32PM +0200, Hannes Schüller wrote: > Good catch - this needs to be adapted. Will need to consider what the b > est way is (suggestions welcome). Attached patch could be one way to handle the problem. Daniel |
From: Hannes S. <ha...@yl...> - 2012-04-16 06:21:12
|
Daniel Carl <dan...@gm...> wrote: > On Sun, Apr 15, 2012 at 06:19:32PM +0200, Hannes Sch__ller wrote: > > Good catch - this needs to be adapted. Will need to consider what > > the b est way is (suggestions welcome). > > Attached patch could be one way to handle the problem. This (using webview_load_committed) is an idea I had considered, too, but it does not work correctly. Try to apply a proxy setting and you will see what I mean. It would need to be triggered even earlier than this. Hannes |
From: Daniel C. <dan...@gm...> - 2012-04-16 12:40:46
Attachments:
signature.asc
|
Hi! On Mon, Apr 16, 2012 at 08:19:53AM +0200, Hannes Schüller wrote: > This (using webview_load_committed) is an idea I had considered, too, > but it does not work correctly. Try to apply a proxy setting and you > will see what I mean. It would need to be triggered even earlier than > this. We also have the problem that the site settings revert previously done changes every time a new page ist loaded. That means, I navigate to a page with special settings, change a value via :set ... and navigate to another page on this site or use reload and the explicit set value will be reverted. But this would be easy to avoid in the apply_settings() function. I'm not sure, but I didn't see any earlier event to use for the configuration changes. Daniel |
From: Daniel C. <dan...@gm...> - 2012-04-16 13:22:14
Attachments:
signature.asc
|
Hi! Another topic that's should be clear is, how manually set values (:set ...) are handled during browsing and where they are stored as default options or the sitespecific. In my opinion we should set the values that are explicitly set to site specific, if the current URL matches a configured site, else it should be handled like we know it. vimprobablerc: set fontsize=11 ... site http://foo.bar fontsize=14 When browsing on http://bar.baz we have fontsize 11, changing the value to 13 by :set fontsize=13 will set the value for all sites accept those that define another value (like http://foo.bar does). If http://foo.bar/... is opened, we should have fontsize 14. If the value is changed now to 9 this should take effect on all pages under http://foo.bar (should be saved in the struct used for the site). If another page, without special settings is opened the previously set fontsize of 13 should be used again. I think this behaviour would lead to least confusion compared to other behaviours. Daniel |
From: Hannes S. <ha...@yl...> - 2012-04-17 06:57:35
|
This is quite a complex subject, so let me first describe thec current behaviour of the patch. Shorthand definitions: - state S1: default settings (as defined at compile time plus rc file) - state S2: site-specific settings for site X as defined in rc file - setting T1: a custom setting manually set by the user at runtime which is not covered by the difference between S1 and S2 (i.e. the site specific settings don't change this) - setting T2: a custom setting manually set by the user at runtime which is covered by the difference between S1 and S2 (i.e. the site specific settings change this) Case A: - start with S1 - go to X -> get S2 - go to another site -> get S1 back Case B: - start with S1 - set T1 -> S1+T1 - go to X -> S2+T1 - go to another site -> S1+T1 Case C: - start with S1 - set T2 -> S1+T2 - go to X -> S2 (T2 overwritten) - go to another site -> S1+T2 (T2 restored) Case D: - start with S1 - go to X -> S2 - set T1 -> S2+T1 - go to another site -> S1+T1 (T1 survives) Case E: - start with S1 - go to X -> S2 - set T2 -> S2+T2 - go to another site -> S1 (T2 overridden with respective setting from S1) So if we're talking about user expectations, the only case I believe we could have a problem is E. Do you agree so far? Sidenote: If T2 is a boolean setting, there is no problem, because S1+T2 = S1. Implementation aside, I'm not sure how this should be ideall handled. The alternative policy would be to retain T2, i.e. end up with S1+T2, but that could be non-intuitive as well. So I don't see a clear advantage over the current behaviour (as described in E). Opinions welcome! Hannes |
From: Daniel C. <dan...@gm...> - 2012-04-17 07:51:44
Attachments:
signature.asc
|
Hi! Hannes Schüller <ha...@yl...> wrote: > Shorthand definitions: > - state S1: default settings (as defined at compile time plus rc file) > - state S2: site-specific settings for site X as defined in rc file > - setting T1: a custom setting manually set by the user at runtime > which is not covered by the difference between S1 and S2 (i.e. the > site specific settings don't change this) > - setting T2: a custom setting manually set by the user at runtime > which is covered by the difference between S1 and S2 (i.e. the > site specific settings change this) > > Case A: > - start with S1 > - go to X -> get S2 > - go to another site -> get S1 back > > Case B: > - start with S1 > - set T1 -> S1+T1 > - go to X -> S2+T1 > - go to another site -> S1+T1 > > Case C: > - start with S1 > - set T2 -> S1+T2 > - go to X -> S2 (T2 overwritten) > - go to another site -> S1+T2 (T2 restored) > > Case D: > - start with S1 > - go to X -> S2 > - set T1 -> S2+T1 > - go to another site -> S1+T1 (T1 survives) > > Case E: > - start with S1 > - go to X -> S2 > - set T2 -> S2+T2 > - go to another site -> S1 (T2 overridden with respective setting from > S1) > > So if we're talking about user expectations, the only case I believe we > could have a problem is E. Do you agree so far? Thank you for structuring the issue. For now it's only the case E we have to deal with, but there is at least a possible behaviour that requires also a rethinking about the other cases. I see two way to deal with the per-site-settings: Thoungh in paradigm of object orientation we have the possibility to use runtime settings as an third object in hirarchie 1. or as changes on setting objects 2. default settings default settings ^ ^ | | | | per-site-settings per-site-settings ^ | | runtime settings 1. Like in current state. That means (case E), runtime settings done by the user may be overwritten by respective settings from S1. But we should not apply the settings S2 multiple times when the user navigates only on pages of X. I think we should change the current behaviour case E1 into case E2. Case E1 (current behaviour): - start with S1 - go to X -> S2 - set T2 -> S2+T2 - go to another page on X -> S2 - go to another site -> S1 Case E2: - start with S1 - go to X -> S2 - set T2 -> S2+T2 - go to another page on X -> S2+T2 - go to another site -> S1 2. The setting scopes are treated as something like browser sessions. That means we have default settings, and per-site-settings that inherits from the default settings (overwrites respective settings). All runtime settings would be arranged into the current used setting. Case B': - start with S1 - set T1 -> S1+T1 - go to X -> S2+T1 - go to another site -> S1+T1 Case C': - start with S1 - set T2 -> S1+T2 - go to X -> S2 (T2 overwritten) - go to another site -> S1 Case D': - start with S1 - go to X -> S2 - set T1 -> S2+T1 - go to another site -> S1+T1 (T1 survives) Case E': - start with S1 - go to X -> S2 - set T2 -> S2+T2 - go to another site -> S1 - go to X -> S2+T2 (T2 was changed for the current window for site X) I can live with both ways, but 2. would be more intuitive for me to understand. Daniel |
From: Jason R. <jas...@gm...> - 2012-04-17 08:10:58
|
On 17/04/12 at 08:56am, Hannes Schüller wrote: > This is quite a complex subject, so let me first describe thec current > behaviour of the patch. > <snip /> > Opinions welcome! FWIW: this level of complexity leaves me cold. It is not functionality that I would use and my only view is that I hope it does not impact negatively on the performance or ease of use of what is an excellent browser. Cheers, /J -- http://jasonwryan.com/ [GnuPG Key: B1BD4E40] |
From: Hannes S. <ha...@yl...> - 2012-04-17 11:03:51
|
Jason Ryan <jas...@gm...> wrote: > On 17/04/12 at 08:56am, Hannes Sch__ller wrote: > > This is quite a complex subject, so let me first describe thec > > current behaviour of the patch. > > > <snip /> > > > Opinions welcome! > > FWIW: this level of complexity leaves me cold. It is not > functionality that I would use and my only view is that I hope it > does not impact negatively on the performance or ease of use of what > is an excellent browser. It's quite simple: If you don't define any site-specific overrides, the overhead is one function call, one if and one return. This could be further optimised to just one if. I don't think you will feel any performance impact from this. Hannes |