summary refs log tree commit diff stats
path: root/ui/spice-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/spice-input.c')
-rw-r--r--ui/spice-input.c20
1 files changed, 20 insertions, 0 deletions
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);
 }