9menu / debian / patches / 05_morekeys.diff

Description: Add more keys, especially Keypad Enter
Forwarded: yes
Author: Andrew Stribblehill <ads@debian.org>
Origin: vendor
Last-Update: 2009-04-24

--- a/9menu.c
+++ b/9menu.c
@@ -124,6 +124,14 @@
 #define CONFIG_MENU_UP_KEY  XK_Up
 #define CONFIG_MENU_DOWN_KEY    XK_Down
 #define CONFIG_MENU_SELECT_KEY  XK_Return
+#define CONFIG_MENU_VI_UP_KEY  XK_k
+#define CONFIG_MENU_VI_DOWN_KEY  XK_j
+#define CONFIG_MENU_EMACS_UP_KEY  XK_p
+#define CONFIG_MENU_EMACS_DOWN_KEY  XK_n
+#define CONFIG_MENU_ALTERNATE_UP_KEY  XK_KP_Up
+#define CONFIG_MENU_ALTERNATE_DOWN_KEY  XK_KP_Down
+#define CONFIG_MENU_ALTERNATE_SELECT_KEY  XK_KP_Enter
+#define CONFIG_MENU_ABORT_KEY XK_Escape
 
 char *progname;		/* my name */
 char *displayname;	/* X display */
@@ -573,13 +581,21 @@
 			key = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);	
 			if (key != CONFIG_MENU_UP_KEY
 			    && key != CONFIG_MENU_DOWN_KEY
-			    && key != CONFIG_MENU_SELECT_KEY)
+			    && key != CONFIG_MENU_SELECT_KEY
+			    && key != CONFIG_MENU_ALTERNATE_DOWN_KEY
+			    && key != CONFIG_MENU_ALTERNATE_UP_KEY
+			    && key != CONFIG_MENU_ALTERNATE_SELECT_KEY
+			    && key != CONFIG_MENU_EMACS_DOWN_KEY
+			    && key != CONFIG_MENU_EMACS_UP_KEY
+			    && key != CONFIG_MENU_VI_DOWN_KEY
+			    && key != CONFIG_MENU_VI_UP_KEY
+			    && key != CONFIG_MENU_ABORT_KEY)
 				break;
 
-			if (key == CONFIG_MENU_UP_KEY) {
+			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_EMACS_UP_KEY || key == CONFIG_MENU_VI_UP_KEY || key == CONFIG_MENU_ALTERNATE_UP_KEY) {
 				old = cur;
 				cur--;
-			} else if (key == CONFIG_MENU_DOWN_KEY) {
+			} else if (key == CONFIG_MENU_DOWN_KEY || key == CONFIG_MENU_EMACS_DOWN_KEY || key == CONFIG_MENU_VI_DOWN_KEY || key == CONFIG_MENU_ALTERNATE_DOWN_KEY) {
 				old = cur;
 				cur++;
 			}
@@ -589,7 +605,10 @@
 		
 			cur %= numitems;
 
-			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY) {
+			if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY
+			    || key == CONFIG_MENU_EMACS_UP_KEY || key == CONFIG_MENU_EMACS_DOWN_KEY
+			    || key == CONFIG_MENU_VI_UP_KEY || key == CONFIG_MENU_VI_DOWN_KEY
+			    || key == CONFIG_MENU_ALTERNATE_UP_KEY || key == CONFIG_MENU_ALTERNATE_DOWN_KEY) {
 				if (cur == old)
 					break;
 				if (old >= 0 && old < numitems && cur != -1)
@@ -601,7 +620,13 @@
 
 			if (warp)
 				restoremouse();
-			if (key == CONFIG_MENU_SELECT_KEY) {
+			if (key == CONFIG_MENU_ABORT_KEY) {
+				if (commands[cur] != labels[cur]) {
+					spawn(commands[cur]);
+				}
+				return;
+			}
+			if (key == CONFIG_MENU_SELECT_KEY || key == CONFIG_MENU_ALTERNATE_SELECT_KEY) {
 				if (strcmp(labels[cur], "exit") == 0) {
 					if (commands[cur] != labels[cur]) {
 						spawn(commands[cur]);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.