Noor-glyp commented on a change in pull request #350:
URL: https://github.com/apache/guacamole-server/pull/350#discussion_r748038224
##########
File path: src/terminal/terminal.c
##########
@@ -1590,17 +1590,120 @@ 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);
+ }
+
+ /* F2 */
+ if (keysym == 0xFFBF || keysym == 0xFF92) {
+ char data[10];
+ sprintf(data,"\x1B[1;%dQ",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F3 */
+ if (keysym == 0xFFC0 || keysym == 0xFF93) {
+ char data[10];
+ sprintf(data,"\x1B[1;%dR",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F4 */
+ if (keysym == 0xFFC1 || keysym == 0xFF94) {
+ char data[10];
+ sprintf(data,"\x1B[1;%dS",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F5 */
+ if (keysym == 0xFFC2) {
+ char data[10];
+ sprintf(data,"\x1B[15;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F6 */
+ if (keysym == 0xFFC3) {
+ char data[10];
+ sprintf(data,"\x1B[17;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F7 */
+ if (keysym == 0xFFC4) {
+ char data[10];
+ sprintf(data,"\x1B[18;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F8 */
+ if (keysym == 0xFFC5) {
+ char data[10];
+ sprintf(data,"\x1B[19;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F9 */
+ if (keysym == 0xFFC6) {
+ char data[10];
+ sprintf(data,"\x1B[20;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F10 */
+ if (keysym == 0xFFC7) {
+ char data[10];
+ sprintf(data,"\x1B[21;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F11 */
+ if (keysym == 0xFFC8) {
+ char data[10];
+ sprintf(data,"\x1B[23;%d~",keyseq);
+ return guac_terminal_send_string(term, data);
+ }
+
+ /* F12 */
+ if (keysym == 0xFFC9) {
Review comment:
In this I think, I can do something like
`int keystorke; //It will be the number which keystroke is
pressed like from 15 to 24 i.e. F5 to F10` Then pass it to the sprintf like the
modifier key combinations in the same statement. This way we can reduce I think
12 function keys if to like 7 as F1 to F4 will remain like this. And F11, F12.
--
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]