SHA256
1
0
forked from pool/qemu
qemu/0059-vnc-add-configurable-keyboard-delay.patch
Andreas Färber 8c721a87ae Accepting request 408549 from home:algraf:branches:Virtualization
- Remove deprecated patch "work-around-SA_RESTART-race" (boo#982208)
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.6
* Patches dropped:
  0002-XXX-work-around-SA_RESTART-race-wit.patch
  0003-qemu-0.9.0.cvs-binfmt.patch
  0004-qemu-cvs-alsa_bitfield.patch
  0005-qemu-cvs-alsa_ioctl.patch
  0006-qemu-cvs-alsa_mmap.patch
  0007-qemu-cvs-gettimeofday.patch
  0008-qemu-cvs-ioctl_debug.patch
  0009-qemu-cvs-ioctl_nodirection.patch
  0010-block-vmdk-Support-creation-of-SCSI.patch
  0011-linux-user-add-binfmt-wrapper-for-a.patch
  0012-PPC-KVM-Disable-mmu-notifier-check.patch
  0013-linux-user-fix-segfault-deadlock.patch
  0014-linux-user-binfmt-support-host-bina.patch
  0015-linux-user-Ignore-broken-loop-ioctl.patch
  0016-linux-user-lock-tcg.patch
  0017-linux-user-Run-multi-threaded-code-.patch
  0018-linux-user-lock-tb-flushing-too.patch
  0019-linux-user-Fake-proc-cpuinfo.patch
  0020-linux-user-implement-FS_IOC_GETFLAG.patch
  0021-linux-user-implement-FS_IOC_SETFLAG.patch
  0022-linux-user-XXX-disable-fiemap.patch
  0023-slirp-nooutgoing.patch
  0024-vnc-password-file-and-incoming-conn.patch
  0025-linux-user-add-more-blk-ioctls.patch
  0026-linux-user-use-target_ulong.patch
  0027-block-Add-support-for-DictZip-enabl.patch
  0028-block-Add-tar-container-format.patch

OBS-URL: https://build.opensuse.org/request/show/408549
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=305
2016-07-14 15:50:35 +00:00

130 lines
4.5 KiB
Diff

From 5af645d652290cf562a2f05fa8318d75ae6f04e3 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 1 Jun 2016 08:22:30 +0200
Subject: [PATCH] vnc: add configurable keyboard delay
Limits the rate kbd events from the vnc server are forwarded to the
guest, so input devices which are typically low-bandwidth can keep
up even on bulky input.
v2: update documentation too.
v3: spell fixes.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Yang Hongyang <hongyang.yang@easystack.cn>
Message-id: 1464762150-25817-1-git-send-email-kraxel@redhat.com
(cherry picked from commit c5ce83334465ee5acb6789a2f22d125273761c9e)
[BR: BSC#974914]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
qemu-options.hx | 8 ++++++++
ui/vnc.c | 13 +++++++++++--
ui/vnc.h | 1 +
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 32b25a5..3bcd98f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1410,6 +1410,14 @@ everybody else. 'ignore' completely ignores the shared flag and
allows everybody connect unconditionally. Doesn't conform to the rfb
spec but is traditional QEMU behavior.
+@item key-delay-ms
+
+Set keyboard delay, for key down and key up events, in milliseconds.
+Default is 1. Keyboards are low-bandwidth devices, so this slowdown
+can help the device and guest to keep up and not lose events in case
+events are arriving in bulk. Possible causes for the latter are flaky
+network connections, or scripts for automated testing.
+
@end table
ETEXI
diff --git a/ui/vnc.c b/ui/vnc.c
index ab65db9..1bee07f 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1639,6 +1639,7 @@ static void reset_keys(VncState *vs)
for(i = 0; i < 256; i++) {
if (vs->modifiers_state[i]) {
qemu_input_event_send_key_number(vs->vd->dcl.con, i, false);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
vs->modifiers_state[i] = 0;
}
}
@@ -1648,9 +1649,9 @@ static void press_key(VncState *vs, int keysym)
{
int keycode = keysym2scancode(vs->vd->kbd_layout, keysym) & SCANCODE_KEYMASK;
qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, true);
- qemu_input_event_send_key_delay(0);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false);
- qemu_input_event_send_key_delay(0);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
}
static int current_led_state(VncState *vs)
@@ -1802,6 +1803,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
if (qemu_console_is_graphic(NULL)) {
qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
} else {
bool numlock = vs->modifiers_state[0x45];
bool control = (vs->modifiers_state[0x1d] ||
@@ -1923,6 +1925,7 @@ static void vnc_release_modifiers(VncState *vs)
continue;
}
qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, false);
+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms);
}
}
@@ -3298,6 +3301,9 @@ static QemuOptsList qemu_vnc_opts = {
.name = "lock-key-sync",
.type = QEMU_OPT_BOOL,
},{
+ .name = "key-delay-ms",
+ .type = QEMU_OPT_NUMBER,
+ },{
.name = "sasl",
.type = QEMU_OPT_BOOL,
},{
@@ -3536,6 +3542,7 @@ void vnc_display_open(const char *id, Error **errp)
#endif
int acl = 0;
int lock_key_sync = 1;
+ int key_delay_ms;
if (!vs) {
error_setg(errp, "VNC display not active");
@@ -3658,6 +3665,7 @@ void vnc_display_open(const char *id, Error **errp)
reverse = qemu_opt_get_bool(opts, "reverse", false);
lock_key_sync = qemu_opt_get_bool(opts, "lock-key-sync", true);
+ key_delay_ms = qemu_opt_get_number(opts, "key-delay-ms", 1);
sasl = qemu_opt_get_bool(opts, "sasl", false);
#ifndef CONFIG_VNC_SASL
if (sasl) {
@@ -3790,6 +3798,7 @@ void vnc_display_open(const char *id, Error **errp)
}
#endif
vs->lock_key_sync = lock_key_sync;
+ vs->key_delay_ms = key_delay_ms;
device_id = qemu_opt_get(opts, "display");
if (device_id) {
diff --git a/ui/vnc.h b/ui/vnc.h
index 81a3261..6568bca 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -155,6 +155,7 @@ struct VncDisplay
DisplayChangeListener dcl;
kbd_layout_t *kbd_layout;
int lock_key_sync;
+ int key_delay_ms;
QemuMutex mutex;
QEMUCursor *cursor;