tMerge remote-tracking branch 'upstream/surf-webkit2' - surf - [fork] customized build of surf, the suckless webkit browser
(HTM) git clone git://src.adamsgaard.dk/surf
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 98c25adc0481cc4b1712174dfd65d79f1251b4c1
(DIR) parent bcb5a05c9aacaf8768acd03f69665ec14e18ab1b
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 7 Apr 2022 11:12:15 +0200
Merge remote-tracking branch 'upstream/surf-webkit2'
Diffstat:
M config.def.h | 10 ++++++----
M surf.c | 8 +++++---
2 files changed, 11 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/config.def.h b/config.def.h
t@@ -67,10 +67,12 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
/* SETPROP(readprop, setprop, prompt)*/
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
- "prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
- "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
- "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
- "surf-setprop", winid, r, s, p, NULL \
+ "prop=\"$(printf '%b' \"$(xprop -id $1 "r" " \
+ "| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \
+ " -e 's/\\\\\\(.\\)/\\1/g')\" " \
+ "| dmenu -p '"p"' -w $1)\" " \
+ "&& xprop -id $1 -f "s" 8u -set "s" \"$prop\"", \
+ "surf-setprop", winid, NULL \
} \
}
(DIR) diff --git a/surf.c b/surf.c
t@@ -41,7 +41,7 @@
#define LENGTH(x) (sizeof(x) / sizeof(x[0]))
#define CLEANMASK(mask) (mask & (MODKEY|GDK_SHIFT_MASK))
-enum { AtomFind, AtomGo, AtomUri, AtomLast };
+enum { AtomFind, AtomGo, AtomUri, AtomUTF8, AtomLast };
enum {
OnDoc = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
t@@ -343,6 +343,7 @@ setup(void)
atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False);
atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False);
+ atoms[AtomUTF8] = XInternAtom(dpy, "UTF8_STRING", False);
gtk_init(NULL, NULL);
t@@ -612,7 +613,7 @@ void
setatom(Client *c, int a, const char *v)
{
XChangeProperty(dpy, c->xid,
- atoms[a], XA_STRING, 8, PropModeReplace,
+ atoms[a], atoms[AtomUTF8], 8, PropModeReplace,
(unsigned char *)v, strlen(v) + 1);
XSync(dpy, False);
}
t@@ -627,7 +628,8 @@ getatom(Client *c, int a)
unsigned char *p = NULL;
XSync(dpy, False);
- XGetWindowProperty(dpy, c->xid, atoms[a], 0L, BUFSIZ, False, XA_STRING,
+ XGetWindowProperty(dpy, c->xid,
+ atoms[a], 0L, BUFSIZ, False, atoms[AtomUTF8],
&adummy, &idummy, &ldummy, &ldummy, &p);
if (p)
strncpy(buf, (char *)p, LENGTH(buf) - 1);