Two patches vs. beta4...



Attached are two patches.  The first causes gdm to grab focus of the X display 
so that the mouse doesn't have to be in the gdm window to be able to type
into the login window.

The second adds accelerators for all the menus, with alt+first letter, and
alt+y for the system menu, as well as an ESCape binding to pull down the
Session menu.  This allows gdm to be used without a mouse.

The keyboard still doesn't work with the browser enabled, but I haven't
had time to look into that.
 
-- 
Ryan Murray, (rmurray cyberhqz com, rmurray debian org, rmurray stormix com)
Programmer, Stormix Technologies Inc., Debian Developer
The opinions expressed here are my own.
diff -ruN gdm-2.0beta4.orig/gui/gdmlogin.c gdm-2.0beta4/gui/gdmlogin.c
--- gdm-2.0beta4.orig/gui/gdmlogin.c	Tue Jun  6 08:33:48 2000
+++ gdm-2.0beta4/gui/gdmlogin.c	Tue Jun  6 08:33:03 2000
@@ -112,6 +112,7 @@
     if (event->type == GDK_2BUTTON_PRESS) {
 	gtk_widget_destroy (GTK_WIDGET (win));
 	gdk_window_show (login->window);
+	XSetInputFocus(GDK_DISPLAY(), GDK_WINDOW_XWINDOW (login->window), RevertToNone, CurrentTime);
 	return;
     }
     
@@ -816,7 +817,7 @@
 	gtk_entry_set_text (GTK_ENTRY (entry), "");
 	gtk_entry_set_visibility (GTK_ENTRY (entry), TRUE);
 	gtk_widget_set_sensitive (GTK_WIDGET (entry), TRUE);
-	gtk_widget_grab_focus (GTK_WIDGET (entry));	
+	gtk_window_set_focus (GTK_WINDOW (login), entry);	
 	gtk_widget_show (GTK_WIDGET (entry));
 	if ( !curuser && GdmBrowser ) {
 	    /*
@@ -843,7 +844,7 @@
 	gtk_entry_set_text (GTK_ENTRY (entry), "");
 	gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
 	gtk_widget_set_sensitive (GTK_WIDGET (entry), TRUE);
-	gtk_widget_grab_focus (GTK_WIDGET (entry));	
+	gtk_window_set_focus (GTK_WINDOW (login), entry);	
 	gtk_widget_show (GTK_WIDGET (entry));
 	break;
 
@@ -1310,12 +1325,12 @@
 			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
     
-    gtk_widget_grab_focus (GTK_WIDGET (entry));	
     gtk_window_set_focus (GTK_WINDOW (login), entry);	
     gtk_window_set_policy (GTK_WINDOW (login), 1, 1, 1);
     gtk_window_position (GTK_WINDOW (login), GTK_WIN_POS_CENTER);
 
     gtk_widget_show_all (GTK_WIDGET (login));
+    XSetInputFocus(GDK_DISPLAY(), GDK_WINDOW_XWINDOW (login->window), RevertToNone, CurrentTime);
 }
 
 
diff -ruN gdm-2.0beta4.orig/gui/gdmlogin.c gdm-2.0beta4/gui/gdmlogin.c
--- gdm-2.0beta4.orig/gui/gdmlogin.c	Tue Jun  6 08:57:59 2000
+++ gdm-2.0beta4/gui/gdmlogin.c	Tue Jun  6 08:51:39 2000
@@ -1014,6 +1014,7 @@
     GtkWidget *bbox = NULL;
     GtkWidget *logoframe = NULL;
     GtkStyle *style;
+    GtkAccelGroup *accel;
     gchar *greeting;
     gint cols, rows;
     struct stat statbuf;
@@ -1029,6 +1030,9 @@
 			      (GtkDestroyNotify) gtk_widget_unref);
     gtk_window_set_title (GTK_WINDOW (login), "GDM Login");
 
+    accel = gtk_accel_group_new();
+    gtk_window_add_accel_group(login, accel);
+
     frame1 = gtk_frame_new (NULL);
     gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_OUT);
     gtk_container_border_width (GTK_CONTAINER (frame1), 0);
@@ -1063,6 +1067,10 @@
     sessmenu = gtk_menu_item_new_with_label (_("Session"));
     gtk_menu_bar_append (GTK_MENU_BAR(menubar), sessmenu);
     gtk_menu_item_set_submenu (GTK_MENU_ITEM (sessmenu), menu);
+    gtk_widget_add_accelerator( sessmenu, "activate_item", accel,
+	GDK_Escape, 0, 0);
+    gtk_widget_add_accelerator( sessmenu, "activate_item", accel,
+	GDK_s, GDK_MOD1_MASK, 0);
     gtk_widget_show (GTK_WIDGET (sessmenu));
 
     menu = gtk_menu_new();
@@ -1070,6 +1078,8 @@
     langmenu = gtk_menu_item_new_with_label (_("Language"));
     gtk_menu_bar_append (GTK_MENU_BAR (menubar), langmenu);
     gtk_menu_item_set_submenu (GTK_MENU_ITEM (langmenu), menu);
+    gtk_widget_add_accelerator( langmenu, "activate_item", accel,
+	GDK_l, GDK_MOD1_MASK, 0);
     gtk_widget_show (GTK_WIDGET (langmenu));
 
     if (GdmSystemMenu) {
@@ -1091,6 +1101,8 @@
 	item = gtk_menu_item_new_with_label (_("System"));
 	gtk_menu_bar_append (GTK_MENU_BAR (menubar), item);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
+	gtk_widget_add_accelerator( item, "activate_item", accel,
+	    GDK_y, GDK_MOD1_MASK, 0);
 	gtk_widget_show (GTK_WIDGET (item));
     }
 
@@ -1104,6 +1116,8 @@
 	    gtk_signal_connect (GTK_OBJECT (item), "activate",
 			       GTK_SIGNAL_FUNC (gdm_login_iconify_handler), 
 				NULL);
+	    gtk_widget_add_accelerator( langmenu, "activate_item", accel,
+		GDK_i, GDK_MOD1_MASK, 0);
 	    gtk_widget_show (GTK_WIDGET (item));
 	}
     }

Attachment: pgpvWZnnEEP1p.pgp
Description: PGP signature



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