[hackers] [surf] fixing _SURF_URL XProperty. || Enno Boland (Gottox)

From: <hg_AT_suckless.org>
Date: Mon, 8 Jun 2009 20:55:54 +0000 (UTC)

changeset: 35:6d859fdb3600
tag: tip
user: Enno Boland (Gottox) <gottox_AT_s01.de>
date: Mon Jun 08 22:55:48 2009 +0200
files: surf.c
description:
fixing _SURF_URL XProperty.

diff -r 026ea67c103f -r 6d859fdb3600 surf.c
--- a/surf.c Mon Jun 08 21:36:37 2009 +0200
+++ b/surf.c Mon Jun 08 22:55:48 2009 +0200
@@ -272,8 +272,8 @@
         Client *c = (Client *)d;
         gchar *uri;
 
+ ignore_once = TRUE;
         uri = geturi(c);
- ignore_once = TRUE;
         XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window), urlprop,
                         XA_STRING, 8, PropModeReplace, (unsigned char *)uri,
                         strlen(uri) + 1);
@@ -425,12 +425,16 @@
         unsigned char *buf = NULL;
         if(((XEvent *)e)->type == PropertyNotify) {
                 ev = &((XEvent *)e)->xproperty;
- if(ignore_once == FALSE && ev->atom == urlprop && ev->state == PropertyNewValue) {
- XGetWindowProperty(dpy, ev->window, urlprop, 0L, BUFSIZ, False, XA_STRING,
- &adummy, &idummy, &ldummy, &ldummy, &buf);
- loaduri(c, (gchar *)buf);
- XFree(buf);
- return GDK_FILTER_REMOVE;
+ if(ev->atom == urlprop && ev->state == PropertyNewValue) {
+ if(ignore_once)
+ ignore_once = FALSE;
+ else {
+ XGetWindowProperty(dpy, ev->window, urlprop, 0L, BUFSIZ, False, XA_STRING,
+ &adummy, &idummy, &ldummy, &ldummy, &buf);
+ loaduri(c, (gchar *)buf);
+ XFree(buf);
+ return GDK_FILTER_REMOVE;
+ }
                 }
         }
         return GDK_FILTER_CONTINUE;
Received on Mon Jun 08 2009 - 20:55:54 UTC

This archive was generated by hypermail 2.2.0 : Mon Jun 08 2009 - 21:00:05 UTC