summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorEnno Boland (tox) <tox@s01.de>2009-11-08 23:45:36 +0100
committerEnno Boland (tox) <tox@s01.de>2009-11-08 23:45:36 +0100
commit1d93bfa9ce13c7c4581611b7441fe66680ab80c3 (patch)
treea9cece991e9310d3105e07a1ea8e7c9d178f3aec /surf.c
parentb57eca1a2bf1a65899866753cf9f8488223a2b47 (diff)
downloadsurf-1d93bfa9ce13c7c4581611b7441fe66680ab80c3.tar.gz
surf-1d93bfa9ce13c7c4581611b7441fe66680ab80c3.tar.bz2
surf-1d93bfa9ce13c7c4581611b7441fe66680ab80c3.zip
changing locking algorythm for setprop.
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/surf.c b/surf.c
index 478c07e..66a60d0 100644
--- a/surf.c
+++ b/surf.c
@@ -61,7 +61,7 @@ static SoupSession *session;
static Client *clients = NULL;
static GdkNativeWindow embed = 0;
static gboolean showxid = FALSE;
-static int ignorexprop = 0;
+static Time lastxprop = 0;
static char winid[64];
static char *progname;
static gboolean lockcookie = FALSE;
@@ -539,6 +539,7 @@ newclient(void) {
g_object_set(G_OBJECT(settings), "user-stylesheet-uri", uri, NULL);
g_free(uri);
setatom(c, findprop, "");
+ setatom(c, uriprop, "");
c->download = NULL;
c->title = NULL;
@@ -596,9 +597,8 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
if(((XEvent *)e)->type == PropertyNotify) {
ev = &((XEvent *)e)->xproperty;
- if(ignorexprop)
- ignorexprop--;
- else if(ev->state == PropertyNewValue) {
+ if((!lastxprop || lastxprop + 512 < ev->time)
+ && ev->state == PropertyNewValue) {
if(ev->atom == uriprop) {
arg.v = getatom(c, uriprop);
loaduri(c, &arg);
@@ -607,6 +607,7 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
arg.b = TRUE;
find(c, &arg);
}
+ lastxprop = ev->time;
return GDK_FILTER_REMOVE;
}
}
@@ -673,11 +674,10 @@ scroll(Client *c, const Arg *arg) {
void
setatom(Client *c, Atom a, const char *v) {
- XSync(dpy, False);
- ignorexprop++;
XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window), a,
XA_STRING, 8, PropModeReplace, (unsigned char *)v,
strlen(v) + 1);
+ XSync(dpy, False);
}
void