diff console/libgnt/gntmenu.c @ 14876:70623f0d5cdc

[gaim-migrate @ 17645] Use terminfo/termcap information (from ncurses) as much as possible. There still need to be some manual 'refinement' based on $TERM. I'll see if I can get rid of those. Also, I am probably going to allow users to provide information that terminfo can't provide, like the keycode for ctrl+up etc. Let me know if any of the keybinding doesn't work. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 01 Nov 2006 03:38:23 +0000
parents b1650510f4b8
children 065e7ac30338
line wrap: on
line diff
--- a/console/libgnt/gntmenu.c	Wed Nov 01 02:13:37 2006 +0000
+++ b/console/libgnt/gntmenu.c	Wed Nov 01 03:38:23 2006 +0000
@@ -148,17 +148,15 @@
 	}
 
 	if (menu->type == GNT_MENU_TOPLEVEL) {
-		if (text[0] == 27) {
-			if (strcmp(text + 1, GNT_KEY_LEFT) == 0) {
-				menu->selected--;
-				if (menu->selected < 0)
-					menu->selected = g_list_length(menu->list) - 1;
-			} else if (strcmp(text + 1, GNT_KEY_RIGHT) == 0) {
-				menu->selected++;
-				if (menu->selected >= g_list_length(menu->list))
-					menu->selected = 0;
-			}
-		} else if (text[0] == '\r' && text[1] == 0) {
+		if (strcmp(text, GNT_KEY_LEFT) == 0) {
+			menu->selected--;
+			if (menu->selected < 0)
+				menu->selected = g_list_length(menu->list) - 1;
+		} else if (strcmp(text, GNT_KEY_RIGHT) == 0) {
+			menu->selected++;
+			if (menu->selected >= g_list_length(menu->list))
+				menu->selected = 0;
+		} else if (strcmp(text, GNT_KEY_ENTER) == 0) {
 			gnt_widget_activate(widget);
 		}