summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorEnno Boland (tox) <tox@s01.de>2009-09-10 09:44:21 +0200
committerEnno Boland (tox) <tox@s01.de>2009-09-10 09:44:21 +0200
commit82b712fdf71f4e019978306efc35293f76694993 (patch)
treef86beb165134731dd369fed90f9f5ccf077ec0c6 /surf.c
parent8f8abc6146fce495427fdc0ecf97c80ed99bdf44 (diff)
downloadsurf-82b712fdf71f4e019978306efc35293f76694993.tar.gz
surf-82b712fdf71f4e019978306efc35293f76694993.tar.bz2
surf-82b712fdf71f4e019978306efc35293f76694993.zip
closing bars when unfocusing them.
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/surf.c b/surf.c
index c1bb1b2..3460e36 100644
--- a/surf.c
+++ b/surf.c
@@ -111,6 +111,7 @@ static void showsearch(Client *c, const Arg *arg);
static void showurl(Client *c, const Arg *arg);
static void stop(Client *c, const Arg *arg);
static void titlechange(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, Client *c);
+static gboolean unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c);
static void usage(void);
static void update(Client *c);
static void zoom(Client *c, const Arg *arg);
@@ -196,7 +197,7 @@ drawindicator(Client *c) {
TRUE, 0, 0, w->allocation.width, w->allocation.height);
gdk_draw_rectangle(w->window, gc, TRUE, 0, 0, width,
w->allocation.height);
- g_object_unref(gc);/*g_free(gc);*/
+ g_object_unref(gc);
}
gboolean
@@ -408,10 +409,12 @@ newclient(void) {
/* urlbar */
c->urlbar = gtk_entry_new();
gtk_entry_set_has_frame(GTK_ENTRY(c->urlbar), FALSE);
+ g_signal_connect(G_OBJECT(c->urlbar), "focus-out-event", G_CALLBACK(unfocusbar), c);
/* searchbar */
c->searchbar = gtk_entry_new();
gtk_entry_set_has_frame(GTK_ENTRY(c->searchbar), FALSE);
+ g_signal_connect(G_OBJECT(c->searchbar), "focus-out-event", G_CALLBACK(unfocusbar), c);
/* indicator */
c->indicator = gtk_drawing_area_new();
@@ -626,6 +629,13 @@ titlechange(WebKitWebView *v, WebKitWebFrame *f, const gchar *t, Client *c) {
update(c);
}
+gboolean
+unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c) {
+ hidesearch(c, NULL);
+ hideurl(c, NULL);
+ return TRUE;
+}
+
void
usage(void) {
fputs("surf - simple browser\n", stderr);