[hackers] [surf] _SURF_URI gets initialised as soon as the window opens. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Fri, 29 Jan 2010 08:42:56 +0000 (UTC)

changeset: 174:1b039f93180a
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Fri Jan 29 09:44:14 2010 +0100
files: surf.c
description:
_SURF_URI gets initialised as soon as the window opens.

diff -r 63600cd32eea -r 1b039f93180a surf.c
--- a/surf.c Wed Jan 20 14:46:22 2010 +0100
+++ b/surf.c Fri Jan 29 09:44:14 2010 +0100
@@ -435,14 +435,23 @@
 loaduri(Client *c, const Arg *arg) {
         char *u;
         const char *uri = (char *)arg->v;
+ Arg a = { .b = FALSE };
 
+ if(strcmp(uri, "") == 0)
+ return;
         u = g_strrstr(uri, "://") ? g_strdup(uri)
                 : g_strdup_printf("http://%s", uri);
- webkit_web_view_load_uri(c->view, u);
- c->progress = 0;
- c->title = copystr(&c->title, u);
- g_free(u);
- update(c);
+ /* prevents endless loop */
+ if(c->uri && strcmp(u, c->uri) == 0) {
+ reload(c, &a);
+ }
+ else {
+ webkit_web_view_load_uri(c->view, u);
+ c->progress = 0;
+ c->title = copystr(&c->title, u);
+ g_free(u);
+ update(c);
+ }
 }
 
 void
@@ -551,6 +560,7 @@
         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;
Received on Fri Jan 29 2010 - 08:42:56 UTC

This archive was generated by hypermail 2.2.0 : Fri Jan 29 2010 - 08:48:16 UTC