From a2ca8e357f346aaab5c079649b7f0ab99b6a584f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 25 Jun 2017 02:49:12 -0400 Subject: network/surf: Updated for version 2.0. Signed-off-by: B. Watson --- network/surf/getkbdevice.diff | 61 ++++++++++++++++++++++++ network/surf/patches/homepage.diff | 19 ++++---- network/surf/patches/searchengines.diff | 82 ++++++++++++++++----------------- network/surf/surf.SlackBuild | 32 +++++++------ network/surf/surf.info | 8 ++-- 5 files changed, 132 insertions(+), 70 deletions(-) create mode 100644 network/surf/getkbdevice.diff (limited to 'network/surf') diff --git a/network/surf/getkbdevice.diff b/network/surf/getkbdevice.diff new file mode 100644 index 0000000000..14bef9460d --- /dev/null +++ b/network/surf/getkbdevice.diff @@ -0,0 +1,61 @@ +diff -Naur surf-2.0/surf.c surf-2.0.patched/surf.c +--- surf-2.0/surf.c 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/surf.c 2017-06-25 01:23:41.445168316 -0400 +@@ -174,6 +174,7 @@ + static void cleanup(void); + + /* GTK/WebKit */ ++static GdkDevice *getkbdevice(void); + static WebKitWebView *newview(Client *c, WebKitWebView *rv); + static void initwebextensions(WebKitWebContext *wc, Client *c); + static GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a, +@@ -263,7 +264,6 @@ + void + setup(void) + { +- GdkDisplay *gdpy; + int i, j; + + /* clean up any zombies immediately */ +@@ -281,8 +281,6 @@ + + gtk_init(NULL, NULL); + +- gdpy = gdk_display_get_default(); +- + curconfig = defconfig; + + /* dirs and files */ +@@ -290,7 +288,7 @@ + scriptfile = buildfile(scriptfile); + cachedir = buildpath(cachedir); + +- gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy)); ++ gdkkb = getkbdevice(); + + if (!stylefile) { + styledir = buildpath(styledir); +@@ -329,6 +327,23 @@ + } + } + ++static GdkDevice * ++getkbdevice(void) ++{ ++ GList *l, *gdl = gdk_device_manager_list_devices( ++ gdk_display_get_device_manager(gdk_display_get_default()), ++ GDK_DEVICE_TYPE_MASTER); ++ GdkDevice *gd = NULL; ++ ++ for (l = gdl; l != NULL; l = l->next) ++ if (gdk_device_get_source(l->data) == GDK_SOURCE_KEYBOARD) ++ gd = l->data; ++ ++ g_list_free(gdl); ++ return gd; ++} ++ ++ + void + sigchld(int unused) + { diff --git a/network/surf/patches/homepage.diff b/network/surf/patches/homepage.diff index f31b8fe89d..4e130a6e88 100644 --- a/network/surf/patches/homepage.diff +++ b/network/surf/patches/homepage.diff @@ -1,15 +1,12 @@ -diff -Naur surf-0.7/surf.c surf-0.7.patched/surf.c ---- surf-0.7/surf.c 2015-12-19 09:59:30.000000000 -0500 -+++ surf-0.7.patched/surf.c 2017-01-21 22:00:00.856364467 -0500 -@@ -1759,8 +1759,11 @@ - default: - usage(); - } ARGEND; -+#define HOMEPAGE "@HOMEPAGE@" +diff -Naur surf-2.0/surf.c surf-2.0.patched/surf.c +--- surf-2.0/surf.c 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/surf.c 2017-06-25 01:33:34.501169322 -0400 +@@ -1751,7 +1751,7 @@ if (argc > 0) arg.v = argv[0]; -+ else -+ arg.v = HOMEPAGE; + else +- arg.v = "about:blank"; ++ arg.v = "@HOMEPAGE@"; setup(); - c = newclient(); + c = newclient(NULL); diff --git a/network/surf/patches/searchengines.diff b/network/surf/patches/searchengines.diff index 77ad9deb80..e4577632e0 100644 --- a/network/surf/patches/searchengines.diff +++ b/network/surf/patches/searchengines.diff @@ -1,8 +1,8 @@ -diff -Naur surf-0.7/config.def.h surf-0.7.patched/config.def.h ---- surf-0.7/config.def.h 2015-12-19 09:59:30.000000000 -0500 -+++ surf-0.7.patched/config.def.h 2017-01-21 22:05:50.709360322 -0500 -@@ -129,6 +129,14 @@ - { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } }, +diff -Naur surf-2.0/config.def.h surf-2.0.patched/config.def.h +--- surf-2.0/config.def.h 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/config.def.h 2017-06-25 02:20:53.529174137 -0400 +@@ -153,6 +153,13 @@ + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, }; +static SearchEngine searchengines[] = { @@ -10,63 +10,61 @@ diff -Naur surf-0.7/config.def.h surf-0.7.patched/config.def.h + { "g", "https://www.google.com/search?q=%s" }, + { "dict", "http://www.thefreedictionary.com/%s" }, + { "sb", "http://slackbuilds.org/result/?search=%s&sv=@SLACKVER@" }, -+ { "sw", "http://search.slackware.eu/cgi-bin/search.cgi?rm=search&needle=%s&haystack=2&sver=@SVER@&button-search=Search" }, +}; + /* button definitions */ - /* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */ + /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ static Button buttons[] = { -diff -Naur surf-0.7/surf.c surf-0.7.patched/surf.c ---- surf-0.7/surf.c 2015-12-19 09:59:30.000000000 -0500 -+++ surf-0.7.patched/surf.c 2017-01-21 22:05:12.304360777 -0500 -@@ -91,6 +91,12 @@ - G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) +diff -Naur surf-2.0/surf.c surf-2.0.patched/surf.c +--- surf-2.0/surf.c 2017-03-28 12:17:45.000000000 -0400 ++++ surf-2.0.patched/surf.c 2017-06-25 02:04:32.517172473 -0400 +@@ -129,6 +129,11 @@ + } Button; typedef struct { -+ char *token; -+ char *uri; ++ char *token; ++ char *uri; +} SearchEngine; + -+ +typedef struct { - char *regex; - char *style; + const char *uri; + Parameter config[ParameterLast]; regex_t re; -@@ -178,6 +184,7 @@ - static void navigate(Client *c, const Arg *arg); - static Client *newclient(void); - static void newwindow(Client *c, const Arg *arg, gboolean noembed); +@@ -202,6 +207,7 @@ + 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); - static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu, - WebKitHitTestResult *target, gboolean keyboard, -@@ -838,8 +845,7 @@ - u = g_strdup_printf("file://%s", rp); - free(rp); +@@ -477,7 +483,7 @@ + url = g_strdup_printf("file://%s", path); + free(path); } else { -- u = g_strrstr(uri, "://") ? g_strdup(uri) -- : g_strdup_printf("http://%s", uri); -+ u = parseuri(uri); +- url = g_strdup_printf("http://%s", uri); ++ url = parseuri(uri); } - setatom(c, AtomUri, uri); -@@ -1172,6 +1178,21 @@ - } + setatom(c, AtomUri, url); +@@ -1461,6 +1467,22 @@ + gtk_main_quit(); } -+static gchar * ++gchar * +parseuri(const gchar *uri) { -+ guint i; ++ 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); -+ } ++ 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_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); ++ return g_strdup_printf("http://%s", uri); +} + void diff --git a/network/surf/surf.SlackBuild b/network/surf/surf.SlackBuild index 12079a00f1..98507c6896 100644 --- a/network/surf/surf.SlackBuild +++ b/network/surf/surf.SlackBuild @@ -6,13 +6,22 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20170625 bkw: +# - updated for v2.0 (webkit2gtk now required). +# - re-work searchengines.diff and homepage.diff for v2.0. +# - remove "sw" search from searchengines.diff, since packages.slackware.eu +# no longer exists. Before you ask, no, I can't replace it with the official +# search at packages.slackware.com, because searchengines.diff only does +# HTTP GET requests. Find me a working Slackware package search that doesn't +# require a POST request, and I'll add it to searchengines.diff. + # 20170121 bkw: # - updated for v0.7. # - remove patches/startfullscreen.diff as it's integrated into 0.7 # - update homepage.diff and searchengines.diff for 0.7 PRGNAM=surf -VERSION=${VERSION:-0.7} +VERSION=${VERSION:-2.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -58,6 +67,12 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +# Revert upstream commit f9714ab8, which requires gtk+3-3.20.0 or greater. +# We only have 3.18.9 in Slack 14.2. NB: submission reviewer, please don't +# move this patch into patches/ (it must always be applied, whether or not +# PATCH=yes is set). +patch -p1 < $CWD/getkbdevice.diff + # Add a couple of nice patches from upstream, unless disabled. Note that # upstream expects users to add patches and edit the source to customize it. # This SlackBuild just semi-automates some of that process. @@ -71,7 +86,7 @@ fi # Customization. -# Default to rxvt rather than st as the terminal for running wget when +# Default to rxvt rather than st as the terminal for running curl when # downloading. This avoids adding st as a required dep. TERMINAL=${TERMINAL:-rxvt} @@ -88,17 +103,9 @@ SLACKVER="${SLACKVER:-$( cut -d' ' -f2 /etc/slackware-version )}" # For the paranoid: STRICTSSL=${STRICTSSL:-no} if [ "$STRICTSSL" = "yes" ]; then - sed -i '/strictssl/s,FALSE,TRUE,' config.def.h + sed -i '/StrictSSL/s,0,1,' config.def.h fi -# Apply customizations -case "$SLACKVER$LIBDIRSUFFIX" in - 14.0) SVER=19 ;; - 14.064) SVER=20 ;; - current) SVER=13 ;; - current64) SVER=16 ;; -esac - sed -i \ -e "s,@HOMEPAGE@,$HOMEPAGE,g" \ -e "s,\<800\>,$WIDTH," \ @@ -107,8 +114,7 @@ sed -i \ sed -i \ -e "s,\,$TERMINAL," \ - -e "s,@SVER@,$SVER,g" \ - -e "s,@64@,$LIBDIRSUFFIX,g" \ + -e "s,@SLACKVER@,$SLACKVER," \ config.def.h sed -i \ diff --git a/network/surf/surf.info b/network/surf/surf.info index 985a9db95c..5bb80fa663 100644 --- a/network/surf/surf.info +++ b/network/surf/surf.info @@ -1,10 +1,10 @@ PRGNAM="surf" -VERSION="0.7" +VERSION="2.0" HOMEPAGE="http://surf.suckless.org/" -DOWNLOAD="http://dl.suckless.org/surf/surf-0.7.tar.gz" -MD5SUM="45899435aeb5ce3af0a62909911b735f" +DOWNLOAD="http://dl.suckless.org/surf/surf-2.0.tar.gz" +MD5SUM="11713901fa83c536f3ddfacfc28c3acc" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="webkitgtk dmenu" +REQUIRES="webkit2gtk dmenu" MAINTAINER="B. Watson" EMAIL="yalhcru@gmail.com" -- cgit v1.2.3