2007-05-21 18:00:19 +00:00
|
|
|
--- gdm-2.19.1/gui/greeter/greeter_item_ulist.c.a11y-fixes 2007-05-21 13:32:04.000000000 -0400
|
|
|
|
+++ gdm-2.19.1/gui/greeter/greeter_item_ulist.c 2007-05-21 13:32:04.000000000 -0400
|
|
|
|
@@ -236,17 +236,40 @@ greeter_populate_user_list (GtkTreeModel
|
|
|
|
void
|
2007-03-13 23:29:39 +00:00
|
|
|
greeter_item_ulist_select_user (gchar *login)
|
|
|
|
{
|
|
|
|
- printf ("%c%c%c%s\n", STX, BEL,
|
|
|
|
- GDM_INTERRUPT_SELECT_USER, login);
|
|
|
|
+ /*printf ("%c%c%c%s\n", STX, BEL,
|
|
|
|
+ GDM_INTERRUPT_SELECT_USER, login);*/
|
|
|
|
+ printf ("%c%s\n", STX, login);
|
|
|
|
|
|
|
|
fflush (stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+static GTimeVal last_key_press = {0, 0};
|
|
|
|
+static GTimeVal last_button_press = {0, 0};
|
|
|
|
+
|
|
|
|
static void
|
|
|
|
user_selected (GtkTreeSelection *selection, gpointer data)
|
|
|
|
{
|
|
|
|
GtkTreeModel *tm = NULL;
|
|
|
|
GtkTreeIter iter = {0};
|
|
|
|
+ gboolean is_button_press;
|
|
|
|
+ guint64 button_msec;
|
|
|
|
+ guint64 key_msec;
|
2007-05-21 18:00:19 +00:00
|
|
|
+
|
2007-03-13 23:29:39 +00:00
|
|
|
+ /* HACK: determine whether selection changed because of key or
|
|
|
|
+ * button press
|
|
|
|
+ *
|
|
|
|
+ * The rationale is this: if a face is pressed with the mouse
|
|
|
|
+ * we should start authenticating that user right away. But if
|
|
|
|
+ * the user uses keynav in the user list (think accessibility
|
|
|
|
+ * and blind users) we shouldn't.
|
|
|
|
+ */
|
|
|
|
+ button_msec = last_button_press.tv_sec * 1000 + last_button_press.tv_usec / 1000;
|
|
|
|
+ key_msec = last_key_press.tv_sec * 1000 + last_key_press.tv_usec / 1000;
|
|
|
|
+ is_button_press = FALSE;
|
|
|
|
+ if (button_msec > key_msec) {
|
|
|
|
+ is_button_press = TRUE;
|
|
|
|
+ }
|
2007-05-21 18:00:19 +00:00
|
|
|
|
2007-03-13 23:29:39 +00:00
|
|
|
if (gtk_tree_selection_get_selected (selection, &tm, &iter)) {
|
|
|
|
char *login;
|
2007-05-21 18:00:19 +00:00
|
|
|
@@ -255,14 +278,19 @@ user_selected (GtkTreeSelection *selecti
|
2007-03-13 23:29:39 +00:00
|
|
|
&login, -1);
|
|
|
|
if (login != NULL) {
|
|
|
|
if (selecting_user && greeter_probably_login_prompt) {
|
|
|
|
- gtk_entry_set_text (GTK_ENTRY (pam_entry), login);
|
|
|
|
+ if (is_button_press) {
|
|
|
|
+ gtk_entry_set_text (GTK_ENTRY (pam_entry), login);
|
|
|
|
+ } else {
|
|
|
|
+ gtk_entry_set_text (GTK_ENTRY (pam_entry), "");
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if (selecting_user) {
|
|
|
|
GreeterItemInfo *pamlabel = greeter_lookup_id ("pam-message");
|
|
|
|
if (pamlabel == NULL) {
|
|
|
|
gdm_common_warning ("Theme broken: must have pam-message label!");
|
|
|
|
}
|
|
|
|
- greeter_item_ulist_select_user (login);
|
|
|
|
+ if (is_button_press)
|
|
|
|
+ greeter_item_ulist_select_user (login);
|
|
|
|
if (selected_user != NULL)
|
|
|
|
g_free (selected_user);
|
|
|
|
selected_user = g_strdup (login);
|
2007-05-21 18:00:19 +00:00
|
|
|
@@ -272,9 +300,26 @@ user_selected (GtkTreeSelection *selecti
|
2007-03-13 23:29:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
-browser_change_focus (GtkWidget *widget, GdkEventButton *event, gpointer data)
|
|
|
|
+row_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data)
|
2007-05-21 18:00:19 +00:00
|
|
|
+{
|
2007-03-13 23:29:39 +00:00
|
|
|
+ if (selecting_user && greeter_probably_login_prompt) {
|
|
|
|
+ greeter_item_ulist_select_user (selected_user);
|
|
|
|
+ }
|
2007-05-21 18:00:19 +00:00
|
|
|
+}
|
|
|
|
+
|
2007-03-13 23:29:39 +00:00
|
|
|
+static gboolean
|
|
|
|
+tv_key_press (GtkWidget *entry, GdkEventKey *event, gpointer data)
|
2007-05-21 18:00:19 +00:00
|
|
|
{
|
|
|
|
- gtk_widget_grab_focus (pam_entry);
|
2007-03-13 23:29:39 +00:00
|
|
|
+ g_get_current_time (&last_key_press);
|
|
|
|
+ return FALSE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+static gboolean
|
|
|
|
+tv_button_press (GtkWidget *entry, GdkEventKey *event, gpointer data)
|
|
|
|
+{
|
|
|
|
+ g_get_current_time (&last_button_press);
|
|
|
|
+ return FALSE;
|
2007-05-21 18:00:19 +00:00
|
|
|
}
|
|
|
|
|
2007-03-13 23:29:39 +00:00
|
|
|
static void
|
2007-05-21 18:00:19 +00:00
|
|
|
@@ -285,6 +330,12 @@ greeter_generate_userlist (GtkWidget *tv
|
|
|
|
GtkTreeSelection *selection;
|
2007-03-13 23:29:39 +00:00
|
|
|
GList *list, *li;
|
|
|
|
|
|
|
|
+ AtkObject *atk_widget;
|
|
|
|
+ atk_widget = gtk_widget_get_accessible (tv);
|
|
|
|
+ if (atk_widget != NULL) {
|
|
|
|
+ atk_object_set_name (atk_widget, _("Select user to log in"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
gdm_greeter_users_init ();
|
|
|
|
|
|
|
|
check_for_displays ();
|
2007-05-21 18:00:19 +00:00
|
|
|
@@ -297,10 +348,13 @@ greeter_generate_userlist (GtkWidget *tv
|
2007-03-13 23:29:39 +00:00
|
|
|
g_signal_connect (selection, "changed",
|
|
|
|
G_CALLBACK (user_selected),
|
|
|
|
NULL);
|
|
|
|
-
|
|
|
|
- g_signal_connect (GTK_TREE_VIEW (tv), "button_release_event",
|
|
|
|
- G_CALLBACK (browser_change_focus),
|
|
|
|
+ g_signal_connect (G_OBJECT (tv), "row-activated",
|
|
|
|
+ G_CALLBACK (row_activated),
|
|
|
|
NULL);
|
|
|
|
+ g_signal_connect (G_OBJECT (tv), "key-press-event",
|
|
|
|
+ G_CALLBACK (tv_key_press), user_list);
|
|
|
|
+ g_signal_connect (G_OBJECT (tv), "button-press-event",
|
|
|
|
+ G_CALLBACK (tv_button_press), user_list);
|
|
|
|
|
|
|
|
tm = (GtkTreeModel *)gtk_list_store_new (4,
|
|
|
|
GDK_TYPE_PIXBUF,
|