gdm r6141 - in trunk: . gui/simple-greeter



Author: halfline
Date: Fri Apr 11 07:18:18 2008
New Revision: 6141
URL: http://svn.gnome.org/viewvc/gdm?rev=6141&view=rev

Log:
2008-04-11  Ray Strode <rstrode redhat com>

	* gui/simple-greeter/gdm-chooser-widget.c
	(gdm_chooser_widget_grab_focus), (gdm_chooser_widget_focus),
	(gdm_chooser_widget_focus_in_event),
	(gdm_chooser_widget_class_init):
	Redo focus handling so that tabing out of the list works


Modified:
   trunk/ChangeLog
   trunk/gui/simple-greeter/gdm-chooser-widget.c

Modified: trunk/gui/simple-greeter/gdm-chooser-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-chooser-widget.c	(original)
+++ trunk/gui/simple-greeter/gdm-chooser-widget.c	Fri Apr 11 07:18:18 2008
@@ -965,10 +965,36 @@
         }
 }
 
-static void
-gdm_chooser_widget_grab_focus (GtkWidget *widget)
+static gboolean
+gdm_chooser_widget_focus (GtkWidget        *widget,
+                          GtkDirectionType  direction)
 {
+        /* Since we only have one focusable child (the tree view),
+         * no matter which direction we're going the rules are the
+         * same:
+         *
+         *    1) if it's aready got focus, return FALSE to surrender
+         *    that focus.
+         *    2) if it doesn't already have focus, then grab it
+         */
+        if (GTK_CONTAINER (widget)->focus_child != NULL) {
+                return FALSE;
+        }
+
         gtk_widget_grab_focus (GDM_CHOOSER_WIDGET (widget)->priv->items_view);
+        return TRUE;
+}
+
+static gboolean
+gdm_chooser_widget_focus_in_event (GtkWidget     *widget,
+                                   GdkEventFocus *focus_event)
+{
+        /* We don't ever want the chooser widget itself to have focus.
+         * Focus should always go to the tree view.
+         */
+        gtk_widget_grab_focus (GDM_CHOOSER_WIDGET (widget)->priv->items_view);
+
+        return FALSE;
 }
 
 static void
@@ -984,7 +1010,8 @@
         widget_class->size_allocate = gdm_chooser_widget_size_allocate;
         widget_class->hide = gdm_chooser_widget_hide;
         widget_class->show = gdm_chooser_widget_show;
-        widget_class->grab_focus = gdm_chooser_widget_grab_focus;
+        widget_class->focus = gdm_chooser_widget_focus;
+        widget_class->focus_in_event = gdm_chooser_widget_focus_in_event;
 
         signals [ACTIVATED] = g_signal_new ("activated",
                                             G_TYPE_FROM_CLASS (object_class),



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