[hackers] [surf] Fix synchronization issue with atoms || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 12 May 2017 00:33:49 +0200 (CEST)

commit f5be376ccc1fef96722df610c4783e99ce1e944e
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Fri May 12 00:28:24 2017 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri May 12 00:30:51 2017 +0200

    Fix synchronization issue with atoms
    
    Be sure to sync after setting an atom.
    Sync too before reading one.

diff --git a/surf.c b/surf.c
index f02418a..2d3a6f5 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -530,10 +530,10 @@ geturi(Client *c)
 void
 setatom(Client *c, int a, const char *v)
 {
- XSync(dpy, False);
         XChangeProperty(dpy, c->xid,
                         atoms[a], XA_STRING, 8, PropModeReplace,
                         (unsigned char *)v, strlen(v) + 1);
+ XSync(dpy, False);
 }
 
 const char *
_AT_@ -545,6 +545,7 @@ getatom(Client *c, int a)
         unsigned long ldummy;
         unsigned char *p = NULL;
 
+ XSync(dpy, False);
         XGetWindowProperty(dpy, c->xid, atoms[a], 0L, BUFSIZ, False, XA_STRING,
                            &adummy, &idummy, &ldummy, &ldummy, &p);
         if (p)
Received on Fri May 12 2017 - 00:33:49 CEST

This archive was generated by hypermail 2.3.0 : Fri May 12 2017 - 00:36:24 CEST