summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-04-05 17:33:35 -0300
committerTingPing <tngpng@gmail.com>2013-04-05 17:33:35 -0300
commitc2a5b4fb7d00b5c3fa507fbf6d9f20141146ba20 (patch)
tree74c6d4b2545fd1a0de4c4408423b73380bbd0877
parentcca8ab46407d01cc04bff8f6e27e78dc225318bc (diff)
Disable esc keybinding on tabbed utils
-rw-r--r--src/fe-gtk/gtkutil.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index 8d358d13..744a0551 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -323,15 +323,22 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
 static gboolean
 gtkutil_esc_destroy (GtkWidget * win, GdkEventKey * key, gpointer userdata)
 {
-	GtkWidget *wid = win;
+	GtkWidget *wid;
 
-	/* Kill the window of detached utils */
-	if (gtk_window_get_type_hint (GTK_WINDOW (gtk_widget_get_parent (win))) == GDK_WINDOW_TYPE_HINT_DIALOG)
-		wid = gtk_widget_get_parent (win);
-		
-	if (key->keyval == GDK_Escape)
-		gtk_widget_destroy (wid); /* FIXME: leaves empty tabs */
+	/* Destroy the window of detached utils */
+	if (!gtk_widget_is_toplevel (win))
+	{
+		if (gdk_window_get_type_hint (gtk_widget_get_window (win)) == GDK_WINDOW_TYPE_HINT_DIALOG)
+			wid = gtk_widget_get_parent (win);
+		else
+			return FALSE;
+	}
+	else
+		wid = win;
 
+	if (key->keyval == GDK_Escape)
+		gtk_widget_destroy (wid);
+			
 	return FALSE;
 }