From nobody Tue Oct 28 21:07:43 2025 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; dkim=fail; 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 151395841923793.7043355484459; Fri, 22 Dec 2017 08:00:19 -0800 (PST) Received: from localhost ([::1]:55675 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSPjv-0006mQ-7w for importer@patchew.org; Fri, 22 Dec 2017 11:00:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSPDL-0003Rf-IU for qemu-devel@nongnu.org; Fri, 22 Dec 2017 10:26:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSPDK-0001Qf-Nf for qemu-devel@nongnu.org; Fri, 22 Dec 2017 10:26:23 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:47001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSPDK-0001Oz-Ft for qemu-devel@nongnu.org; Fri, 22 Dec 2017 10:26:22 -0500 Received: by mail-lf0-x242.google.com with SMTP id r143so31869005lfe.13 for ; Fri, 22 Dec 2017 07:26:22 -0800 (PST) Received: from es.lan (dsl-tkubng22-58c1fd-134.dhcp.inet.fi. [88.193.253.134]) by smtp.gmail.com with ESMTPSA id b75sm4875793lfe.47.2017.12.22.07.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Dec 2017 07:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QIiBsqzdbYRV5A17xrj5Z3EgQsDup7Udb6fGEDh3YHg=; b=SA5cI6oxRSPv4HvFKzCapyIaHPC54h0dxUqJ6TgRKGngteEHXR/ioTG0Qj27PAZxdO fklPbkVN84oT4BNmiMw2/G99XXllqfTuMhNNsArSUi2hsFX6ge/yEU0GnzgxeLVaeLIW 6xDN+/8JBlX/JnZQgAwm12JRxWWUEQ/opG8jZjRha9Ndp76REx6tSFrEbfap+XcP3evU IzXLD+Un1OuBNEj+sjWe/P0UP1Uy7+Yo79MTlYveiwRbyQYMUlauztRQiXxksHgKJaAd IlDmKPsgfWxltraee5veYI6nk3MDOqpG6/Wu9c4gWab5yPjU8DmqL0j7XF8xHB9J89pO pKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QIiBsqzdbYRV5A17xrj5Z3EgQsDup7Udb6fGEDh3YHg=; b=ckdNgY+q4q/WOXoF6o6mA95qoN6EwzNMYzfPnhao8HnAZ+mEeZhMVH3s1KFcNhPw0D P3+LNxL8nGrS2gn0is/3Yt/sGlDrP7dp8MhG+cdcTma8U6YFPaokX8TVF98yCPFgCGUT VoyBc0zIDuuPhExG/fP2z2GemwBRaKrikip4RlioOcW5N4JDN9dd3/GMPI20WQSdco3v p0VYGMtQVlT3VxapxmAA5pZfcB+WHGYbBfT/I14BRs5exlyhLhsc183WRKVh0Y9vI6mO ORVSzFpIfHD7ud6J8cSCmUqOGlNlSsrQeCqiR1dmlAgGxmr7kDFtWLFEpB2rqEBStr7Y ZLaw== X-Gm-Message-State: AKGB3mI85D/SmXChsmDdis9YtJmsGuzwVjHTdftSpf3ZlcJPS1oAh+ov Xjs/sSwkFt7F+tZlBlHlMY46l2I/ X-Google-Smtp-Source: ACJfBotVpig8SZZSHzw2utFvdmv4caYU4DiuCs9pbYWfoHlGa8eFxTpWJBO1Xysw5ZXAIB+JsU6PjA== X-Received: by 10.25.141.74 with SMTP id p71mr9348611lfd.10.1513956380901; Fri, 22 Dec 2017 07:26:20 -0800 (PST) From: Miika S To: qemu-devel@nongnu.org Date: Fri, 22 Dec 2017 17:25:31 +0200 Message-Id: <20171222152531.1849-4-miika9764@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171222152531.1849-1-miika9764@gmail.com> References: <20171222152531.1849-1-miika9764@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH 3/3] 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 , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 2cac659469..587616a932 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -225,8 +225,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.15.1