Import the arg.h from st which fixed the oob bug.
[surf.git] / surf.c
diff --git a/surf.c b/surf.c
index 180f6e4..9b4dbb9 100644 (file)
--- a/surf.c
+++ b/surf.c
@@ -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);
        }
 
@@ -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;
@@ -1425,10 +1429,8 @@ clickexternplayer(Client *c, const Arg *a, WebKitHitTestResult *h)
 {
        Arg arg;
 
-       if (webkit_hit_test_result_get_context(h) & OnMedia) {
-               arg = (Arg)VIDEOPLAY(webkit_hit_test_result_get_media_uri(h));
-               spawn(c, &arg);
-       }
+       arg = (Arg)VIDEOPLAY(webkit_hit_test_result_get_media_uri(h));
+       spawn(c, &arg);
 }
 
 int
@@ -1517,7 +1519,7 @@ main(int argc, char *argv[])
                stylefile = EARGF(usage());
                break;
        case 'u':
-               useragent = EARGF(usage());
+               fulluseragent = EARGF(usage());
                break;
        case 'v':
                die("surf-"VERSION", ©2009-2015 surf engineers, "