Surf changes the window title to reflect the URL of the link under the
pointer. This is good, as it means you can use xmobar or dzen or some
other program to inspect links, rather than having a dedicated pane.
It is also bad, because if you switch away from surf while hovering over
a link, the surf window will have a poor title, and will be harder to
find if you use window titles for navigation.
The attached patch fixes this by reverting the hover whenever the surf
window loses focus.
diff -r 0f29cb6df0ca -r f94ad8014e32 surf.c
--- a/surf.c Wed May 12 16:39:34 2010 +0200
+++ b/surf.c Wed May 12 16:40:00 2010 +0200
@@ -102,6 +102,7 @@
static void progresschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
static void reload(Client *c, const Arg *arg);
static void resize(GtkWidget *w, GtkAllocation *a, Client *c);
+static void focusout(GtkWidget *w, GtkAllocation *a, Client *c);
static void scroll(Client *c, const Arg *arg);
static void setatom(Client *c, Atom a, const char *v);
static void setcookie(SoupCookie *c);
@@ -529,6 +530,7 @@
gtk_window_set_default_size(GTK_WINDOW(c->win), 800, 600);
g_signal_connect(G_OBJECT(c->win), "destroy", G_CALLBACK(destroywin), c);
g_signal_connect(G_OBJECT(c->win), "key-press-event", G_CALLBACK(keypress), c);
+ g_signal_connect(G_OBJECT(c->win), "focus-out-event", G_CALLBACK(focusout), c);
g_signal_connect(G_OBJECT(c->win), "size-allocate", G_CALLBACK(resize), c);
if(!(c->items = calloc(1, sizeof(GtkWidget *) * LENGTH(items))))
@@ -724,6 +726,13 @@
}
void
+focusout(GtkWidget *w, GtkAllocation *a, Client *c) {
+ free (c->linkhover);
+ c->linkhover = NULL;
+ update(c);
+}
+
+void
scroll(Client *c, const Arg *arg) {
gdouble v;
GtkAdjustment *a;
--
\ Troels
/\ Henriksen