terminal: rename and redefine cursor keys mode and keypad keys mode

This commit is contained in:
Daniel Eklöf 2019-07-09 11:07:06 +02:00
parent d90ea88aa2
commit 9b5c044b29
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 10 additions and 10 deletions

4
csi.c
View file

@ -588,7 +588,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
for (size_t i = 0; i < term->vt.params.idx; i++) { for (size_t i = 0; i < term->vt.params.idx; i++) {
switch (term->vt.params.v[i].value) { switch (term->vt.params.v[i].value) {
case 1: case 1:
term->decckm = DECCKM_SS3; term->cursor_keys_mode = CURSOR_KEYS_APPLICATION;
break; break;
case 5: case 5:
@ -667,7 +667,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
for (size_t i = 0; i < term->vt.params.idx; i++) { for (size_t i = 0; i < term->vt.params.idx; i++) {
switch (term->vt.params.v[i].value) { switch (term->vt.params.v[i].value) {
case 1: case 1:
term->decckm = DECCKM_CSI; term->cursor_keys_mode = CURSOR_KEYS_NORMAL;
break; break;
case 5: case 5:

View file

@ -207,9 +207,9 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
sym, mods, consumed, significant, effective_mods); sym, mods, consumed, significant, effective_mods);
if (sym < sizeof(key_map) / sizeof(key_map[0]) && if (sym < sizeof(key_map) / sizeof(key_map[0]) &&
key_map[sym][term->decckm].normal != NULL) key_map[sym][term->cursor_keys_mode - 1].normal != NULL)
{ {
const struct keymap *key = &key_map[sym][term->decckm]; const struct keymap *key = &key_map[sym][term->cursor_keys_mode - 1];
const char *esc = NULL; const char *esc = NULL;
if (effective_mods == 0) if (effective_mods == 0)

4
main.c
View file

@ -294,8 +294,8 @@ main(int argc, char *const *argv)
struct terminal term = { struct terminal term = {
.quit = false, .quit = false,
.ptmx = posix_openpt(O_RDWR | O_NOCTTY), .ptmx = posix_openpt(O_RDWR | O_NOCTTY),
.decckm = DECCKM_CSI, .cursor_keys_mode = CURSOR_KEYS_NORMAL,
.keypad_mode = KEYPAD_NUMERICAL, /* TODO: verify */ .keypad_keys_mode = KEYPAD_NUMERICAL,
.auto_margin = true, .auto_margin = true,
.vt = { .vt = {
.state = 1, /* STATE_GROUND */ .state = 1, /* STATE_GROUND */

View file

@ -171,8 +171,8 @@ struct kbd {
bool ctrl; bool ctrl;
}; };
enum decckm { DECCKM_CSI, DECCKM_SS3 }; enum cursor_keys { CURSOR_KEYS_DONTCARE, CURSOR_KEYS_NORMAL, CURSOR_KEYS_APPLICATION};
enum keypad_mode { KEYPAD_NUMERICAL, KEYPAD_APPLICATION }; enum keypad_keys { KEYPAD_DONTCARE, KEYPAD_NUMERICAL, KEYPAD_APPLICATION };
enum charset { CHARSET_ASCII, CHARSET_GRAPHIC }; enum charset { CHARSET_ASCII, CHARSET_GRAPHIC };
/* *What* to report */ /* *What* to report */
@ -197,8 +197,8 @@ struct terminal {
int ptmx; int ptmx;
bool quit; bool quit;
enum decckm decckm; enum cursor_keys cursor_keys_mode;
enum keypad_mode keypad_mode; enum keypad_keys keypad_keys_mode;
bool reverse; bool reverse;
bool hide_cursor; bool hide_cursor;
bool auto_margin; bool auto_margin;