From nobody Tue Nov 5 06:44:00 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=1641656498; cv=none; d=zohomail.com; s=zohoarc; b=LHml48m4vrN+trvNBXEC/E8qdD9lG+CqUA6/4Gq4D1YMFY6lrgVDp/Cq++Ijpduo+2uvLKE7cWEUpU0V9BeL8lbX5d+g6UOO/0vWndDDGA2vwoRbS3pjaHForEqeoJ34OuNbb6Wna4kX7qsqebdca1ZsIiUkDU3yezshKCRpNwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641656498; h=Content-Transfer-Encoding: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=KKWENYEy1fAfbRSMs9ERJO7oegP5WdQaabuz0GGfaRRpkU6mG9JWiqUoPH+a7HP1xvqICn5IY1tThd1llosHrysM+leGHdDQvv7f3Ex5f4tj+35WQZSXN+3oZ85Zru+D/QJzZnz6KL1X+ydZfMKPAWb6dWVE41kEBrRMg7fHhcg= 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 1641656498405983.813397961641; Sat, 8 Jan 2022 07:41:38 -0800 (PST) Received: from localhost ([::1]:49354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6Dqb-0000Na-DP for importer@patchew.org; Sat, 08 Jan 2022 10:41:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6Dov-0006h1-D0 for qemu-devel@nongnu.org; Sat, 08 Jan 2022 10:39:53 -0500 Received: from [2a00:1450:4864:20::536] (port=33678 helo=mail-ed1-x536.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n6Dot-0006oY-8O for qemu-devel@nongnu.org; Sat, 08 Jan 2022 10:39:53 -0500 Received: by mail-ed1-x536.google.com with SMTP id m21so34620516edc.0 for ; Sat, 08 Jan 2022 07:39:50 -0800 (PST) Received: from localhost.localdomain ([2a02:a467:f77d:1:78f2:78aa:23a7:b824]) by smtp.gmail.com with ESMTPSA id 24sm599840ejg.47.2022.01.08.07.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 07:39:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5kdp0snb3SFSbv62l+V5oc1HsNnrPydAEd/264gvRo4=; b=cF7KydOBopk4Nxjrf+nIvjtmvATI2ch0VW6xLOjBF7UTWzU/SfldqXlcYrpRNEsI0j mejDiFhY/cFzEhD9i7ZpA9jm5hkr5hjEhcHNiytkNrdhHpPBghEkSDwAoWWrzuFJ5LFa xlf+DCIRq7UpiC0x1268H4jVTVL5A4YnhFtHGHt94bsouAzTQV1SbQLB+BzFuxiSfSAb ZX0swjAnxzl5S0KZJWAv7IWHdGxd3eX6sExPnJk75/eSaYE17HdYeLvB9ue1Y5xhhFt7 KiDPGUbA1Xe2mPuxKhTXj/oJGvgF1fRlhwLdKGxu74u7A5oP0I7Dp0EUoWEUynqJB4tg 9W/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5kdp0snb3SFSbv62l+V5oc1HsNnrPydAEd/264gvRo4=; b=6LatggJhOyoOYn0PMCWnCrp4u2dhEhQgllEw1cMtaUvmE9bfznMYpAupKNph0+T4E5 B2AaEy4s4FSzm7CQcjzwzTCZ/eZ30nyl1qqMsphdY8vkbOYi+S9sm6ngWcoZAjnXk4Hg d6xcyuzSli5Y3001mVDPuffesAkO9O9FxgSVuTj4I9PKkHhyA4Mn4FQgTKfCWS4s2xtd sKxGLyIjKb85aa+lSwfI7O5KL5RphshFxF7SOqd1QzfbiSFq7T2Y3YYCEQCiselb0+Tn A2k7mxbwWzfto49k00LcJvMmim5NcsFoaFU/GucRPNXx+/Xet8NKlIe6BJQeBIGmeF+5 rv1A== X-Gm-Message-State: AOAM532fsnhMSjencv9iN6iKzA/P/6AHkYiTln0Jj4sf4lFLZygwW/HA kkXExC5TKHDfl5w63GEgI3kB6nbvbkk= X-Google-Smtp-Source: ABdhPJzzGbGtzh8hBPim874rV9k+CuFfdZ53UkReTBu6KG07OryTx+j3ELkkiPEL2KHNOfHJ2AQxhg== X-Received: by 2002:a17:906:d184:: with SMTP id c4mr8971030ejz.20.1641656389875; Sat, 08 Jan 2022 07:39:49 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org, dpetroff@gmail.com Subject: [PATCH v4 3/5] ui/gtk: pass horizontal scroll information to the device code Date: Sat, 8 Jan 2022 16:39:45 +0100 Message-Id: <20220108153947.171861-4-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220108153947.171861-1-dpetroff@gmail.com> References: <20220108153947.171861-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::536 (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::536; envelope-from=dpetroff@gmail.com; helo=mail-ed1-x536.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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1641656501004100001 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