[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 2/7] input: virtio: don't send mouse wheel event twic
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 2/7] input: virtio: don't send mouse wheel event twice |
Date: |
Mon, 29 Jan 2018 11:23:15 +0100 |
From: Miika S <address@hidden>
On Linux, a mouse event is generated for both down and up when mouse
wheel is used. This caused virtio_input_send() to be called twice each
time the wheel was used.
This commit adds a check for the button down state and only calls
virtio_input_send() when it is true.
Signed-off-by: Miika S <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/input/virtio-input-hid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index a5917c2754..be054fd272 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -218,8 +218,10 @@ static void virtio_input_handle_event(DeviceState *dev,
QemuConsole *src,
break;
case INPUT_EVENT_KIND_BTN:
btn = evt->u.btn.data;
- if (vhid->wheel_axis && (btn->button == INPUT_BUTTON_WHEEL_UP ||
- btn->button == INPUT_BUTTON_WHEEL_DOWN)) {
+ if (vhid->wheel_axis &&
+ (btn->button == INPUT_BUTTON_WHEEL_UP ||
+ btn->button == INPUT_BUTTON_WHEEL_DOWN) &&
+ btn->down) {
event.type = cpu_to_le16(EV_REL);
event.code = cpu_to_le16(REL_WHEEL);
event.value = cpu_to_le32(btn->button == INPUT_BUTTON_WHEEL_UP
--
2.9.3
- [Qemu-devel] [PULL 0/7] Input 20180129 v2 patches, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 5/7] hw: convert the escc device to keycodemapdb, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 2/7] input: virtio: don't send mouse wheel event twice,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 6/7] ui: fix alphabetical ordering of keymaps, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 1/7] input: add mouse side buttons to virtio input, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 4/7] hw: convert ps2 device to keycodemapdb, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 7/7] hw: convert virtio-input-hid device to keycodemapdb, Gerd Hoffmann, 2018/01/29
- [Qemu-devel] [PULL 3/7] ps2: check PS2Queue pointers in post_load routine, Gerd Hoffmann, 2018/01/29
- Re: [Qemu-devel] [PULL 0/7] Input 20180129 v2 patches, Peter Maydell, 2018/01/29