Support number pad keys
This commit is contained in:
parent
01a343ed12
commit
8cc6a22737
1 changed files with 10 additions and 1 deletions
11
main.c
11
main.c
|
@ -504,8 +504,8 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
char buf[8];
|
char buf[8];
|
||||||
size_t len = strlen(state->text);
|
size_t len = strlen(state->text);
|
||||||
switch (sym) {
|
switch (sym) {
|
||||||
case XKB_KEY_KP_Enter:
|
|
||||||
case XKB_KEY_Return:
|
case XKB_KEY_Return:
|
||||||
|
case XKB_KEY_KP_Enter:
|
||||||
if (shift) {
|
if (shift) {
|
||||||
puts(state->text);
|
puts(state->text);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -521,6 +521,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Left:
|
case XKB_KEY_Left:
|
||||||
|
case XKB_KEY_KP_Left:
|
||||||
if (state->vertical) {
|
if (state->vertical) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -539,6 +540,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Right:
|
case XKB_KEY_Right:
|
||||||
|
case XKB_KEY_KP_Right:
|
||||||
if (state->vertical) {
|
if (state->vertical) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -558,6 +560,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Up:
|
case XKB_KEY_Up:
|
||||||
|
case XKB_KEY_KP_Up:
|
||||||
if (!state->vertical) {
|
if (!state->vertical) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -576,6 +579,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Down:
|
case XKB_KEY_Down:
|
||||||
|
case XKB_KEY_KP_Down:
|
||||||
if (!state->vertical) {
|
if (!state->vertical) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -595,6 +599,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Page_Up:
|
case XKB_KEY_Page_Up:
|
||||||
|
case XKB_KEY_KP_Page_Up:
|
||||||
if (state->leftmost && state->leftmost->left) {
|
if (state->leftmost && state->leftmost->left) {
|
||||||
state->rightmost = state->leftmost->left;
|
state->rightmost = state->leftmost->left;
|
||||||
state->leftmost = NULL;
|
state->leftmost = NULL;
|
||||||
|
@ -604,6 +609,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Page_Down:
|
case XKB_KEY_Page_Down:
|
||||||
|
case XKB_KEY_KP_Page_Down:
|
||||||
if (state->rightmost && state->rightmost->right) {
|
if (state->rightmost && state->rightmost->right) {
|
||||||
state->leftmost = state->rightmost->right;
|
state->leftmost = state->rightmost->right;
|
||||||
state->rightmost = NULL;
|
state->rightmost = NULL;
|
||||||
|
@ -613,6 +619,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Home:
|
case XKB_KEY_Home:
|
||||||
|
case XKB_KEY_KP_Home:
|
||||||
if (state->selection == state->matches) {
|
if (state->selection == state->matches) {
|
||||||
if (state->cursor != 0) {
|
if (state->cursor != 0) {
|
||||||
state->cursor = 0;
|
state->cursor = 0;
|
||||||
|
@ -627,6 +634,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_End:
|
case XKB_KEY_End:
|
||||||
|
case XKB_KEY_KP_End:
|
||||||
if (state->cursor < len) {
|
if (state->cursor < len) {
|
||||||
state->cursor = len;
|
state->cursor = len;
|
||||||
render_frame(state);
|
render_frame(state);
|
||||||
|
@ -650,6 +658,7 @@ void keypress(struct menu_state *state, enum wl_keyboard_key_state key_state,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XKB_KEY_Delete:
|
case XKB_KEY_Delete:
|
||||||
|
case XKB_KEY_KP_Delete:
|
||||||
if (state->cursor == len) {
|
if (state->cursor == len) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue