[hackers] [surf] closing bars when unfocusing them. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Thu, 10 Sep 2009 07:42:52 +0000 (UTC)

changeset: 88:d8628fc93353
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Thu Sep 10 09:44:21 2009 +0200
files: config.def.h surf.c
description:
closing bars when unfocusing them.

diff -r 51123efd2015 -r d8628fc93353 config.def.h
--- a/config.def.h Thu Sep 10 09:25:08 2009 +0200
+++ b/config.def.h Thu Sep 10 09:44:21 2009 +0200
@@ -1,6 +1,7 @@
 /* modifier 0 means no modifier */
 static gchar *progress = "#FF0000";
 static gchar *progress_trust = "#00FF00";
+static gchar *background = "#000000";
 #define MODKEY GDK_CONTROL_MASK
 static Key keys[] = {
     /* modifier keyval function arg Focus */
diff -r 51123efd2015 -r d8628fc93353 surf.c
--- a/surf.c Thu Sep 10 09:25:08 2009 +0200
+++ b/surf.c Thu Sep 10 09:44:21 2009 +0200
@@ -111,6 +111,7 @@
 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 @@
                         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 @@
         /* 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 @@
         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);
Received on Thu Sep 10 2009 - 07:42:52 UTC

This archive was generated by hypermail 2.2.0 : Thu Sep 10 2009 - 07:48:05 UTC