[hackers] [surf] Fix title handling || Quentin Rameau

From: <git_AT_suckless.org>
Date: Tue, 1 Dec 2015 12:33:43 +0100 (CET)

commit 934705c420a25054b9be55a5321e97d6d56579e2
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Tue Dec 1 12:31:42 2015 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Tue Dec 1 12:31:42 2015 +0100

    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.

diff --git a/surf.c b/surf.c
index a5cfdd0..9b4dbb9 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -365,7 +365,6 @@ loaduri(Client *c, const Arg *a)
                 reload(c, a);
         } else {
                 webkit_web_view_load_uri(c->view, url);
- c->title = geturi(c);
                 updatetitle(c);
         }
 
_AT_@ -964,20 +963,25 @@ createwindow(Client *c)
 void
 loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
 {
+ const char *title = geturi(c);
+
         switch (e) {
         case WEBKIT_LOAD_STARTED:
+ setatom(c, AtomUri, title);
+ c->title = title;
                 c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
                 break;
         case WEBKIT_LOAD_REDIRECTED:
- setatom(c, AtomUri, geturi(c));
+ setatom(c, AtomUri, title);
+ c->title = title;
                 break;
         case WEBKIT_LOAD_COMMITTED:
+ setatom(c, AtomUri, title);
+ c->title = title;
                 if (!webkit_web_view_get_tls_info(c->view, NULL,
                     &(c->tlsflags)))
                         c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
 
- setatom(c, AtomUri, geturi(c));
-
                 if (enablestyle)
                         setstyle(c, getstyle(geturi(c)));
                 break;
Received on Tue Dec 01 2015 - 12:33:43 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 01 2015 - 12:36:17 CET