network/surf: Updated for version 0.7.

This commit is contained in:
B. Watson 2017-01-21 22:09:53 -05:00 committed by Willy Sudiarto Raharjo
parent df6bba04a4
commit 023ef991d2
No known key found for this signature in database
GPG key ID: 887B8374D7333381
6 changed files with 57 additions and 120 deletions

View file

@ -13,6 +13,3 @@ google for foo and bar. Supported engines:
homepage - The browser will start at your home page if called with no
arguments (normally it starts with a blank window).
startfullscreen - Adds -f option to start the browser in fullscreen
mode. Can still use F11 to toggle fullscreen.

View file

@ -1,15 +1,15 @@
diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c
--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500
+++ surf-0.6.patched/surf.c 2013-07-03 16:48:40.000000000 -0400
@@ -1218,8 +1218,11 @@
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@"
if(argc > 0)
if (argc > 0)
arg.v = argv[0];
+ else
+ arg.v = HOMEPAGE;
setup();
newclient();
c = newclient();

View file

@ -1,8 +1,8 @@
diff -Naur surf-0.6/config.def.h surf-0.6.patched/config.def.h
--- surf-0.6/config.def.h 2013-02-10 13:40:14.000000000 -0500
+++ surf-0.6.patched/config.def.h 2013-07-03 16:40:14.000000000 -0400
@@ -93,3 +93,10 @@
{ MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
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 } },
};
+static SearchEngine searchengines[] = {
@ -12,50 +12,55 @@ diff -Naur surf-0.6/config.def.h surf-0.6.patched/config.def.h
+ { "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" },
+};
diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c
--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500
+++ surf-0.6.patched/surf.c 2013-07-03 15:25:44.000000000 -0400
@@ -76,6 +76,11 @@
+
/* button definitions */
/* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */
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)
+typedef struct {
typedef struct {
+ char *token;
+ char *uri;
+} SearchEngine;
+
static Display *dpy;
static Atom atoms[AtomLast];
static Client *clients = NULL;
@@ -139,6 +144,7 @@
+
+typedef struct {
char *regex;
char *style;
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);
+static gchar *parseuri(const gchar *uri);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c);
static void popupactivate(GtkMenuItem *menu, Client *);
@@ -627,8 +633,8 @@
static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu,
WebKitHitTestResult *target, gboolean keyboard,
@@ -838,8 +845,7 @@
u = g_strdup_printf("file://%s", rp);
free(rp);
} else {
- u = g_strrstr(uri, "://") ? g_strdup(uri)
- : g_strdup_printf("http://%s", uri);
+ u = parseuri(uri);
+
}
/* prevents endless loop */
@@ -893,6 +899,20 @@
setatom(c, AtomUri, uri);
@@ -1172,6 +1178,21 @@
}
}
+gchar *
+static 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)) != ' ')
+ 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);
@ -64,6 +69,6 @@ diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c
+ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri);
+}
+
static void
pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) {
Arg arg = {.v = text };
void
pasteuri(GtkClipboard *clipboard, const char *text, gpointer d)
{

View file

@ -1,70 +0,0 @@
diff -Naur surf-0.6/surf.1 surf-0.6.patched/surf.1
--- surf-0.6/surf.1 2013-02-10 13:40:14.000000000 -0500
+++ surf-0.6.patched/surf.1 2013-07-03 18:41:35.000000000 -0400
@@ -50,6 +50,8 @@
.B \-x
Prints xid to standard output. This can be used to script the browser by using
.BR xprop(1).
+.B \-f
+Start in fullscreen mode.
.SH USAGE
.B Escape
Stops loading current page or stops download.
diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c
--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500
+++ surf-0.6.patched/surf.c 2013-07-03 18:42:07.000000000 -0400
@@ -81,6 +81,7 @@
static Client *clients = NULL;
static GdkNativeWindow embed = 0;
static gboolean showxid = FALSE;
+static gboolean startfullscreen = FALSE;
static char winid[64];
static gboolean usingproxy = 0;
static char togglestat[5];
@@ -463,7 +464,7 @@
} else {
gtk_window_fullscreen(GTK_WINDOW(c->win));
}
- c->fullscreen = !c->fullscreen;
+ startfullscreen = c->fullscreen = !c->fullscreen;
}
static const char *
@@ -822,6 +823,9 @@
}
}
+ if(startfullscreen) {
+ fullscreen(c, NULL);
+ }
return c;
}
@@ -846,6 +850,8 @@
cmd[i++] = "-i";
if(showxid)
cmd[i++] = "-x";
+ if(startfullscreen)
+ cmd[i++] = "-f";
cmd[i++] = "--";
uri = arg->v ? (char *)arg->v : c->linkhover;
if(uri)
@@ -1148,7 +1154,7 @@
static void
usage(void) {
- die("usage: %s [-inpsvx] [-c cookiefile] [-e xid] [-r scriptfile]"
+ die("usage: %s [-inpsvxf] [-c cookiefile] [-e xid] [-r scriptfile]"
" [-t stylefile] [-u useragent] [uri]\n", basename(argv0));
}
@@ -1215,6 +1221,9 @@
case 'x':
showxid = TRUE;
break;
+ case 'f':
+ startfullscreen = TRUE;
+ break;
default:
usage();
} ARGEND;

View file

@ -6,8 +6,13 @@
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 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.6}
VERSION=${VERSION:-0.7}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

View file

@ -1,8 +1,8 @@
PRGNAM="surf"
VERSION="0.6"
VERSION="0.7"
HOMEPAGE="http://surf.suckless.org/"
DOWNLOAD="http://dl.suckless.org/surf/surf-0.6.tar.gz"
MD5SUM="aeeed723b562a30cc6a2b3ea18f6d99a"
DOWNLOAD="http://dl.suckless.org/surf/surf-0.7.tar.gz"
MD5SUM="45899435aeb5ce3af0a62909911b735f"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="webkitgtk dmenu"