input: virtio: don't send mouse wheel event twice
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 <miika9764@gmail.com> Message-Id: <20171222152531.1849-4-miika9764@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
2416760fa6
commit
a5f99be41e
|
@ -218,8 +218,10 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||||
break;
|
break;
|
||||||
case INPUT_EVENT_KIND_BTN:
|
case INPUT_EVENT_KIND_BTN:
|
||||||
btn = evt->u.btn.data;
|
btn = evt->u.btn.data;
|
||||||
if (vhid->wheel_axis && (btn->button == INPUT_BUTTON_WHEEL_UP ||
|
if (vhid->wheel_axis &&
|
||||||
btn->button == INPUT_BUTTON_WHEEL_DOWN)) {
|
(btn->button == INPUT_BUTTON_WHEEL_UP ||
|
||||||
|
btn->button == INPUT_BUTTON_WHEEL_DOWN) &&
|
||||||
|
btn->down) {
|
||||||
event.type = cpu_to_le16(EV_REL);
|
event.type = cpu_to_le16(EV_REL);
|
||||||
event.code = cpu_to_le16(REL_WHEEL);
|
event.code = cpu_to_le16(REL_WHEEL);
|
||||||
event.value = cpu_to_le32(btn->button == INPUT_BUTTON_WHEEL_UP
|
event.value = cpu_to_le32(btn->button == INPUT_BUTTON_WHEEL_UP
|
||||||
|
|
Loading…
Reference in a new issue