From 9dff1243fc286f21f2fb8456653f336959d80143 Mon Sep 17 00:00:00 2001 From: corentin-soriano Date: Mon, 15 Apr 2024 17:50:30 +0200 Subject: [PATCH 1/2] GUACAMOLE-1943: Add ctrl+arrows/backspace/del and shift+up/down/home/end keyboard shortcuts. --- src/terminal/terminal.c | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 7e52a4b91..96cb6a5dc 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1460,9 +1460,21 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed if ((keysym == 'C' && term->mod_ctrl) || (keysym == 'c' && term->mod_meta)) return 0; - /* Shift+PgUp / Shift+PgDown shortcuts for scrolling */ + /* Shortcuts for scrolling history with shift */ if (term->mod_shift) { + /* Home */ + if (keysym == 0xFF50 || keysym == 0xFF95) { + guac_terminal_scroll_display_up(term, term->max_scrollback); + return 0; + } + + /* End */ + if (keysym == 0xFF57 || keysym == 0xFF9C) { + guac_terminal_scroll_display_down(term, term->max_scrollback); + return 0; + } + /* Page up */ if (keysym == 0xFF55) { guac_terminal_scroll_display_up(term, term->term_height); @@ -1475,6 +1487,18 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed return 0; } + /* Up */ + if (keysym == 0xFF52 || keysym == 0xFF97) { + guac_terminal_scroll_display_up(term, 1); + return 0; + } + + /* Down */ + if (keysym == 0xFF54 || keysym == 0xFF99) { + guac_terminal_scroll_display_down(term, 1); + return 0; + } + } /* Reset scroll */ @@ -1510,6 +1534,22 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed else if (keysym >= '3' && keysym <= '7') data = (char) (keysym - '3' + 0x1B); + /* CTRL+Left: return to previous word */ + else if (keysym == 0xFF51 || keysym == 0xFF96) + return guac_terminal_send_string(term, "\033[1;5D"); + + /* CTRL+Right: go to next word */ + else if (keysym == 0xFF53 || keysym == 0xFF98) + return guac_terminal_send_string(term, "\033[1;5C"); + + /* CTRL+Backspace: remove word (map to CTRL+w) */ + else if (keysym == 0xFF08) + data = (char) 23; + + /* CTRL+Supr: remove word to right */ + else if (keysym == 0xFFFF) + return guac_terminal_send_string(term, "\033D"); + /* Otherwise ignore */ else return 0; From 0813e9389617a137c4578deec889cfd48429a2fd Mon Sep 17 00:00:00 2001 From: corentin-soriano Date: Mon, 17 Jun 2024 12:00:34 +0200 Subject: [PATCH 2/2] GUACAMOLE-287: Add constants for "magic numbers" in function __guac_terminal_send_key. --- src/terminal/terminal.c | 177 +++++++++---- src/terminal/terminal/terminal.h | 410 +++++++++++++++++++++++++++++++ 2 files changed, 539 insertions(+), 48 deletions(-) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 96cb6a5dc..ae405694d 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1435,13 +1435,13 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed } /* Track modifiers */ - if (keysym == 0xFFE3 || keysym == 0xFFE4) + if (keysym == GUAC_TERMINAL_KEY_CTRL_L || keysym == GUAC_TERMINAL_KEY_CTRL_R) term->mod_ctrl = pressed; - else if (keysym == 0xFFE7 || keysym == 0xFFE8) + else if (keysym == GUAC_TERMINAL_KEY_META_L || keysym == GUAC_TERMINAL_KEY_META_R) term->mod_meta = pressed; - else if (keysym == 0xFFE9 || keysym == 0xFFEA) + else if (keysym == GUAC_TERMINAL_KEY_ALT_L || keysym == GUAC_TERMINAL_KEY_ALT_R) term->mod_alt = pressed; - else if (keysym == 0xFFE1 || keysym == 0xFFE2) + else if (keysym == GUAC_TERMINAL_KEY_SHIFT_L || keysym == GUAC_TERMINAL_KEY_SHIFT_R) term->mod_shift = pressed; /* If key pressed */ @@ -1464,37 +1464,37 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed if (term->mod_shift) { /* Home */ - if (keysym == 0xFF50 || keysym == 0xFF95) { + if (keysym == GUAC_TERMINAL_KEY_HOME || keysym == GUAC_TERMINAL_KEY_KP_HOME) { guac_terminal_scroll_display_up(term, term->max_scrollback); return 0; } /* End */ - if (keysym == 0xFF57 || keysym == 0xFF9C) { + if (keysym == GUAC_TERMINAL_KEY_END || keysym == GUAC_TERMINAL_KEY_KP_END) { guac_terminal_scroll_display_down(term, term->max_scrollback); return 0; } /* Page up */ - if (keysym == 0xFF55) { + if (keysym == GUAC_TERMINAL_KEY_PAGEUP || keysym == GUAC_TERMINAL_KEY_KP_PAGEUP) { guac_terminal_scroll_display_up(term, term->term_height); return 0; } /* Page down */ - if (keysym == 0xFF56) { + if (keysym == GUAC_TERMINAL_KEY_PAGEDOWN || keysym == GUAC_TERMINAL_KEY_KP_PAGEDOWN) { guac_terminal_scroll_display_down(term, term->term_height); return 0; } /* Up */ - if (keysym == 0xFF52 || keysym == 0xFF97) { + if (keysym == GUAC_TERMINAL_KEY_UP || keysym == GUAC_TERMINAL_KEY_KP_UP) { guac_terminal_scroll_display_up(term, 1); return 0; } /* Down */ - if (keysym == 0xFF54 || keysym == 0xFF99) { + if (keysym == GUAC_TERMINAL_KEY_DOWN || keysym == GUAC_TERMINAL_KEY_KP_DOWN) { guac_terminal_scroll_display_down(term, 1); return 0; } @@ -1507,7 +1507,7 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed /* If alt being held, also send escape character */ if (term->mod_alt) - guac_terminal_send_string(term, "\x1B"); + guac_terminal_send_string(term, GUAC_TERMINAL_ASCII_ESCAPE); /* Translate Ctrl+letter to control code */ if (term->mod_ctrl) { @@ -1535,20 +1535,20 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed data = (char) (keysym - '3' + 0x1B); /* CTRL+Left: return to previous word */ - else if (keysym == 0xFF51 || keysym == 0xFF96) - return guac_terminal_send_string(term, "\033[1;5D"); + else if (keysym == GUAC_TERMINAL_KEY_LEFT || keysym == GUAC_TERMINAL_KEY_KP_LEFT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_PREV_WORD); /* CTRL+Right: go to next word */ - else if (keysym == 0xFF53 || keysym == 0xFF98) - return guac_terminal_send_string(term, "\033[1;5C"); + else if (keysym == GUAC_TERMINAL_KEY_RIGHT || keysym == GUAC_TERMINAL_KEY_KP_RIGHT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_NEXT_WORD); /* CTRL+Backspace: remove word (map to CTRL+w) */ - else if (keysym == 0xFF08) + else if (keysym == GUAC_TERMINAL_KEY_BACKSPACE) data = (char) 23; /* CTRL+Supr: remove word to right */ - else if (keysym == 0xFFFF) - return guac_terminal_send_string(term, "\033D"); + else if (keysym == GUAC_TERMINAL_KEY_DELETE || keysym == GUAC_TERMINAL_KEY_KP_DELETE) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_DELETE_WORD); /* Otherwise ignore */ else @@ -1579,51 +1579,132 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed else { /* Backspace can vary based on configuration of terminal by client. */ - if (keysym == 0xFF08) { + if (keysym == GUAC_TERMINAL_KEY_BACKSPACE) { char backspace_str[] = { term->backspace, '\0' }; return guac_terminal_send_string(term, backspace_str); } - if (keysym == 0xFF09 || keysym == 0xFF89) return guac_terminal_send_string(term, "\x09"); /* Tab */ - if (keysym == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */ - if (keysym == 0xFF1B) return guac_terminal_send_string(term, "\x1B"); /* Esc */ - if (keysym == 0xFF50 || keysym == 0xFF95) return guac_terminal_send_string(term, "\x1B[1~"); /* Home */ + /* Tab */ + if (keysym == GUAC_TERMINAL_KEY_TAB || keysym == GUAC_TERMINAL_KEY_KP_TAB) + return guac_terminal_send_string(term, GUAC_TERMINAL_ASCII_TAB); + + /* Enter */ + if (keysym == GUAC_TERMINAL_KEY_ENTER || keysym == GUAC_TERMINAL_KEY_KP_ENTER) + return guac_terminal_send_string(term, GUAC_TERMINAL_ASCII_CR); + + /* Esc */ + if (keysym == GUAC_TERMINAL_KEY_ESCAPE) + return guac_terminal_send_string(term, GUAC_TERMINAL_ASCII_ESCAPE); + + /* Home */ + if (keysym == GUAC_TERMINAL_KEY_HOME || keysym == GUAC_TERMINAL_KEY_KP_HOME) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_HOME); /* Arrow keys w/ application cursor */ if (term->application_cursor_keys) { - if (keysym == 0xFF51 || keysym == 0xFF96) return guac_terminal_send_string(term, "\x1BOD"); /* Left */ - if (keysym == 0xFF52 || keysym == 0xFF97) return guac_terminal_send_string(term, "\x1BOA"); /* Up */ - if (keysym == 0xFF53 || keysym == 0xFF98) return guac_terminal_send_string(term, "\x1BOC"); /* Right */ - if (keysym == 0xFF54 || keysym == 0xFF99) return guac_terminal_send_string(term, "\x1BOB"); /* Down */ + + /* Left */ + if (keysym == GUAC_TERMINAL_KEY_LEFT || keysym == GUAC_TERMINAL_KEY_KP_LEFT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_LEFT); + + /* Up */ + if (keysym == GUAC_TERMINAL_KEY_UP || keysym == GUAC_TERMINAL_KEY_KP_UP) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_UP); + + /* Right */ + if (keysym == GUAC_TERMINAL_KEY_RIGHT || keysym == GUAC_TERMINAL_KEY_KP_RIGHT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_RIGHT); + + /* Down */ + if (keysym == GUAC_TERMINAL_KEY_DOWN || keysym == GUAC_TERMINAL_KEY_KP_DOWN) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_DOWN); } else { - if (keysym == 0xFF51 || keysym == 0xFF96) return guac_terminal_send_string(term, "\x1B[D"); /* Left */ - if (keysym == 0xFF52 || keysym == 0xFF97) return guac_terminal_send_string(term, "\x1B[A"); /* Up */ - if (keysym == 0xFF53 || keysym == 0xFF98) return guac_terminal_send_string(term, "\x1B[C"); /* Right */ - if (keysym == 0xFF54 || keysym == 0xFF99) return guac_terminal_send_string(term, "\x1B[B"); /* Down */ + + /* Left */ + if (keysym == GUAC_TERMINAL_KEY_LEFT || keysym == GUAC_TERMINAL_KEY_KP_LEFT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_CURSOR_LEFT); + + /* Up */ + if (keysym == GUAC_TERMINAL_KEY_UP || keysym == GUAC_TERMINAL_KEY_KP_UP) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_CURSOR_UP); + + /* Right */ + if (keysym == GUAC_TERMINAL_KEY_RIGHT || keysym == GUAC_TERMINAL_KEY_KP_RIGHT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_CURSOR_RIGHT); + + /* Down */ + if (keysym == GUAC_TERMINAL_KEY_DOWN || keysym == GUAC_TERMINAL_KEY_KP_DOWN) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_CURSOR_DOWN); } - if (keysym == 0xFF55 || keysym == 0xFF9A) return guac_terminal_send_string(term, "\x1B[5~"); /* Page up */ - if (keysym == 0xFF56 || keysym == 0xFF9B) return guac_terminal_send_string(term, "\x1B[6~"); /* Page down */ - if (keysym == 0xFF57 || keysym == 0xFF9C) return guac_terminal_send_string(term, "\x1B[4~"); /* End */ + /* Page up */ + if (keysym == GUAC_TERMINAL_KEY_PAGEUP || keysym == GUAC_TERMINAL_KEY_KP_PAGEUP) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_PAGEUP); + + /* Page down */ + if (keysym == GUAC_TERMINAL_KEY_PAGEDOWN || keysym == GUAC_TERMINAL_KEY_KP_PAGEDOWN) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_PAGEDOWN); + + /* End */ + if (keysym == GUAC_TERMINAL_KEY_END || keysym == GUAC_TERMINAL_KEY_KP_END) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_END); + + /* Insert */ + if (keysym == GUAC_TERMINAL_KEY_INSERT || keysym == GUAC_TERMINAL_KEY_KP_INSERT) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_INSERT); + + /* F1 */ + if (keysym == GUAC_TERMINAL_KEY_F1 || keysym == GUAC_TERMINAL_KEY_KP_F1) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F1); + + /* F2 */ + if (keysym == GUAC_TERMINAL_KEY_F2 || keysym == GUAC_TERMINAL_KEY_KP_F2) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F2); + + /* F3 */ + if (keysym == GUAC_TERMINAL_KEY_F3 || keysym == GUAC_TERMINAL_KEY_KP_F3) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F3); + + /* F4 */ + if (keysym == GUAC_TERMINAL_KEY_F4 || keysym == GUAC_TERMINAL_KEY_KP_F4) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F4); + + /* F5 */ + if (keysym == GUAC_TERMINAL_KEY_F5) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F5); + + /* F6 */ + if (keysym == GUAC_TERMINAL_KEY_F6) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F6); + + /* F7 */ + if (keysym == GUAC_TERMINAL_KEY_F7) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F7); + + /* F8 */ + if (keysym == GUAC_TERMINAL_KEY_F8) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F8); + + /* F9 */ + if (keysym == GUAC_TERMINAL_KEY_F9) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F9); - if (keysym == 0xFF63 || keysym == 0xFF9E) return guac_terminal_send_string(term, "\x1B[2~"); /* Insert */ + /* F10 */ + if (keysym == GUAC_TERMINAL_KEY_F10) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F10); - if (keysym == 0xFFBE || keysym == 0xFF91) return guac_terminal_send_string(term, "\x1B[[A"); /* F1 */ - if (keysym == 0xFFBF || keysym == 0xFF92) return guac_terminal_send_string(term, "\x1B[[B"); /* F2 */ - if (keysym == 0xFFC0 || keysym == 0xFF93) return guac_terminal_send_string(term, "\x1B[[C"); /* F3 */ - if (keysym == 0xFFC1 || keysym == 0xFF94) return guac_terminal_send_string(term, "\x1B[[D"); /* F4 */ - if (keysym == 0xFFC2) return guac_terminal_send_string(term, "\x1B[[E"); /* F5 */ + /* F11 */ + if (keysym == GUAC_TERMINAL_KEY_F11) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F11); - if (keysym == 0xFFC3) return guac_terminal_send_string(term, "\x1B[17~"); /* F6 */ - if (keysym == 0xFFC4) return guac_terminal_send_string(term, "\x1B[18~"); /* F7 */ - if (keysym == 0xFFC5) return guac_terminal_send_string(term, "\x1B[19~"); /* F8 */ - if (keysym == 0xFFC6) return guac_terminal_send_string(term, "\x1B[20~"); /* F9 */ - if (keysym == 0xFFC7) return guac_terminal_send_string(term, "\x1B[21~"); /* F10 */ - if (keysym == 0xFFC8) return guac_terminal_send_string(term, "\x1B[22~"); /* F11 */ - if (keysym == 0xFFC9) return guac_terminal_send_string(term, "\x1B[23~"); /* F12 */ + /* F12 */ + if (keysym == GUAC_TERMINAL_KEY_F12) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_F12); - if (keysym == 0xFFFF || keysym == 0xFF9F) return guac_terminal_send_string(term, "\x1B[3~"); /* Delete */ + /* Delete */ + if (keysym == GUAC_TERMINAL_KEY_DELETE || keysym == GUAC_TERMINAL_KEY_KP_DELETE) + return guac_terminal_send_string(term, GUAC_TERMINAL_ESC_SEQ_DELETE); /* Ignore unknown keys */ guac_client_log(term->client, GUAC_LOG_DEBUG, diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index 11c8fb5a3..c275f9a76 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -111,6 +111,416 @@ */ #define GUAC_TERMINAL_PIPE_AUTOFLUSH 2 +/** + * Keysym for up arrow. + */ +#define GUAC_TERMINAL_KEY_UP 0xFF52 + +/** + * Keysym for down arrow. + */ +#define GUAC_TERMINAL_KEY_DOWN 0xFF54 + +/** + * Keysym for left arrow. + */ +#define GUAC_TERMINAL_KEY_LEFT 0xFF51 + +/** + * Keysym for right arrow. + */ +#define GUAC_TERMINAL_KEY_RIGHT 0xFF53 + +/** + * Keysym for home key. + */ +#define GUAC_TERMINAL_KEY_HOME 0xFF50 + +/** + * Keysym for end key. + */ +#define GUAC_TERMINAL_KEY_END 0xFF57 + +/** + * Keysym for page up. + */ +#define GUAC_TERMINAL_KEY_PAGEUP 0xFF55 + +/** + * Keysym for page down. + */ +#define GUAC_TERMINAL_KEY_PAGEDOWN 0xFF56 + +/** + * Keysym for keypad up arrow. + */ +#define GUAC_TERMINAL_KEY_KP_UP 0xFF97 + +/** + * Keysym for keypad down arrow. + */ +#define GUAC_TERMINAL_KEY_KP_DOWN 0xFF99 + +/** + * Keysym for keypad left arrow. + */ +#define GUAC_TERMINAL_KEY_KP_LEFT 0xFF96 + +/** + * Keysym for keypad right arrow. + */ +#define GUAC_TERMINAL_KEY_KP_RIGHT 0xFF98 + +/** + * Keysym for keypad home key. + */ +#define GUAC_TERMINAL_KEY_KP_HOME 0xFF95 + +/** + * Keysym for keypad end key. + */ +#define GUAC_TERMINAL_KEY_KP_END 0xFF9C + +/** + * Keysym for keypad page up. + */ +#define GUAC_TERMINAL_KEY_KP_PAGEUP 0xFF9A + +/** + * Keysym for keypad page down. + */ +#define GUAC_TERMINAL_KEY_KP_PAGEDOWN 0xFF9B + +/** + * Keysym for left Control. + */ +#define GUAC_TERMINAL_KEY_CTRL_L 0xFFE3 + +/** + * Keysym for right Control. + */ +#define GUAC_TERMINAL_KEY_CTRL_R 0xFFE4 + +/** + * Keysym for left Meta. + */ +#define GUAC_TERMINAL_KEY_META_L 0xFFE7 + +/** + * Keysym for right Meta. + */ +#define GUAC_TERMINAL_KEY_META_R 0xFFE8 + +/** + * Keysym for left ALT. + */ +#define GUAC_TERMINAL_KEY_ALT_L 0xFFE9 + +/** + * Keysym for right ALT. + */ +#define GUAC_TERMINAL_KEY_ALT_R 0xFFEA + +/** + * Keysym for left Shift. + */ +#define GUAC_TERMINAL_KEY_SHIFT_L 0xFFE1 + +/** + * Keysym for right Shift. + */ +#define GUAC_TERMINAL_KEY_SHIFT_R 0xFFE2 + +/** + * Keysym for escape. + */ +#define GUAC_TERMINAL_KEY_ESCAPE 0xFF1B + +/** + * Keysym for insert. + */ +#define GUAC_TERMINAL_KEY_INSERT 0xFF63 + +/** + * Keysym for enter. + */ +#define GUAC_TERMINAL_KEY_ENTER 0xFF0D + +/** + * Keysym for tab. + */ +#define GUAC_TERMINAL_KEY_TAB 0xFF09 + +/** + * Keysym for backspace. + */ +#define GUAC_TERMINAL_KEY_BACKSPACE 0xFF08 + +/** + * Keysym for delete. + */ +#define GUAC_TERMINAL_KEY_DELETE 0xFFFF + +/** + * Keysym for keypad insert. + */ +#define GUAC_TERMINAL_KEY_KP_INSERT 0xFF9E + +/** + * Keysym for keypad enter. + */ +#define GUAC_TERMINAL_KEY_KP_ENTER 0xFF8D + +/** + * Keysym for keypad tab. + */ +#define GUAC_TERMINAL_KEY_KP_TAB 0xFF89 + +/** + * Keysym for keypad delete. + */ +#define GUAC_TERMINAL_KEY_KP_DELETE 0xFF9F + +/** + * Keysym for Function key F1. + */ +#define GUAC_TERMINAL_KEY_F1 0xFFBE + +/** + * Keysym for Function key F2. + */ +#define GUAC_TERMINAL_KEY_F2 0xFFBF + +/** + * Keysym for Function key F3. + */ +#define GUAC_TERMINAL_KEY_F3 0xFFC0 + +/** + * Keysym for Function key F4. + */ +#define GUAC_TERMINAL_KEY_F4 0xFFC1 + +/** + * Keysym for Function key F5. + */ +#define GUAC_TERMINAL_KEY_F5 0xFFC2 + +/** + * Keysym for Function key F6. + */ +#define GUAC_TERMINAL_KEY_F6 0xFFC3 + +/** + * Keysym for Function key F7. + */ +#define GUAC_TERMINAL_KEY_F7 0xFFC4 + +/** + * Keysym for Function key F8. + */ +#define GUAC_TERMINAL_KEY_F8 0xFFC5 + +/** + * Keysym for Function key F9. + */ +#define GUAC_TERMINAL_KEY_F9 0xFFC6 + +/** + * Keysym for Function key F10. + */ +#define GUAC_TERMINAL_KEY_F10 0xFFC7 + +/** + * Keysym for Function key F11. + */ +#define GUAC_TERMINAL_KEY_F11 0xFFC8 + +/** + * Keysym for Function key F12. + */ +#define GUAC_TERMINAL_KEY_F12 0xFFC9 + +/** + * Keysym for keypad Function key F1. + */ +#define GUAC_TERMINAL_KEY_KP_F1 0xFF91 + +/** + * Keysym for keypad Function key F2. + */ +#define GUAC_TERMINAL_KEY_KP_F2 0xFF92 + +/** + * Keysym for keypad Function key F3. + */ +#define GUAC_TERMINAL_KEY_KP_F3 0xFF93 + +/** + * Keysym for keypad Function key F4. + */ +#define GUAC_TERMINAL_KEY_KP_F4 0xFF94 + +/** + * Hex ASCII code for Tab. + */ +#define GUAC_TERMINAL_ASCII_TAB "\x09" + +/** + * Hex ASCII code for Carriage Return. + */ +#define GUAC_TERMINAL_ASCII_CR "\x0D" + +/** + * Hex ASCII code for Escape. + */ +#define GUAC_TERMINAL_ASCII_ESCAPE "\x1B" + +/** + * Escape sequence: page up. + */ +#define GUAC_TERMINAL_ESC_SEQ_PAGEUP "\x1B[5~" + +/** + * Escape sequence: page down. + */ +#define GUAC_TERMINAL_ESC_SEQ_PAGEDOWN "\x1B[6~" + +/** + * Escape sequence: end. + */ +#define GUAC_TERMINAL_ESC_SEQ_END "\x1B[4~" + +/** + * Escape sequence: insert. + */ +#define GUAC_TERMINAL_ESC_SEQ_INSERT "\x1B[2~" + +/** + * Escape sequence: home. + */ +#define GUAC_TERMINAL_ESC_SEQ_HOME "\x1B[1~" + +/** + * Escape sequence: move cursor left. + */ +#define GUAC_TERMINAL_ESC_SEQ_CURSOR_LEFT "\x1B[D" + +/** + * Escape sequence: move cursor right. + */ +#define GUAC_TERMINAL_ESC_SEQ_CURSOR_RIGHT "\x1B[C" + +/** + * Escape sequence: move cursor up. + */ +#define GUAC_TERMINAL_ESC_SEQ_CURSOR_UP "\x1B[A" + +/** + * Escape sequence: move cursor down. + */ +#define GUAC_TERMINAL_ESC_SEQ_CURSOR_DOWN "\x1B[B" + +/** + * Escape sequence: delete. + */ +#define GUAC_TERMINAL_ESC_SEQ_DELETE "\x1B[3~" + +/** + * Escape sequence: application cursor move left. + */ +#define GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_LEFT "\x1BOD" + +/** + * Escape sequence: application cursor move right. + */ +#define GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_RIGHT "\x1BOC" + +/** + * Escape sequence: application cursor move up. + */ +#define GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_UP "\x1BOA" + +/** + * Escape sequence: application cursor move down. + */ +#define GUAC_TERMINAL_ESC_SEQ_APP_CURSOR_DOWN "\x1BOB" + +/** + * Escape sequence: function key F1. + */ +#define GUAC_TERMINAL_ESC_SEQ_F1 "\x1B[[A" + +/** + * Escape sequence: function key F2. + */ +#define GUAC_TERMINAL_ESC_SEQ_F2 "\x1B[[B" + +/** + * Escape sequence: function key F3. + */ +#define GUAC_TERMINAL_ESC_SEQ_F3 "\x1B[[C" + +/** + * Escape sequence: function key F4. + */ +#define GUAC_TERMINAL_ESC_SEQ_F4 "\x1B[[D" + +/** + * Escape sequence: function key F5. + */ +#define GUAC_TERMINAL_ESC_SEQ_F5 "\x1B[[E" + +/** + * Escape sequence: function key F6. + */ +#define GUAC_TERMINAL_ESC_SEQ_F6 "\x1B[17~" + +/** + * Escape sequence: function key F7. + */ +#define GUAC_TERMINAL_ESC_SEQ_F7 "\x1B[18~" + +/** + * Escape sequence: function key F8. + */ +#define GUAC_TERMINAL_ESC_SEQ_F8 "\x1B[19~" + +/** + * Escape sequence: function key F9. + */ +#define GUAC_TERMINAL_ESC_SEQ_F9 "\x1B[20~" + +/** + * Escape sequence: function key F10. + */ +#define GUAC_TERMINAL_ESC_SEQ_F10 "\x1B[21~" + +/** + * Escape sequence: function key F11. + */ +#define GUAC_TERMINAL_ESC_SEQ_F11 "\x1B[22~" + +/** + * Escape sequence: function key F12. + */ +#define GUAC_TERMINAL_ESC_SEQ_F12 "\x1B[23~" + +/** + * Escape sequence: go to previous word. + */ +#define GUAC_TERMINAL_ESC_SEQ_PREV_WORD "\033[1;5D" + +/** + * Escape sequence: go to next word. + */ +#define GUAC_TERMINAL_ESC_SEQ_NEXT_WORD "\033[1;5C" + +/** + * Escape sequence: delete word. + */ +#define GUAC_TERMINAL_ESC_SEQ_DELETE_WORD "\033D" + /** * Represents a terminal emulator which uses a given Guacamole client to * render itself.