diff options
Diffstat (limited to 'surf/patches/surf-git-20170323-webkit2-searchengines.diff')
-rw-r--r-- | surf/patches/surf-git-20170323-webkit2-searchengines.diff | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/surf/patches/surf-git-20170323-webkit2-searchengines.diff b/surf/patches/surf-git-20170323-webkit2-searchengines.diff deleted file mode 100644 index a8de97c..0000000 --- a/surf/patches/surf-git-20170323-webkit2-searchengines.diff +++ /dev/null @@ -1,56 +0,0 @@ -diff --git a/surf.c b/surf.c -index 93a1629..eb2af97 100644 ---- a/surf.c -+++ b/surf.c -@@ -129,6 +129,11 @@ typedef struct { - } Button; - - typedef struct { -+ char *token; -+ char *uri; -+} SearchEngine; -+ -+typedef struct { - const char *uri; - Parameter config[ParameterLast]; - regex_t re; -@@ -202,6 +207,7 @@ static void responsereceived(WebKitDownload *d, GParamSpec *ps, Client *c); - static void download(Client *c, WebKitURIResponse *r); - static void closeview(WebKitWebView *v, Client *c); - static void destroywin(GtkWidget* w, Client *c); -+static gchar *parseuri(const gchar *uri); - - /* Hotkeys */ - static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); -@@ -477,7 +483,7 @@ loaduri(Client *c, const Arg *a) - url = g_strdup_printf("file://%s", path); - free(path); - } else { -- url = g_strdup_printf("http://%s", uri); -+ url = parseuri(uri); - } - - setatom(c, AtomUri, url); -@@ -1461,6 +1467,22 @@ destroywin(GtkWidget* w, Client *c) - gtk_main_quit(); - } - -+gchar * -+parseuri(const gchar *uri) { -+ guint i; -+ -+ for (i = 0; i < LENGTH(searchengines); i++) { -+ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || -+ *(uri + strlen(searchengines[i].token)) != ' ') -+ continue; -+ if (g_str_has_prefix(uri, searchengines[i].token)) -+ return g_strdup_printf(searchengines[i].uri, -+ uri + strlen(searchengines[i].token) + 1); -+ } -+ -+ return g_strdup_printf("http://%s", uri); -+} -+ - void - pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) - { |