瀏覽代碼

Support for 1-9 numbers to select specific item

master
RisingThumb malod219 4 年之前
父節點
當前提交
2b0484b11c
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. +1
    -1
      xmenu.1
  2. +8
    -1
      xmenu.c

+ 1
- 1
xmenu.1 查看文件

@@ -96,7 +96,7 @@ but can also be controlled by the keyboard.
Items can be selected using the arrow keys, Items can be selected using the arrow keys,
Tab (with and without Shift), Tab (with and without Shift),
Home, End, Home, End,
Enter and Esc. Enter and Esc, and 1-9 keys.
.TP .TP
.BR Home .BR Home
Select the first item in the menu. Select the first item in the menu.


+ 8
- 1
xmenu.c 查看文件

@@ -1280,7 +1280,14 @@ selectitem:
item = itemcycle(currmenu, ITEMPREV); item = itemcycle(currmenu, ITEMPREV);
} else if (ksym == XK_Tab || ksym == XK_Down || ksym == KSYMDOWN) { } else if (ksym == XK_Tab || ksym == XK_Down || ksym == KSYMDOWN) {
item = itemcycle(currmenu, ITEMNEXT); item = itemcycle(currmenu, ITEMNEXT);
} else if ((ksym == XK_Return || ksym == XK_Right || ksym == KSYMRIGHT) && } else if (ksym >= XK_1 && ksym <= XK_9){
item = itemcycle(currmenu, ITEMFIRST);
currmenu->selected = item;
for(int i = ksym-XK_1; i > 0; i-=1){
item = itemcycle(currmenu, ITEMNEXT);
currmenu->selected = item;
}
} else if ((ksym == XK_Return || ksym == XK_Right || ksym == KSYMRIGHT) &&
currmenu->selected != NULL) { currmenu->selected != NULL) {
item = currmenu->selected; item = currmenu->selected;
goto selectitem; goto selectitem;


||||||
x
 
000:0
Loading…
取消
儲存