Fix title handling

Don't forget to always set the title to the current uri, this way it's
up to date when there is no title on the page (ie for local file
exploration).
Thanks to pickfire for reporting the issue.
This commit is contained in:
Quentin Rameau 2015-12-01 12:31:42 +01:00
parent ee04671220
commit 934705c420

12
surf.c
View file

@ -365,7 +365,6 @@ loaduri(Client *c, const Arg *a)
reload(c, a); reload(c, a);
} else { } else {
webkit_web_view_load_uri(c->view, url); webkit_web_view_load_uri(c->view, url);
c->title = geturi(c);
updatetitle(c); updatetitle(c);
} }
@ -964,20 +963,25 @@ createwindow(Client *c)
void void
loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c) loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
{ {
const char *title = geturi(c);
switch (e) { switch (e) {
case WEBKIT_LOAD_STARTED: case WEBKIT_LOAD_STARTED:
setatom(c, AtomUri, title);
c->title = title;
c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1; c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
break; break;
case WEBKIT_LOAD_REDIRECTED: case WEBKIT_LOAD_REDIRECTED:
setatom(c, AtomUri, geturi(c)); setatom(c, AtomUri, title);
c->title = title;
break; break;
case WEBKIT_LOAD_COMMITTED: case WEBKIT_LOAD_COMMITTED:
setatom(c, AtomUri, title);
c->title = title;
if (!webkit_web_view_get_tls_info(c->view, NULL, if (!webkit_web_view_get_tls_info(c->view, NULL,
&(c->tlsflags))) &(c->tlsflags)))
c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1; c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
setatom(c, AtomUri, geturi(c));
if (enablestyle) if (enablestyle)
setstyle(c, getstyle(geturi(c))); setstyle(c, getstyle(geturi(c)));
break; break;