From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PULL 2/3] hid: handle full ptr queues in post_load
Date: Thu, 22 Jan 2015 12:32:52 +0100 [thread overview]
Message-ID: <1421926373-3734-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1421926373-3734-1-git-send-email-kraxel@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
---
hw/input/hid.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/input/hid.c b/hw/input/hid.c
index 148c003..ad18555 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -514,6 +514,27 @@ static int hid_post_load(void *opaque, int version_id)
HIDState *s = opaque;
hid_set_next_idle(s);
+
+ if (s->n == QUEUE_LENGTH && (s->kind == HID_TABLET ||
+ s->kind == HID_MOUSE)) {
+ /*
+ * Handle ptr device migration from old qemu with full queue.
+ *
+ * Throw away everything but the last event, so we propagate
+ * at least the current button state to the guest. Also keep
+ * current position for the tablet, signal "no motion" for the
+ * mouse.
+ */
+ HIDPointerEvent evt;
+ evt = s->ptr.queue[(s->head+s->n) & QUEUE_MASK];
+ if (s->kind == HID_MOUSE) {
+ evt.xdx = 0;
+ evt.ydy = 0;
+ }
+ s->ptr.queue[0] = evt;
+ s->head = 0;
+ s->n = 1;
+ }
return 0;
}
--
1.8.3.1
next prev parent reply other threads:[~2015-01-22 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-22 11:32 [Qemu-devel] [PULL 0/3] input: misc fixes Gerd Hoffmann
2015-01-22 11:32 ` [Qemu-devel] [PULL 1/3] input: improve docs for input-send-event qmp command Gerd Hoffmann
2015-01-22 11:32 ` Gerd Hoffmann [this message]
2015-01-22 11:32 ` [Qemu-devel] [PULL 3/3] hw/input/hid.c Fix capslock hid code Gerd Hoffmann
2015-01-22 18:57 ` [Qemu-devel] [PULL 0/3] input: misc fixes Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421926373-3734-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).