From 411289538c4bf8b948152211c7f0f84865084c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 26 May 2017 07:44:56 +0200 Subject: [PATCH 01/13] input: don't queue delay if paused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Marc-André Lureau Message-id: <20170526074456.19599-1-marcandre.lureau@redhat.com> Patchwork-id: 75419 O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH] input: don't queue delay if paused Bugzilla: 1444326 RH-Acked-by: Laurent Vivier RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Vlad Yasevich qemu_input_event_send() discards key event when the guest is paused, but not the delay. The delay ends up in the input queue, and qemu_input_event_send_key() will further fill the queue with upcoming events. VNC uses qemu_input_event_send_key_delay(), not SPICE, which results in a different input behaviour on pause: VNC will queue the events (except the first that is discarded), SPICE will discard all events. Don't queue delay if paused, and provide same behaviour on SPICE and VNC clients on resume (and potentially avoid over-allocating the buffer queue) Signed-off-by: Marc-André Lureau Message-id: 20170425130520.31819-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann (cherry picked from commit 05c6638b203fd7d8bbfa88ac6e6198e32ed0506f) Signed-off-by: Marc-André Lureau Signed-off-by: Miroslav Rezanina --- ui/input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/input.c b/ui/input.c index ed88cda..383158b 100644 --- a/ui/input.c +++ b/ui/input.c @@ -405,6 +405,10 @@ void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down) void qemu_input_event_send_key_delay(uint32_t delay_ms) { + if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { + return; + } + if (!kbd_timer) { kbd_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, qemu_input_queue_process, &kbd_queue); -- 1.8.3.1