From nobody Tue Feb 10 05:17:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517221512751227.22242926037438; Mon, 29 Jan 2018 02:25:12 -0800 (PST) Received: from localhost ([::1]:55183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg6ci-0000D4-11 for importer@patchew.org; Mon, 29 Jan 2018 05:25:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eg6b3-0006Nm-Fc for qemu-devel@nongnu.org; Mon, 29 Jan 2018 05:23:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eg6b0-0001VZ-NR for qemu-devel@nongnu.org; Mon, 29 Jan 2018 05:23:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32455) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eg6b0-0001Uv-Ij for qemu-devel@nongnu.org; Mon, 29 Jan 2018 05:23:26 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF074461C8; Mon, 29 Jan 2018 10:23:25 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id E248F4F9B8; Mon, 29 Jan 2018 10:23:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2CCBD11ABD; Mon, 29 Jan 2018 11:23:20 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 11:23:15 +0100 Message-Id: <20180129102320.21534-3-kraxel@redhat.com> In-Reply-To: <20180129102320.21534-1-kraxel@redhat.com> References: <20180129102320.21534-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 29 Jan 2018 10:23:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/7] input: virtio: don't send mouse wheel event twice X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miika S , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Miika S 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 Message-Id: <20171222152531.1849-4-miika9764@gmail.com> Signed-off-by: Gerd Hoffmann --- 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 =3D evt->u.btn.data; - if (vhid->wheel_axis && (btn->button =3D=3D INPUT_BUTTON_WHEEL_UP = || - btn->button =3D=3D INPUT_BUTTON_WHEEL_DOW= N)) { + if (vhid->wheel_axis && + (btn->button =3D=3D INPUT_BUTTON_WHEEL_UP || + btn->button =3D=3D INPUT_BUTTON_WHEEL_DOWN) && + btn->down) { event.type =3D cpu_to_le16(EV_REL); event.code =3D cpu_to_le16(REL_WHEEL); event.value =3D cpu_to_le32(btn->button =3D=3D INPUT_BUTTON_WH= EEL_UP --=20 2.9.3