Noor-glyp commented on a change in pull request #350:
URL: https://github.com/apache/guacamole-server/pull/350#discussion_r751981341
##########
File path: src/terminal/terminal.c
##########
@@ -1590,17 +1590,112 @@ static int __guac_terminal_send_key(guac_terminal*
term, int keysym, int pressed
if (keysym == 0xFF54 || keysym == 0xFF99) return
guac_terminal_send_string(term, "\x1B[B"); /* Down */
}
+ /* Check if any Modifier key is pressed. */
+ if (term->mod_ctrl || term->mod_alt || term->mod_shift) {
+ int keyseq = 0;
+
+ if (term->mod_ctrl) keyseq = keyseq | 4; /* OR operation
with other modifier key combination. */
+ if (term->mod_alt) keyseq = keyseq | 2;
+ if (term->mod_shift) keyseq = keyseq | 1;
+
+ keyseq = keyseq + 1;
+
+ /* F1 */
+ if (keysym == 0xFFBE || keysym == 0xFF91) {
+ char data[10];
+ sprintf(data, "\x1B[1;%dP", keyseq);
+ return guac_terminal_send_string(term, data);
Review comment:
Like you are suggesting like this maybe. Like this
```
if (term->mod_ctrl || term->mod_alt || term->mod_shift) {
int keyseq = 0;
if (term->mod_ctrl) keyseq = keyseq | 4; /* OR operation
with other modifier key combination. */
if (term->mod_alt) keyseq = keyseq | 2;
if (term->mod_shift) keyseq = keyseq | 1;
keyseq = keyseq + 1;
guac_terminal_sendf(term, "\x1B[1;");
char charValue = keyseq+'0';
guac_terminal_sendf(term, &charValue);
if (keysym == 0xFFBE || keysym == 0xFF91) return
guac_terminal_send_string(term, "P"); /* F1 */
/* F2 */ and so on.
```
But the issue with this approch is when it reaches F5 it will start to
become.
```
/* F5 */
if (keysym == 0xFFC2) {
guac_terminal_sendf(term, "\\x1B[15;");
char charValue1 = keyseq+'0';
guac_terminal_sendf(term, &charValue);
return guac_terminal_sendf(term, "~");
}
```
Because with this, the approach won't be feasible. If you have someway else
in mind please specify.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]