From: Dietmar Maurer Date: Wed, 11 Dec 2013 10:46:15 +0000 (+0100) Subject: window client send CONTROL_L/ALTGR instead of simple ALTGR X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=93f3f187b027c7cb82e956e54140ea74f6fcedec;p=spiceterm.git window client send CONTROL_L/ALTGR instead of simple ALTGR We must not send a control sequence in that case. --- diff --git a/input.c b/input.c index e04bbd7..7fb5238 100644 --- a/input.c +++ b/input.c @@ -77,6 +77,7 @@ static GHashTable *keymap = NULL; #define KBD_MOD_ALTGR_FLAG (1<<4) #define KBD_MOD_NUMLOCK (1<<5) #define KBD_MOD_SHIFTLOCK (1<<6) +#define KBD_MOD_ALT_FLAG (1<<7) static int kbd_flags = 0; @@ -175,6 +176,12 @@ my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag) case 0xb6: // release Shift_R kbd_flags &= ~KBD_MOD_SHIFT_R_FLAG; break; + case 0x38: // press ALT + kbd_flags |= KBD_MOD_ALT_FLAG; + break; + case 0xb8: // release ALT + kbd_flags &= ~KBD_MOD_ALT_FLAG; + break; case 0x52: // press KP_INSERT if (!(kbd_flags & KBD_MOD_NUMLOCK)) esc = "[2~"; @@ -304,7 +311,9 @@ my_kbd_push_key(SpiceKbdInstance *sin, uint8_t frag) gchar buf[32]; guint8 len; if (uc && ((len = g_unichar_to_utf8(uc, buf)) > 0)) { - if (kbd_flags & (KBD_MOD_CONTROL_L_FLAG|KBD_MOD_CONTROL_R_FLAG)) { + /* NOTE: window client send CONTROL_L/ALTGR instead of simple ALTGR */ + if ((kbd_flags & (KBD_MOD_CONTROL_L_FLAG|KBD_MOD_CONTROL_R_FLAG)) && + !(kbd_flags & KBD_MOD_ALTGR_FLAG)) { if (buf[0] >= 'a' && buf[0] <= 'z') { uint8_t ctrl[1] = { buf[0] - 'a' + 1 }; spiceterm_respond_data(vt, 1, ctrl);