mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 12:05:48 +00:00
add support for more keypad keys
The keypad Enter key was already supported. On some keyboard layouts like my laptop the page-up and page-down key is more comfortable to use. This adds a few lines but no complexity. Ref. https://git.suckless.org/dmenu/commit/cd2133a5f66b42f992a9a1b92bbbce11dc26b941.html
This commit is contained in:
parent
3516ea6e65
commit
6f8e43ac08
11
dmenu.c
11
dmenu.c
@ -995,9 +995,11 @@ keypress(XKeyEvent *ev)
|
||||
utf8, utf8, win, CurrentTime);
|
||||
return;
|
||||
case XK_Left:
|
||||
case XK_KP_Left:
|
||||
movewordedge(-1);
|
||||
goto draw;
|
||||
case XK_Right:
|
||||
case XK_KP_Right:
|
||||
movewordedge(+1);
|
||||
goto draw;
|
||||
case XK_Return:
|
||||
@ -1048,6 +1050,7 @@ insert:
|
||||
insert(buf, len);
|
||||
break;
|
||||
case XK_Delete:
|
||||
case XK_KP_Delete:
|
||||
if (text[cursor] == '\0')
|
||||
return;
|
||||
cursor = nextrune(+1);
|
||||
@ -1058,6 +1061,7 @@ insert:
|
||||
insert(NULL, nextrune(-1) - cursor);
|
||||
break;
|
||||
case XK_End:
|
||||
case XK_KP_End:
|
||||
if (text[cursor] != '\0') {
|
||||
cursor = strlen(text);
|
||||
break;
|
||||
@ -1077,6 +1081,7 @@ insert:
|
||||
cleanup();
|
||||
exit(1);
|
||||
case XK_Home:
|
||||
case XK_KP_Home:
|
||||
if (sel == matches) {
|
||||
cursor = 0;
|
||||
break;
|
||||
@ -1085,6 +1090,7 @@ insert:
|
||||
calcoffsets();
|
||||
break;
|
||||
case XK_Left:
|
||||
case XK_KP_Left:
|
||||
#if GRID_PATCH && GRIDNAV_PATCH
|
||||
if (columns > 1) {
|
||||
if (!sel)
|
||||
@ -1113,18 +1119,21 @@ insert:
|
||||
return;
|
||||
/* fallthrough */
|
||||
case XK_Up:
|
||||
case XK_KP_Up:
|
||||
if (sel && sel->left && (sel = sel->left)->right == curr) {
|
||||
curr = prev;
|
||||
calcoffsets();
|
||||
}
|
||||
break;
|
||||
case XK_Next:
|
||||
case XK_KP_Next:
|
||||
if (!next)
|
||||
return;
|
||||
sel = curr = next;
|
||||
calcoffsets();
|
||||
break;
|
||||
case XK_Prior:
|
||||
case XK_KP_Prior:
|
||||
if (!prev)
|
||||
return;
|
||||
sel = curr = prev;
|
||||
@ -1202,6 +1211,7 @@ insert:
|
||||
#endif // MULTI_SELECTION_PATCH
|
||||
break;
|
||||
case XK_Right:
|
||||
case XK_KP_Right:
|
||||
#if GRID_PATCH && GRIDNAV_PATCH
|
||||
if (columns > 1) {
|
||||
if (!sel)
|
||||
@ -1230,6 +1240,7 @@ insert:
|
||||
return;
|
||||
/* fallthrough */
|
||||
case XK_Down:
|
||||
case XK_KP_Down:
|
||||
if (sel && sel->right && (sel = sel->right) == next) {
|
||||
curr = next;
|
||||
calcoffsets();
|
||||
|
Loading…
x
Reference in New Issue
Block a user