Replace titlechangeleave() with catch-all winevent()
All GtkWidget events have the same function prototype with the generic GdkEvent as parameter. This will let us handle everything in the switch.
This commit is contained in:
parent
d9cecc8932
commit
b4e78555d0
1 changed files with 15 additions and 7 deletions
20
surf.c
20
surf.c
|
@ -167,6 +167,7 @@ static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
|
||||||
static void print(Client *c, const Arg *arg);
|
static void print(Client *c, const Arg *arg);
|
||||||
static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
|
static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
|
||||||
gpointer d);
|
gpointer d);
|
||||||
|
static gboolean winevent(GtkWidget *w, GdkEvent *e, Client *c);
|
||||||
static void progresschanged(WebKitWebView *v, GParamSpec *ps, Client *c);
|
static void progresschanged(WebKitWebView *v, GParamSpec *ps, Client *c);
|
||||||
static void linkopen(Client *c, const Arg *arg);
|
static void linkopen(Client *c, const Arg *arg);
|
||||||
static void linkopenembed(Client *c, const Arg *arg);
|
static void linkopenembed(Client *c, const Arg *arg);
|
||||||
|
@ -180,7 +181,6 @@ static void sigchld(int unused);
|
||||||
static void spawn(Client *c, const Arg *arg);
|
static void spawn(Client *c, const Arg *arg);
|
||||||
static void stop(Client *c, const Arg *arg);
|
static void stop(Client *c, const Arg *arg);
|
||||||
static void titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c);
|
static void titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c);
|
||||||
static void titlechangeleave(void *a, void *b, Client *c);
|
|
||||||
static void toggle(Client *c, const Arg *arg);
|
static void toggle(Client *c, const Arg *arg);
|
||||||
static void togglecookiepolicy(Client *c, const Arg *arg);
|
static void togglecookiepolicy(Client *c, const Arg *arg);
|
||||||
static void togglegeolocation(Client *c, const Arg *arg);
|
static void togglegeolocation(Client *c, const Arg *arg);
|
||||||
|
@ -1125,8 +1125,8 @@ createwindow(Client *c)
|
||||||
|
|
||||||
g_signal_connect(G_OBJECT(w), "destroy",
|
g_signal_connect(G_OBJECT(w), "destroy",
|
||||||
G_CALLBACK(destroywin), c);
|
G_CALLBACK(destroywin), c);
|
||||||
g_signal_connect(G_OBJECT(w), "leave_notify_event",
|
g_signal_connect(G_OBJECT(w), "leave-notify-event",
|
||||||
G_CALLBACK(titlechangeleave), c);
|
G_CALLBACK(winevent), c);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
@ -1331,11 +1331,19 @@ titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c)
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
titlechangeleave(void *a, void *b, Client *c)
|
winevent(GtkWidget *w, GdkEvent *e, Client *c)
|
||||||
{
|
{
|
||||||
c->linkhover = NULL;
|
switch (e->type) {
|
||||||
|
case GDK_LEAVE_NOTIFY:
|
||||||
|
c->targeturi = NULL;
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue