ref: 99ca11bf8b255bb75721f95d900064490ce18356
parent: cc7024b43367b959ec0ab2b6a225623c5d29bb8b
author: Jacob Nevins <[email protected]>
date: Sun Mar 1 08:51:32 EST 2009
Make menus accessible from the keyboard in the Gtk front-end. [originally from svn r8486]
--- a/gtk.c
+++ b/gtk.c
@@ -546,6 +546,10 @@
return TRUE;
#endif
+ /* Handle mnemonics. */
+ if (gtk_window_activate_key(GTK_WINDOW(fe->window), event))
+ return TRUE;
+
if (event->keyval == GDK_Up)
keyval = shift | ctrl | CURSOR_UP;
else if (event->keyval == GDK_KP_Up || event->keyval == GDK_KP_8)
@@ -1675,7 +1679,7 @@
gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0);
gtk_widget_show(menubar);
- menuitem = gtk_menu_item_new_with_label("Game");
+ menuitem = gtk_menu_item_new_with_mnemonic("_Game");
gtk_container_add(GTK_CONTAINER(menubar), menuitem);
gtk_widget_show(menuitem);
@@ -1710,7 +1714,7 @@
GtkWidget *submenu;
int i;
- menuitem = gtk_menu_item_new_with_label("Type");
+ menuitem = gtk_menu_item_new_with_mnemonic("_Type");
gtk_container_add(GTK_CONTAINER(menubar), menuitem);
gtk_widget_show(menuitem);
@@ -1790,7 +1794,7 @@
add_menu_separator(GTK_CONTAINER(menu));
add_menu_item_with_key(fe, GTK_CONTAINER(menu), "Exit", 'q');
- menuitem = gtk_menu_item_new_with_label("Help");
+ menuitem = gtk_menu_item_new_with_mnemonic("_Help");
gtk_container_add(GTK_CONTAINER(menubar), menuitem);
gtk_widget_show(menuitem);