diff options
author | Christoph Lohmann <20h@r-36.net> | 2013-03-14 19:14:44 +0100 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2013-03-14 19:14:44 +0100 |
commit | a69c41ccac3141784140852c9d3935049d188d0f (patch) | |
tree | 201d2f358a0a295f60c9949af40c54c4a800170f /surf.c | |
parent | d02f73d9902b953e6d815856844c79e3755c26fd (diff) | |
download | surf-a69c41ccac3141784140852c9d3935049d188d0f.tar.gz surf-a69c41ccac3141784140852c9d3935049d188d0f.tar.bz2 surf-a69c41ccac3141784140852c9d3935049d188d0f.zip |
Support relative paths for surf.
Thanks Kurt Van Dijck <kurt.van.dijck@eia.be>!
Diffstat (limited to 'surf.c')
-rw-r--r-- | surf.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -577,12 +577,13 @@ loaduri(Client *c, const Arg *arg) { char *u, *rp; const char *uri = (char *)arg->v; Arg a = { .b = FALSE }; + struct stat st; if(strcmp(uri, "") == 0) return; /* In case it's a file path. */ - if(uri[0] == '/') { + if(stat(uri, &st) == 0) { rp = realpath(uri, NULL); u = g_strdup_printf("file://%s", rp); free(rp); @@ -889,11 +890,12 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) { if(ev->atom == atoms[AtomFind]) { arg.b = TRUE; find(c, &arg); + return GDK_FILTER_REMOVE; - } - else if(ev->atom == atoms[AtomGo]) { + } else if(ev->atom == atoms[AtomGo]) { arg.v = getatom(c, AtomGo); loaduri(c, &arg); + return GDK_FILTER_REMOVE; } } |