Apply modal patch and adjust the configuration to be more "modal" - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset abf562f7afdcd1c64e36b878c8be15d367760846
(DIR) parent 0090b42962632606ee7195fe84a04d527d407ab2
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 6 Apr 2019 22:19:30
Apply modal patch and adjust the configuration to be more "modal"
Diffstat:
wip/surf-git/patch-config.h | 54 +++++++++++++++++++++-----------------------
wip/surf-git/patch-surf.c | 49 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 28 deletions(-)
---
diff -r 0090b4296263 -r abf562f7afdc wip/surf-git/patch-config.h
--- a/wip/surf-git/patch-config.h Sat Mar 30 14:52:42 2019 +0100
+++ b/wip/surf-git/patch-config.h Sat Apr 06 22:19:30 2019 +0200
@@ -1,6 +1,6 @@
--- /dev/null 2018-10-09 23:31:13.462782904 +0200
+++ config.h 2018-10-09 23:38:25.662442657 +0200
-@@ -0,0 +1,195 @@
+@@ -0,0 +1,193 @@
+/* modifier 0 means no modifier */
+static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
+static char *fulluseragent = ""; /* Or override the whole user agent string */
@@ -23,7 +23,7 @@
+ [AccessWebcam] = { { .i = 0 }, },
+ [Certificate] = { { .i = 0 }, },
+ [CaretBrowsing] = { { .i = 0 }, },
-+ [CookiePolicies] = { { .v = "@Aa" }, },
++ [CookiePolicies] = { { .v = "a@A" }, },
+ [DefaultCharset] = { { .v = "UTF-8" }, },
+ [DiskCache] = { { .i = 1 }, },
+ [DNSPrefetch] = { { .i = 0 }, },
@@ -133,42 +133,40 @@
+ */
+static Key keys[] = {
+ /* modifier keyval function arg */
-+ { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
-+ { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
-+ { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
++ { 0, GDK_KEY_o, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
++ { 0, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+
-+ { 0, GDK_KEY_Escape, stop, { 0 } },
-+ { MODKEY, GDK_KEY_c, stop, { 0 } },
++ { 0, GDK_KEY_c, stop, { 0 } },
++ { 0, GDK_KEY_i, insert, { .i = 1 } },
++ { 0, GDK_KEY_Escape, insert, { .i = 0 } },
+
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
-+ { MODKEY, GDK_KEY_r, reload, { .i = 0 } },
++ { GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
++ { 0, GDK_KEY_r, reload, { .i = 0 } },
+
-+ { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
-+ { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
++ { GDK_SHIFT_MASK, GDK_KEY_b, navigate, { .i = +1 } },
++ { 0, GDK_KEY_b, navigate, { .i = -1 } },
+
+ /* vertical and horizontal scrolling, in viewport percentage */
-+ { MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
-+ { MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
-+ { MODKEY, GDK_KEY_b, scrollv, { .i = +50 } },
-+ { MODKEY, GDK_KEY_space, scrollv, { .i = -50 } },
-+ { MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
-+ { MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
++ { 0, GDK_KEY_j, scrollv, { .i = +10 } },
++ { 0, GDK_KEY_k, scrollv, { .i = -10 } },
++ { 0, GDK_KEY_h, scrollh, { .i = +10 } },
++ { 0, GDK_KEY_l, scrollh, { .i = -10 } },
+
+
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
-+ { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
-+ { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
++ { 0, GDK_KEY_minus, zoom, { .i = -1 } },
++ { 0, GDK_KEY_plus, zoom, { .i = +1 } },
+
-+ { MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
-+ { MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
++ { 0, GDK_KEY_p, clipboard, { .i = 1 } },
++ { 0, GDK_KEY_y, clipboard, { .i = 0 } },
+
-+ { MODKEY, GDK_KEY_n, find, { .i = +1 } },
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
++ { 0, GDK_KEY_n, find, { .i = +1 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
+
-+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
-+ { MODKEY, GDK_KEY_t, showcert, { 0 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
++ { 0|GDK_SHIFT_MASK, GDK_KEY_t, showcert, { 0 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
+ { 0, GDK_KEY_F11, togglefullscreen, { 0 } },
diff -r 0090b4296263 -r abf562f7afdc wip/surf-git/patch-surf.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wip/surf-git/patch-surf.c Sat Apr 06 22:19:30 2019 +0200
@@ -0,0 +1,49 @@
+$NetBSD$
+
+Apply modal patch, mostly based on:
+ <https://surf.suckless.org/patches/modal/>
+
+--- surf.c.orig 2019-03-06 11:19:52.000000000 +0000
++++ surf.c
+@@ -231,6 +231,7 @@ static void togglefullscreen(Client *c,
+ static void togglecookiepolicy(Client *c, const Arg *a);
+ static void toggleinspector(Client *c, const Arg *a);
+ static void find(Client *c, const Arg *a);
++static void insert(Client *c, const Arg *a);
+
+ /* Buttons */
+ static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
+@@ -244,6 +245,7 @@ static Atom atoms[AtomLast];
+ static Window embed;
+ static int showxid;
+ static int cookiepolicy;
++static int insertmode;
+ static Display *dpy;
+ static Client *clients;
+ static GdkDevice *gdkkb;
+@@ -1333,7 +1335,11 @@ winevent(GtkWidget *w, GdkEvent *e, Clie
+ updatetitle(c);
+ break;
+ case GDK_KEY_PRESS:
+- if (!curconfig[KioskMode].val.i) {
++ if (!curconfig[KioskMode].val.i &&
++ !insertmode ||
++ CLEANMASK(e->key.state) == (MODKEY|GDK_SHIFT_MASK) ||
++ CLEANMASK(e->key.state) == (MODKEY) ||
++ gdk_keyval_to_lower(e->key.keyval) == (GDK_KEY_Escape)) {
+ for (i = 0; i < LENGTH(keys); ++i) {
+ if (gdk_keyval_to_lower(e->key.keyval) ==
+ keys[i].keyval &&
+@@ -1948,6 +1954,12 @@ find(Client *c, const Arg *a)
+ }
+
+ void
++insert(Client *c, const Arg *a)
++{
++ insertmode = (a->i);
++}
++
++void
+ clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h)
+ {
+ navigate(c, a);