diff options
-rw-r--r-- | ui/input-keymap.c | 1 | ||||
-rw-r--r-- | ui/keymaps.h | 1 | ||||
-rw-r--r-- | ui/spice-input.c | 20 |
3 files changed, 22 insertions, 0 deletions
diff --git a/ui/input-keymap.c b/ui/input-keymap.c index f96adf4165..0d9ddde9c9 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -233,6 +233,7 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_KP_ENTER] = 0x9c, [Q_KEY_CODE_KP_DECIMAL] = 0x53, [Q_KEY_CODE_SYSRQ] = 0x54, + [Q_KEY_CODE_PAUSE] = 0xc6, [Q_KEY_CODE_KP_0] = 0x52, [Q_KEY_CODE_KP_1] = 0x4f, diff --git a/ui/keymaps.h b/ui/keymaps.h index 47d061343e..8757465529 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -59,6 +59,7 @@ typedef struct { /* "grey" keys will usually need a 0xe0 prefix */ #define SCANCODE_GREY 0x80 #define SCANCODE_EMUL0 0xE0 +#define SCANCODE_EMUL1 0xE1 /* "up" flag */ #define SCANCODE_UP 0x80 diff --git a/ui/spice-input.c b/ui/spice-input.c index 918580239d..cda9976469 100644 --- a/ui/spice-input.c +++ b/ui/spice-input.c @@ -32,6 +32,7 @@ typedef struct QemuSpiceKbd { SpiceKbdInstance sin; int ledstate; bool emul0; + size_t pauseseq; } QemuSpiceKbd; static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag); @@ -64,6 +65,25 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t scancode) keycode |= SCANCODE_GREY; } + if (scancode == SCANCODE_EMUL1) { + kbd->pauseseq++; + return; + } else if (kbd->pauseseq == 1) { + if (keycode == 0x1d) { + kbd->pauseseq++; + return; + } else { + kbd->pauseseq = 0; + } + } else if (kbd->pauseseq == 2) { + if (keycode == 0x45) { + qemu_input_event_send_key_qcode(NULL, Q_KEY_CODE_PAUSE, !up); + kbd->pauseseq = 0; + return; + } + kbd->pauseseq = 0; + } + qemu_input_event_send_key_number(NULL, keycode, !up); } |