From f242634145d962a094f05b65defe2f7a98f02ff4 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Mon, 1 Aug 2016 13:27:08 +0100 Subject: [PATCH] Handle scancode extensions E1 and E2 Do not handle them as normal keys. State is not saved for these keys. Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt --- server/inputs-channel.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/inputs-channel.c b/server/inputs-channel.c index 8f0a2068..69d03911 100644 --- a/server/inputs-channel.c +++ b/server/inputs-channel.c @@ -57,7 +57,7 @@ (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE) struct SpiceKbdState { - bool push_ext; + uint8_t push_ext_type; /* track key press state */ bool key[0x80]; @@ -200,12 +200,14 @@ static void kbd_push_scan(SpiceKbdInstance *sin, uint8_t scan) sif = SPICE_CONTAINEROF(sin->base.sif, SpiceKbdInterface, base); /* track XT scan code set 1 key state */ - if (scan == 0xe0) { - sin->st->push_ext = TRUE; + if (scan >= 0xe0 && scan <= 0xe2) { + sin->st->push_ext_type = scan; } else { - bool *state = sin->st->push_ext ? sin->st->key : sin->st->key_ext; - sin->st->push_ext = FALSE; - state[scan & 0x7f] = !(scan & 0x80); + if (sin->st->push_ext_type == 0 || sin->st->push_ext_type == 0xe0) { + bool *state = sin->st->push_ext_type ? sin->st->key_ext : sin->st->key; + state[scan & 0x7f] = !(scan & 0x80); + } + sin->st->push_ext_type = 0; } sif->push_scan_freg(sin, scan);