[nautilus] window: propagate key events to GtkEditables early



commit 8d3289d3f5386fac9fb2aded7dd67fd0a9252dd8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 26 12:01:37 2012 -0400

    window: propagate key events to GtkEditables early
    
    Even when we're not renaming, process events for focused GtkEditables
    before activating the menu accels and mnemonics.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619529

 src/nautilus-window.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 63075d1..300073d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -981,6 +981,7 @@ nautilus_window_key_press_event (GtkWidget *widget,
 	NautilusWindow *window;
 	NautilusWindowSlot *active_slot;
 	NautilusView *view;
+	GtkWidget *focus_widget;
 	int i;
 
 	window = NAUTILUS_WINDOW (widget);
@@ -999,6 +1000,17 @@ nautilus_window_key_press_event (GtkWidget *widget,
 		}
 	}
 
+	focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
+	if (view != NULL && focus_widget != NULL &&
+	    GTK_IS_EDITABLE (focus_widget)) {
+		/* if we have input focus on a GtkEditable (e.g. a GtkEntry), forward
+		 * the event to it before activating accelerator bindings too.
+		 */
+		if (gtk_window_propagate_key_event (GTK_WINDOW (window), event)) {
+			return TRUE;
+		}
+	}
+
 	for (i = 0; i < G_N_ELEMENTS (extra_window_keybindings); i++) {
 		if (extra_window_keybindings[i].keyval == event->keyval) {
 			const GList *action_groups;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]