[wiki] [sites] [surf] patch allow popup on user gestures || Marcin sZpak

From: <git_AT_suckless.org>
Date: Sun, 03 Dec 2017 00:45:00 +0100

commit 4d80194ac3977d6f31cb252e9b292f3db5a6736e
Author: Marcin sZpak <szpak_AT_reakcja.org>
Date: Sun Dec 3 00:44:35 2017 +0100

    [surf] patch allow popup on user gestures

diff --git a/surf.suckless.org/patches/popup-on-gesture.md b/surf.suckless.org/patches/popup-on-gesture.md
new file mode 100644
index 00000000..e3f5d24d
--- /dev/null
+++ b/surf.suckless.org/patches/popup-on-gesture.md
_AT_@ -0,0 +1,18 @@
+Allow popup on gesture
+========================
+
+Description
+-----------
+
+Enable same-window popup on user gesture.
+(some pages don't work correctly without that, others redirect to spam pages though)
+
+Download
+--------
+
+* [surf-popup-2.0.diff](surf-popup-2.0.diff) (1037) (20171203)
+
+Author
+------
+
+* Marcin sZpak <[szpak_AT_reakcja.org](mailto:szpak_AT_reakcja.org)>
diff --git a/surf.suckless.org/patches/surf-popup-2.0.diff b/surf.suckless.org/patches/surf-popup-2.0.diff
new file mode 100644
index 00000000..36beebbe
--- /dev/null
+++ b/surf.suckless.org/patches/surf-popup-2.0.diff
_AT_@ -0,0 +1,21 @@
+diff -up surf-2.0/surf.c surf/surf.c
+--- surf-2.0/surf.c 2017-11-26 14:29:37.963786915 +0100
++++ surf/surf.c 2017-12-03 00:20:07.314189414 +0100
+_AT_@ -1183,12 +1183,13 @@ createview(WebKitWebView *v, WebKitNavig
+ switch (webkit_navigation_action_get_navigation_type(a)) {
+ case WEBKIT_NAVIGATION_TYPE_OTHER: /* fallthrough */
+ /*
+- * popup windows of type “other” are almost always triggered
+- * by user gesture, so inverse the logic here
++ * allow same-window popup triggered by user gesture
+ */
+-/* instead of this, compare destination uri to mouse-over uri for validating window */
+- if (webkit_navigation_action_is_user_gesture(a))
++ if (webkit_navigation_action_is_user_gesture(a)) {
++ Arg aa = {.v = webkit_uri_request_get_uri(webkit_navigation_action_get_request(a))};
++ loaduri((Client *) c, &aa);
+ return NULL;
++ }
+ case WEBKIT_NAVIGATION_TYPE_LINK_CLICKED: /* fallthrough */
+ case WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED: /* fallthrough */
+ case WEBKIT_NAVIGATION_TYPE_BACK_FORWARD: /* fallthrough */
Received on Sun Dec 03 2017 - 00:45:00 CET

This archive was generated by hypermail 2.3.0 : Sun Dec 03 2017 - 00:48:22 CET