summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2021-07-19 21:23:32 +0200
committerQuentin Rameau <quinq@fifth.space>2021-07-19 22:27:50 +0200
commit11dca18a2d148e5a6463aba783567a3815424963 (patch)
tree520bb6b452806a7f9f7553ceef106a01c2852774 /surf.c
parent238d2273b50c33a1e98ad55750126f05201f911d (diff)
Improve non-ASCII character search handling
Before, the XA_STRING would only let use ASCII characters properly. Now UTF-8 characters should be handled correctly.
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/surf.c b/surf.c
index c25def7..03d8242 100644
--- a/surf.c
+++ b/surf.c
@@ -37,7 +37,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,
@@ -339,6 +339,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);
@@ -608,7 +609,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);
}
@@ -623,7 +624,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);