[nautilus] Revert "Don't grab focus on realize"



commit 95ae539e8d042b04ee9c6817bcc41f551ab207fc
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Mar 3 09:49:58 2010 +0100

    Revert "Don't grab focus on realize"
    
    This reverts commit 4efd42312584b46f248e2839582a87776a7baebe.
    
    We now don't store the extra view visible status, so the problem this
    change fixed is gone. And this change caused other focus issues, as
    per bug 607060.

 libnautilus-private/nautilus-icon-container.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index ae58a49..03af3a9 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -4131,6 +4131,7 @@ size_allocate (GtkWidget *widget,
 static void
 realize (GtkWidget *widget)
 {
+	GtkWindow *window;
 	GdkBitmap *stipple;
 	GtkAdjustment *vadj, *hadj;
 	NautilusIconContainer *container;
@@ -4150,6 +4151,11 @@ realize (GtkWidget *widget)
 
 	setup_label_gcs (container);
 
+ 	/* make us the focused widget */
+ 	g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget)));
+	window = GTK_WINDOW (gtk_widget_get_toplevel (widget));
+	gtk_window_set_focus (window, widget);
+
 	stipple = eel_stipple_bitmap_for_screen (
 			gdk_drawable_get_screen (GDK_DRAWABLE (widget->window)));
 
@@ -4169,10 +4175,15 @@ static void
 unrealize (GtkWidget *widget)
 {
 	int i;
+	GtkWindow *window;
 	NautilusIconContainer *container;
 
 	container = NAUTILUS_ICON_CONTAINER (widget);
 
+        g_assert (GTK_IS_WINDOW (gtk_widget_get_toplevel (widget)));
+        window = GTK_WINDOW (gtk_widget_get_toplevel (widget));
+	gtk_window_set_focus (window, NULL);
+
 	for (i = 0; i < LAST_LABEL_COLOR; i++) {
 		if (container->details->label_gcs [i]) {
 			g_object_unref (container->details->label_gcs [i]);



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