From nobody Sun May 19 10:57:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1640213959; cv=none; d=zohomail.com; s=zohoarc; b=KgJM6SgwP9YfyUP249I7UQI5rGRZeKkaxlL0aWF/QmZQdoFgZGox42BFudZFAI4EZ2Cp2lvamB/E8lI6NCypdmoPSuiB5r/C8VFLv037QntJ9Nzv7dPNrOAJcgD5Ej/FQMZYwr0A6rpwzIIJpbtsMpAMogKddWe7hfB/n4BBNVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640213959; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Xpyd2QrX9R5y5Ib/uEM0qbhGdn+eYDLESu72a+hgXE0=; b=AH34jgbkpGSYPhxKEKv7zIHlmYei3E5fhASnHZDv8JrA+pTqRVfrdAqpW6FfcJa8YCFDC9Eym4JeOmUujI/2iULXRrabkPWRNdFpiAUj2EcDwp6ke5VrCQje431bs+v7t993DgJyKL+S6Czen4spYi9EvAhGrA4UlTLSW8W4Tic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640213959483365.24086988218846; Wed, 22 Dec 2021 14:59:19 -0800 (PST) Received: from localhost ([::1]:60240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0AZp-0004Q8-Vd for importer@patchew.org; Wed, 22 Dec 2021 17:59:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0AWv-0002Hr-Ol for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:20 -0500 Received: from [2a00:1450:4864:20::52f] (port=43827 helo=mail-ed1-x52f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0AWr-0002Q0-Gi for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:15 -0500 Received: by mail-ed1-x52f.google.com with SMTP id o20so14164333eds.10 for ; Wed, 22 Dec 2021 14:56:10 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:deba:f393:276b:fad2]) by smtp.gmail.com with ESMTPSA id gv11sm1097226ejc.135.2021.12.22.14.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 14:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xpyd2QrX9R5y5Ib/uEM0qbhGdn+eYDLESu72a+hgXE0=; b=aijRAj9Zc8Ozed3KHIR85+piYEsc6p1MO9fVrDmPA00JJ0Qwn9Kf3D+lqYO00nYtzS f7/k7Po6Bo2f8Jz6L+OfHxj2WlC3hdPUyoAqf50joLGllz74tlivpIlmb2g5tO7OqBla 6B1vi6Nzd2pVB/1g3xe//+MHEyYC0nSE0gGAI1jCCr0Sju3qmz93zjwrh81QIRD4z/zj raoYWTIi53U/4l6BbPA/O1ZgVHTpnJT0NtkqYMVmTGd0uFq8OaGL51mGoxDB2hBTO75Q Xdtr0dZGswNrgtJ5oEJ/bQACg83wxzta0F0qYSrKM2tru+U/K/YpTH2eINYU6tz4uba4 vX7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xpyd2QrX9R5y5Ib/uEM0qbhGdn+eYDLESu72a+hgXE0=; b=2z1jSdmgyYOYCxM7XGznbkoxCXBSp/FcoydbaF11LIs+pdg8v+Z1gF16d26ybHHn/3 +s4Z/DHJjpqxY2I54OcAyvJJSf7DfGqzBLkm1VIv/nzS42sP6Kn99cR10hT8vFkLvoAw eXiQ8UyitTcr1jUOhx9RStLbymjCrHa0rkIelyeDwbID09+Z3zsXVPZnEbwF3pAQnKxk OgyjG0sqfqFfixZ0BYHwJ2CKQjymuyib1mjVmQjrDEI9/fHXq3UTg97KkBR+zoyR/VlF cPGcL0TSAnntmZhIFtdh8/Z71k6FDGhVNfUFFwfF8XgB5GN8+skj8Ynxds24NxqgqDu+ B67A== X-Gm-Message-State: AOAM531Y/ipHcBUaCdnZMgjGNjQmHghIHd59xp71rDcDWDxoWTRc6xQP NnDnfU+SsYE4oIonwoJGEBHNNH2ecbU= X-Google-Smtp-Source: ABdhPJwo/GTr5ePTuuGGhRkITdNa2PWPperk1+e18ELG3X7MAb5xLA2OnCSS+47V7jdWT07G0NDMkQ== X-Received: by 2002:a17:907:7b8d:: with SMTP id ne13mr4075417ejc.496.1640213768477; Wed, 22 Dec 2021 14:56:08 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v3 1/5] ps2: Initial horizontal scroll support Date: Wed, 22 Dec 2021 23:56:02 +0100 Message-Id: <20211222225606.1359162-2-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222225606.1359162-1-dpetroff@gmail.com> References: <20211222225606.1359162-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52f (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Petrov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1640213960663100001 Content-Type: text/plain; charset="utf-8" This change adds support for horizontal scroll to ps/2 mouse device code. The code is implemented to match the logic of linux kernel which is used as a reference. Signed-off-by: Dmitry Petrov --- hw/input/ps2.c | 57 +++++++++++++++++++++++++++++++++++++++++++------- qapi/ui.json | 2 +- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 9376a8f4ce..6236711e1b 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -123,6 +123,7 @@ typedef struct { int mouse_dx; /* current values, needed for 'poll' mode */ int mouse_dy; int mouse_dz; + int mouse_dw; uint8_t mouse_buttons; } PS2MouseState; =20 @@ -715,7 +716,7 @@ static int ps2_mouse_send_packet(PS2MouseState *s) /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ const int needed =3D s->mouse_type ? 4 : 3; unsigned int b; - int dx1, dy1, dz1; + int dx1, dy1, dz1, dw1; =20 if (PS2_QUEUE_SIZE - s->common.queue.count < needed) { return 0; @@ -724,6 +725,7 @@ static int ps2_mouse_send_packet(PS2MouseState *s) dx1 =3D s->mouse_dx; dy1 =3D s->mouse_dy; dz1 =3D s->mouse_dz; + dw1 =3D s->mouse_dw; /* XXX: increase range to 8 bits ? */ if (dx1 > 127) dx1 =3D 127; @@ -740,6 +742,9 @@ static int ps2_mouse_send_packet(PS2MouseState *s) /* extra byte for IMPS/2 or IMEX */ switch(s->mouse_type) { default: + /* Just ignore the wheels if not supported */ + s->mouse_dz =3D 0; + s->mouse_dw =3D 0; break; case 3: if (dz1 > 127) @@ -747,13 +752,41 @@ static int ps2_mouse_send_packet(PS2MouseState *s) else if (dz1 < -127) dz1 =3D -127; ps2_queue_noirq(&s->common, dz1 & 0xff); + s->mouse_dz -=3D dz1; + s->mouse_dw =3D 0; break; case 4: - if (dz1 > 7) - dz1 =3D 7; - else if (dz1 < -7) - dz1 =3D -7; - b =3D (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1); + /* + * This matches what the Linux kernel expects for exps/2 in + * drivers/input/mouse/psmouse-base.c. Note, if you happen to + * press/release the 4th or 5th buttons at the same moment as a + * horizontal wheel scroll, those button presses will get lost. I'= m not + * sure what to do about that, since by this point we don't know + * whether those buttons actually changed state. + */ + if (dw1 !=3D 0) { + if (dw1 > 31) { + dw1 =3D 31; + } else if (dw1 < -31) { + dw1 =3D -31; + } + + /* + * linux kernel expects first 6 bits to represent the value + * for horizontal scroll + */ + b =3D (dw1 & 0x3f) | 0x40; + s->mouse_dw -=3D dw1; + } else { + if (dz1 > 7) { + dz1 =3D 7; + } else if (dz1 < -7) { + dz1 =3D -7; + } + + b =3D (dz1 & 0x0f) | ((s->mouse_buttons & 0x18) << 1); + s->mouse_dz -=3D dz1; + } ps2_queue_noirq(&s->common, b); break; } @@ -764,7 +797,6 @@ static int ps2_mouse_send_packet(PS2MouseState *s) /* update deltas */ s->mouse_dx -=3D dx1; s->mouse_dy -=3D dy1; - s->mouse_dz -=3D dz1; =20 return 1; } @@ -806,6 +838,12 @@ static void ps2_mouse_event(DeviceState *dev, QemuCons= ole *src, } else if (btn->button =3D=3D INPUT_BUTTON_WHEEL_DOWN) { s->mouse_dz++; } + + if (btn->button =3D=3D INPUT_BUTTON_WHEEL_RIGHT) { + s->mouse_dw--; + } else if (btn->button =3D=3D INPUT_BUTTON_WHEEL_LEFT) { + s->mouse_dw++; + } } else { s->mouse_buttons &=3D ~bmap[btn->button]; } @@ -833,8 +871,10 @@ static void ps2_mouse_sync(DeviceState *dev) /* if not remote, send event. Multiple events are sent if too big deltas */ while (ps2_mouse_send_packet(s)) { - if (s->mouse_dx =3D=3D 0 && s->mouse_dy =3D=3D 0 && s->mouse_d= z =3D=3D 0) + if (s->mouse_dx =3D=3D 0 && s->mouse_dy =3D=3D 0 + && s->mouse_dz =3D=3D 0 && s->mouse_dw =3D=3D 0) { break; + } } } } @@ -1036,6 +1076,7 @@ static void ps2_mouse_reset(void *opaque) s->mouse_dx =3D 0; s->mouse_dy =3D 0; s->mouse_dz =3D 0; + s->mouse_dw =3D 0; s->mouse_buttons =3D 0; } =20 diff --git a/qapi/ui.json b/qapi/ui.json index 2b4371da37..9354f4c467 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -905,7 +905,7 @@ ## { 'enum' : 'InputButton', 'data' : [ 'left', 'middle', 'right', 'wheel-up', 'wheel-down', 'side', - 'extra' ] } + 'extra', 'wheel-left', 'wheel-right' ] } =20 ## # @InputAxis: --=20 2.32.0 From nobody Sun May 19 10:57:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1640214125; cv=none; d=zohomail.com; s=zohoarc; b=AnhRtd8rdqHc2hzqQftBt7+cwwg8LhsYee2ZZ3t3X3Fv7UUS5byM8GQjTKJgbxVbxAYGBV8kT49zzFooxlO30oOUW73dMYFI9/peYNz8KKlOLpupBMJFmpWxzQRQDw9Eo7UV2KnhLJlcduK794nhztb1qViGnBP5SFJDsNBqjgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640214125; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4EPIBLrqcRPkiBCNNhoa74v92YzeCHZQl+O4E+MXoyk=; b=WVDhw6/iKrJcjelOlx0VsA64QkGKUidu3nz6vG4Z3jhxK5FX405vliihfh0UHls62DV7+4fuZ06ixwYqAYEmPmVPH//C3JO/hVp2sSdeFFolsubhZCBW6uaFwJiq5BPPgpktkmONeLszSZUXIRQpOTnScn+h4TBbQxIEplEpGXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640214125390689.8925941274916; Wed, 22 Dec 2021 15:02:05 -0800 (PST) Received: from localhost ([::1]:37582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0AcW-0008Cw-DF for importer@patchew.org; Wed, 22 Dec 2021 18:02:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0AWv-0002Hv-NQ for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:22 -0500 Received: from [2a00:1450:4864:20::52b] (port=44829 helo=mail-ed1-x52b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0AWr-0002Q3-GC for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:14 -0500 Received: by mail-ed1-x52b.google.com with SMTP id w16so14151911edc.11 for ; Wed, 22 Dec 2021 14:56:10 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:deba:f393:276b:fad2]) by smtp.gmail.com with ESMTPSA id gv11sm1097226ejc.135.2021.12.22.14.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 14:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4EPIBLrqcRPkiBCNNhoa74v92YzeCHZQl+O4E+MXoyk=; b=WKz0+dlwnMLC/xVOgadwOR8d2DOH2hVqFyxNSDvndhVnSBmSiFETUouFT1lsDwIhsK BoNqYdG4+91orX1RmeqZYjXoXI+/FTkkHteGzQvxU55SsBXHPOapGZY6vBIuG4xqqF9q xW1jS/le1VBUBfm0Wvh+EQUTrST27/Koj6Gl/kqNZwbE+fGWugh4dDQbN8Zuvy64AhyP gQfG6mJ+XYH3OMhUHFHbjnTZ1eVonlAIhmJQAkFu8/fhkKVs9GvHwus6Gkg4V5kp+cSk Ju/gXKDRGAluk0WboDCd5M0GgkN/z6XzW47gBqfufu/dscZXP0vnguiUq9g8wEUIbR+m Ey/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4EPIBLrqcRPkiBCNNhoa74v92YzeCHZQl+O4E+MXoyk=; b=AR3h54DyZrWZV5Rr7NUMHxNmDi0SkaC9Is7H26qasx29RmpAsEgt52CdZ9+n/D7Nd0 4pRMjBjeNrFJyWYuozPQWnhj45j2dJ4nhQkNNdCp/UfJ19zs5/5jsQfNqqUaDKP/hr8H PvvrIt8dM9m/YvCgyTBvW3jDFrIBSFocswWPUBn9lyw2j4YTAsuDz5P6p6B3ufnPBamV hwbRsDQ49aAwUjbnqlDH8Ho8EDvz1nqpEETKP3gbInRs1VHPxwr+MjuwdgUgzEBXR843 X8QtH+jECM1iwbDftvK200CvCb7lPIxXcukc5w5+nJTau1Q0YMjj8ORR1XMq6vCFP0Jr cD5Q== X-Gm-Message-State: AOAM5302qxPCl4hGaSJTvKAlIq3ZSmYsFf7+UoYJXmxoUUxL91qSpy81 Tg7Zp/HAV9D/qlL0E/nDvpeL5lpmapY= X-Google-Smtp-Source: ABdhPJwVPWHPqe7jSl45svIGsF4h3vNIiYei+UZTJo+VDAXOygZZiiWdOK7MAwHohrEKb4UwJW49fw== X-Received: by 2002:a17:906:e0d0:: with SMTP id gl16mr4055100ejb.628.1640213769208; Wed, 22 Dec 2021 14:56:09 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] ui/cocoa: pass horizontal scroll information to the device code Date: Wed, 22 Dec 2021 23:56:03 +0100 Message-Id: <20211222225606.1359162-3-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222225606.1359162-1-dpetroff@gmail.com> References: <20211222225606.1359162-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52b (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Petrov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1640214126973100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Dmitry Petrov --- ui/cocoa.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 69745c483b..ac18e14ce0 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -970,21 +970,27 @@ QemuCocoaView *cocoaView; */ =20 /* - * When deltaY is zero, it means that this scrolling event was - * either horizontal, or so fine that it only appears in - * scrollingDeltaY. So we drop the event. + * We shouldn't have got a scroll event when deltaY and delta Y + * are zero, hence no harm in dropping the event */ - if ([event deltaY] !=3D 0) { + if ([event deltaY] !=3D 0 || [event deltaX] !=3D 0) { /* Determine if this is a scroll up or scroll down event */ - buttons =3D ([event deltaY] > 0) ? + if ([event deltaY] !=3D 0) { + buttons =3D ([event deltaY] > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; + } else if ([event deltaX] !=3D 0) { + buttons =3D ([event deltaX] > 0) ? + INPUT_BUTTON_WHEEL_LEFT : INPUT_BUTTON_WHEEL_RIGHT; + } + qemu_input_queue_btn(dcl.con, buttons, true); qemu_input_event_sync(); qemu_input_queue_btn(dcl.con, buttons, false); qemu_input_event_sync(); } + /* - * Since deltaY also reports scroll wheel events we prevent mo= use + * Since deltaX/deltaY also report scroll wheel events we prev= ent mouse * movement code from executing. */ mouse_event =3D false; --=20 2.32.0 From nobody Sun May 19 10:57:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1640213958; cv=none; d=zohomail.com; s=zohoarc; b=WS1ZBfRb+dUNkoqzRDLJdQK8oveJmuI8X9do4H1B4BQ1RcSBgfA4lal7wLtpOPER9ALJK/BQHonZBcyDBDkBVSLOUtL0eZrcLPSvZ+Wrtx+sVIcl4k2vKz3Uy83F7QM2hD5oaFUwgsuAwWFNXTm6YlW8MqWVab8L4atXxuH4bDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640213958; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5kdp0snb3SFSbv62l+V5oc1HsNnrPydAEd/264gvRo4=; b=bKhSHCBJzwBKrIttmUJmT0O7UvziQtRPrE8DDVInz+c3iY54Xv1Rz9lLZPc28UNFvchEBwQpcGRCSJ2Z+Y/N2FhOKT0XLJkX5QE0ALv8DiozS+JVDx/M6MIjSng14FYRLdoIRKOtic3WAjikNNfgKtoQ7HQQjg++e2ndjDZLyfQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640213958942321.74999735856886; Wed, 22 Dec 2021 14:59:18 -0800 (PST) Received: from localhost ([::1]:60210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0AZp-0004Or-49 for importer@patchew.org; Wed, 22 Dec 2021 17:59:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0AWv-0002Hw-N6 for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:19 -0500 Received: from [2a00:1450:4864:20::530] (port=41678 helo=mail-ed1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0AWr-0002Q6-Gj for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:15 -0500 Received: by mail-ed1-x530.google.com with SMTP id b13so14187775edd.8 for ; Wed, 22 Dec 2021 14:56:11 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:deba:f393:276b:fad2]) by smtp.gmail.com with ESMTPSA id gv11sm1097226ejc.135.2021.12.22.14.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 14:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5kdp0snb3SFSbv62l+V5oc1HsNnrPydAEd/264gvRo4=; b=NxZ15at1KMKLRjpl25D72e5iV1QvciryiNPRySCo5c/+7i+wgd54NEmrIoNIlY387P o0NjISgoADJBr5Fq4+mkSvjGCdj1vvjRZ6frauCmwt+TDkM7oB1ofSyF2HGza6z3ftHu C4n/ixxhTQmTAoujaP5ikZvIfP5b7nglHQl0P6ji/hcMAFnBx8WkWMgMLie3umpfTgy2 Y/TIsHrpbsHGDIB9AVXZxJLiJMrLo70G+3JleHfhR3YJ4kKeWkEZc4+7VOdzcEbH7VU/ khU6cniMpdLJTb5hBFy/1MlEUEP2eNp4bTWx7aEl4Et4TrbpLfE1pC2Fcwggat5Encsy goBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5kdp0snb3SFSbv62l+V5oc1HsNnrPydAEd/264gvRo4=; b=SN+rWjbB7O4wQIo2Lw7CuSG4g+xwH/VdcwnXdoGoSSW6nOK+Pd/t7fynhyRo5pjSeq RhcyqYwE5Ctd4wcg6UaN7iZHxBaMtLG2Q5Ykv51ymB6jff5fOP9Lj/knsInk0BQu4Fki zlWcpmXRTdpxpoapsh7PcpGO/nA0SAhMZYN/XL3tA9+LXUZHXOUy7nxfwOJzzFeu7l2o JW+PFG7mf3iENWrr3ffdRC83u+Xgo+NJmSpW180xdB2Wr/kDfohdxs5F6kMe+QJnKO6o CwMrQKg1Bxe8yxKaC9AYHRr4lkItLBix4K9D8D8qkfaCEpieZ03OhMiQdqMiDjt0jz5W M24g== X-Gm-Message-State: AOAM530wxj0G/tfDns/bCL50ssi8SpEXJz5lczRHTcPwp1Ryvp13zpv0 f+Ys64C8cuoFMPsFut/9d3vaHFWVs5g= X-Google-Smtp-Source: ABdhPJz4Zm5jV6b+fzU7YP5S4O9UI5zWTBGv+1zo/Uuo/TY9t8j6ZrS+2j/tVprTu43yeRgqCNINZA== X-Received: by 2002:a05:6402:16cd:: with SMTP id r13mr4668816edx.264.1640213769815; Wed, 22 Dec 2021 14:56:09 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] ui/gtk: pass horizontal scroll information to the device code Date: Wed, 22 Dec 2021 23:56:04 +0100 Message-Id: <20211222225606.1359162-4-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222225606.1359162-1-dpetroff@gmail.com> References: <20211222225606.1359162-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::530 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Petrov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1640213960677100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Dmitry Petrov --- ui/gtk.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 6a1f65d518..a8567b9ddc 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -968,33 +968,63 @@ static gboolean gd_scroll_event(GtkWidget *widget, Gd= kEventScroll *scroll, void *opaque) { VirtualConsole *vc =3D opaque; - InputButton btn; + InputButton btn_vertical; + InputButton btn_horizontal; + bool has_vertical =3D false; + bool has_horizontal =3D false; =20 if (scroll->direction =3D=3D GDK_SCROLL_UP) { - btn =3D INPUT_BUTTON_WHEEL_UP; + btn_vertical =3D INPUT_BUTTON_WHEEL_UP; + has_vertical =3D true; } else if (scroll->direction =3D=3D GDK_SCROLL_DOWN) { - btn =3D INPUT_BUTTON_WHEEL_DOWN; + btn_vertical =3D INPUT_BUTTON_WHEEL_DOWN; + has_vertical =3D true; + } else if (scroll->direction =3D=3D GDK_SCROLL_LEFT) { + btn_horizontal =3D INPUT_BUTTON_WHEEL_LEFT; + has_horizontal =3D true; + } else if (scroll->direction =3D=3D GDK_SCROLL_RIGHT) { + btn_horizontal =3D INPUT_BUTTON_WHEEL_RIGHT; + has_horizontal =3D true; } else if (scroll->direction =3D=3D GDK_SCROLL_SMOOTH) { gdouble delta_x, delta_y; if (!gdk_event_get_scroll_deltas((GdkEvent *)scroll, &delta_x, &delta_y)) { return TRUE; } - if (delta_y =3D=3D 0) { - return TRUE; - } else if (delta_y > 0) { - btn =3D INPUT_BUTTON_WHEEL_DOWN; + + if (delta_y > 0) { + btn_vertical =3D INPUT_BUTTON_WHEEL_DOWN; + has_vertical =3D true; + } else if (delta_y < 0) { + btn_vertical =3D INPUT_BUTTON_WHEEL_UP; + has_vertical =3D true; + } else if (delta_x > 0) { + btn_horizontal =3D INPUT_BUTTON_WHEEL_RIGHT; + has_horizontal =3D true; + } else if (delta_x < 0) { + btn_horizontal =3D INPUT_BUTTON_WHEEL_LEFT; + has_horizontal =3D true; } else { - btn =3D INPUT_BUTTON_WHEEL_UP; + return TRUE; } } else { return TRUE; } =20 - qemu_input_queue_btn(vc->gfx.dcl.con, btn, true); - qemu_input_event_sync(); - qemu_input_queue_btn(vc->gfx.dcl.con, btn, false); - qemu_input_event_sync(); + if (has_vertical) { + qemu_input_queue_btn(vc->gfx.dcl.con, btn_vertical, true); + qemu_input_event_sync(); + qemu_input_queue_btn(vc->gfx.dcl.con, btn_vertical, false); + qemu_input_event_sync(); + } + + if (has_horizontal) { + qemu_input_queue_btn(vc->gfx.dcl.con, btn_horizontal, true); + qemu_input_event_sync(); + qemu_input_queue_btn(vc->gfx.dcl.con, btn_horizontal, false); + qemu_input_event_sync(); + } + return TRUE; } =20 --=20 2.32.0 From nobody Sun May 19 10:57:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1640213960; cv=none; d=zohomail.com; s=zohoarc; b=mdyvgJzYtTD0SX8s9UL+P+xyWf8iMStq2Pn1VpxeSzn6zBplam1PMYt6HkjkDJtQRi1ZnAGw/zz4RuM3EJ9vvg9X7V2tih3uENIgl6ES2wiNb+zHcgPQgCR1yAANfpoVItEc4QJgHIfVj3ZLH79B123mEPNFPGpN3Bf9P7nGVY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640213960; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pyjnlbM1xVRCEuPnUEKS3/v5vZFiQrHwvnK44ISZw2w=; b=NdM/dY7oRXeyxgaytEUoEnhQzCGXWKcsuIcVlGlaCE/B6Kr6Kg5ejD6pQfiQO/5wPmLhRV50q+2kzvhOI+1NL/b+bb9tBFZ2gwy9cw1Agh6laW5waLxqkOoS6I0ibWX9mt7M+ZU5XFAycMpqdhTwhY52NXOlx/9NH/eYfkeBcaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640213959996899.2998176009845; Wed, 22 Dec 2021 14:59:19 -0800 (PST) Received: from localhost ([::1]:60318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0AZq-0004TG-I2 for importer@patchew.org; Wed, 22 Dec 2021 17:59:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0AWv-0002Hu-N6 for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:19 -0500 Received: from [2a00:1450:4864:20::535] (port=33598 helo=mail-ed1-x535.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0AWr-0002QC-HI for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:15 -0500 Received: by mail-ed1-x535.google.com with SMTP id m21so15518919edc.0 for ; Wed, 22 Dec 2021 14:56:11 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:deba:f393:276b:fad2]) by smtp.gmail.com with ESMTPSA id gv11sm1097226ejc.135.2021.12.22.14.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 14:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pyjnlbM1xVRCEuPnUEKS3/v5vZFiQrHwvnK44ISZw2w=; b=QTXc8+NBCnI6Dqa67MkpcwH/c+2xtxPDqCuKQfbGtg+j3dDYRBWnSqGpRkPoqIWajM nUPpXJCR2IvXnsXl7rfpQMeEKhY1Bq2iSi244lHsMlN5UdcAVBuZ04zY6ng1HLEi1b3+ uOJmztc4GdwR5YDlzrwG6/IL8rCehDSrkmDe9l+L5XdNh0OPGtdDpjHWrn0zDWMdHg1G D/S2wmehXRJjenF/FPIeLOsaRF0ELOJ+qIp/9QbSzZnBMhJqfwCuVeZPEtBbrFd62/4X x7khens04f6SeYkUlwvjwSe7TcJ29TcIuyU49DSktLZRlrulaBtCplAnuBoFry5sPNn9 8tlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pyjnlbM1xVRCEuPnUEKS3/v5vZFiQrHwvnK44ISZw2w=; b=VY5S1clLgLI4Z72PEtf+PMwbb32qjoz2RHxfp0kWkE85DJxjJDo570zdv0JtpG0AlV wx+bRXpANfmcWOlorG7WaLUdR6htHsBL2yreAnK0jENsFy5jdPxZfiMJtkJgcPf4c5lU QJu16smrg9bq5QFfuGby/fxLX4iX+WlWZ9FeTNqlYBN/2Y/Tj8vUe8faEnJs9Ce6DSPn c2lhoLdocWmAeF/TmLT6LcWTV2DeOkgVqQHftJ16Xq5Qr+zHwhz96hFw6aThS6IfPgB6 dfK3bn69QQM5GnJucHpkfJNDlr9EDv4+9fLmfeXsBAqIm6fhnwwuKe92sioOqZ6CvVWw dAyg== X-Gm-Message-State: AOAM5327rTIAmQtez6CP6iGfKr9XnedI5K1CbSS27EwjqcaKmfwzu8AG 4QzNHTYgVnjkicazNnxy7OfElb68rAg= X-Google-Smtp-Source: ABdhPJwlc1rUHITiJ214T2bFx7XF5IwdbDmPN/nmlLxXRgGkPV4oWsTe+zXDDnCx0rtW8VeppOlREg== X-Received: by 2002:a17:907:86aa:: with SMTP id qa42mr4085912ejc.106.1640213770501; Wed, 22 Dec 2021 14:56:10 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v3 4/5] ui/sdl2: pass horizontal scroll information to the device code Date: Wed, 22 Dec 2021 23:56:05 +0100 Message-Id: <20211222225606.1359162-5-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222225606.1359162-1-dpetroff@gmail.com> References: <20211222225606.1359162-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::535 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Petrov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1640213960703100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Dmitry Petrov --- ui/sdl2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 0bd30504cf..46a252d7d9 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -33,6 +33,7 @@ #include "sysemu/runstate-action.h" #include "sysemu/sysemu.h" #include "ui/win32-kbd-hook.h" +#include "qemu/log.h" =20 static int sdl2_num_outputs; static struct sdl2_console *sdl2_console; @@ -535,6 +536,10 @@ static void handle_mousewheel(SDL_Event *ev) btn =3D INPUT_BUTTON_WHEEL_UP; } else if (wev->y < 0) { btn =3D INPUT_BUTTON_WHEEL_DOWN; + } else if (wev->x < 0) { + btn =3D INPUT_BUTTON_WHEEL_RIGHT; + } else if (wev->x > 0) { + btn =3D INPUT_BUTTON_WHEEL_LEFT; } else { return; } --=20 2.32.0 From nobody Sun May 19 10:57:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1640214117; cv=none; d=zohomail.com; s=zohoarc; b=k1tSJ1WsITmv/dCz6tffRe8gpHrDujFek/cKEmo4asRJvObcbAdFpRa1grZv70vKLkoHrVqWibHnB1++0SMp75L1x5XFAN4qgIt+H4ZygD2xgeEuoRiYWEByRb8pGg0kphQblkzcwaGqPuCmcJy4i0+0d3MnO75QynGJ73MmrZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640214117; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7cxUbOU/d0PmlHVogfci1RL4+M00MXtpxpVMs5qcbZQ=; b=WPJL7L/yqhX/qza3AZRjuPn2tQuD40RaCZGMkfIMciLfiUy0k4C5vEhBhTnYDM2WVB3M5TE1cjmrOrhbZX/eDs+/4WsTHzNZrSS3j1MswcnxRK8qSaZhKV+DEZKw+AuCJOU3Kl1I0S8p3kt+6ux7yQfe/2cMjJ4L6ZYp1vxY9/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1640214117364991.4242760669084; Wed, 22 Dec 2021 15:01:57 -0800 (PST) Received: from localhost ([::1]:37434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0AcO-00085S-7k for importer@patchew.org; Wed, 22 Dec 2021 18:01:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0AWv-0002Hs-NJ for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:22 -0500 Received: from [2a00:1450:4864:20::52d] (port=33591 helo=mail-ed1-x52d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0AWr-0002QG-GL for qemu-devel@nongnu.org; Wed, 22 Dec 2021 17:56:14 -0500 Received: by mail-ed1-x52d.google.com with SMTP id m21so15518986edc.0 for ; Wed, 22 Dec 2021 14:56:12 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:deba:f393:276b:fad2]) by smtp.gmail.com with ESMTPSA id gv11sm1097226ejc.135.2021.12.22.14.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 14:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7cxUbOU/d0PmlHVogfci1RL4+M00MXtpxpVMs5qcbZQ=; b=moN6KU4+YvVIqByUQn17MphwX+4S+pZFeXc+JlWhqJgmU9YjXxz0i5JAtw+ipJC8AW LKXND+kI7xKFQz/kA/ITuKEW7TXyOOfL1fHy6ymDxTEy/FI4koX52iUZTv6dHcUYWIp6 zgn3p1BXFvMvatEpPQZuQtCwejZt4Pz5MSYFwGlkADHRjoYywfoPtChA2cE8uxO4kTLe 5ooeHzVEYXjZ2syro5MjRp9ll2LoLnIKl8weG1GIGE/ZEuj0kHyxv2h2gGsaHumC+OBW Fv3U+BqyWQ3tGUkmDLmG9+jff8OQQpGPo6/mt2ONLsHV8ZQDJ5vv8xRfSyEcfgdNx5rp X21A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7cxUbOU/d0PmlHVogfci1RL4+M00MXtpxpVMs5qcbZQ=; b=OYOfmjYXBnrCTShCTEVxdYa513ismQXTSyhkqbSAGloivZoZB3ZK2vzIu3+OvCZzWm y0tRinHMJ6Fs6Njz0jvdNjmRXfr2EL/Aftmplqb480T0hLM3fRsgdX3IxqATt0B64IJO +/M2XD7JrWRArFEuHuUQ4gjL6CaPXQUtzqA326dl30wP8Utk7W78f3f/kB5llDWQ5fOJ x4ZRx3ic5FTIvC5/ZKA4q/sk8X/BmfbXObY2Ln/QMUf7hk5fnb/U6yaNHM5A+fEgKdtj ejt2UZ64mqj3DU9o5NBRDIr675+VLvqBvEBlM3DahCfbxqnOKHXxcUM/lW9ACt5zOj9h cJew== X-Gm-Message-State: AOAM532/E2qDZ4OQvXCk2L3R8LS8yw6F5v91HNEHC2A5r2VtO0LFJ5CC 6B1GOKRiNRHHwd+CNheRQu1KSbfH5w8= X-Google-Smtp-Source: ABdhPJw2BGSAJkRiN5zlRWYpNoHKAYPKrHtu8UYpYQ2Iqiw8JBzLZwW07cPGrX143tFJJhM+DVIOEA== X-Received: by 2002:a17:907:96a0:: with SMTP id hd32mr3938838ejc.677.1640213771060; Wed, 22 Dec 2021 14:56:11 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v3 5/5] ui/input-legacy: pass horizontal scroll information Date: Wed, 22 Dec 2021 23:56:06 +0100 Message-Id: <20211222225606.1359162-6-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222225606.1359162-1-dpetroff@gmail.com> References: <20211222225606.1359162-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52d (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Petrov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1640214118560100001 Content-Type: text/plain; charset="utf-8" This code seems to be used by vmport hack, passing these values allows to implement horizontal scroll support even when using vmport. In case it's not supported horizontal scroll will act as a vertical one. Signed-off-by: Dmitry Petrov --- ui/input-legacy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 9fc78a639b..46ea74e44d 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/log.h" #include "qapi/qapi-commands-ui.h" #include "ui/console.h" #include "keymaps.h" @@ -179,6 +180,20 @@ static void legacy_mouse_event(DeviceState *dev, QemuC= onsole *src, 1, s->buttons); } + if (btn->down && btn->button =3D=3D INPUT_BUTTON_WHEEL_RIGHT) { + s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, + s->axis[INPUT_AXIS_X], + s->axis[INPUT_AXIS_Y], + -2, + s->buttons); + } + if (btn->down && btn->button =3D=3D INPUT_BUTTON_WHEEL_LEFT) { + s->qemu_put_mouse_event(s->qemu_put_mouse_event_opaque, + s->axis[INPUT_AXIS_X], + s->axis[INPUT_AXIS_Y], + 2, + s->buttons); + } break; case INPUT_EVENT_KIND_ABS: move =3D evt->u.abs.data; --=20 2.32.0