From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51050C433F5 for ; Wed, 22 Dec 2021 01:32:02 +0000 (UTC) Received: from localhost ([::1]:56402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzqU5-0003Yd-8t for qemu-devel@archiver.kernel.org; Tue, 21 Dec 2021 20:32:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzq5l-0001vr-32 for qemu-devel@nongnu.org; Tue, 21 Dec 2021 20:06:53 -0500 Received: from [2a00:1450:4864:20::52d] (port=38448 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 1mzq5j-0002ap-KZ for qemu-devel@nongnu.org; Tue, 21 Dec 2021 20:06:52 -0500 Received: by mail-ed1-x52d.google.com with SMTP id bm14so2001031edb.5 for ; Tue, 21 Dec 2021 17:06:51 -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=1nJjGqAUFoJfmNlJcGqfL4WFstPGoEPLfTmpfwCrVkQ=; b=A1MKzoaNR/FxoeeaFd4Kp0nEh22Lea0YUEfSuU9EZenRME5usrLmuZbiBHjigasz5i YiGuBM6nLdvJbqFu2M5wcsQ1UwQk9rEnDccVDO3OHapUeu/zXWh6c5+rRbyeQQSzJz6Q C5ectyfaGOp9s5EI0BkmOKGw1xGc4/fOU5inurWJY4SPb0qcT6v3s/USlefe/pckVzco /thwHuSPxakmjs8lDisrO3SBb6xhAyp8QPLb+nT5VWSIE1p13SM96adVRZUC+fPFHwnk EN/tVVJ5/xlRtOXY19wU8Aiehf3IZ6y3nsnpM48UIHYHbGMNLD0GuI/Yuj4+/1LLyzIX yW3A== 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=1nJjGqAUFoJfmNlJcGqfL4WFstPGoEPLfTmpfwCrVkQ=; b=eVJo2msLgO/ULiGc7PVX9B6ZZ4zDWqMftDnVhweT5MRkWvCkfqtSEoYownoBQHRbu9 iSxMfHQab87ThwRpayo5YBftGN2F9vJU4tVCk5q+IPib/J/xvxHty7LdJL1Vx/KiZO/M QpzlH20YVare7a1Jf/HHF8Bs3ah+JOO3lKnykc+jxfzSf8J7EdBTkP9Lt8EPnLpVF9tk myAem9n/Rk+twJi1g3h43EZWBlcDxqPSpvOkhAPbYlhWBcXuUrK/Iclp00/uG5rhRZaI GL6Lb7NKvfKfVAapxfENxLsa2k2FkE6k6zXtWioqZVL71iZGQzkm+HILbw1hmfJ/RpTx TmkA== X-Gm-Message-State: AOAM531h8iQ6AMtjQP30lDCbyNmV46As26uFDvrsL65R749eFVc5G9hS SUr0lzjuWeyNdNd72Z07/H/hvvw1/mk= X-Google-Smtp-Source: ABdhPJz68b2C9MFTqZmmGb58LDyMwPdFR1IYZonh09laZ9ao6F2RHzNPjHaDL316BDb1l6qBDEK4cA== X-Received: by 2002:a05:6402:1e8a:: with SMTP id f10mr784546edf.52.1640135209833; Tue, 21 Dec 2021 17:06:49 -0800 (PST) Received: from owl.kpn ([2a02:a467:f77d:1:e6fc:be30:e400:3c3]) by smtp.gmail.com with ESMTPSA id nb20sm125199ejc.25.2021.12.21.17.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 17:06:49 -0800 (PST) From: Dmitry Petrov To: qemu-devel@nongnu.org Subject: [PATCH v2 2/5] ui/cocoa: pass horizontal scroll information to the device code Date: Wed, 22 Dec 2021 02:06:44 +0100 Message-Id: <20211222010647.1332479-2-dpetroff@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211222010647.1332479-1-dpetroff@gmail.com> References: <20211222010647.1332479-1-dpetroff@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52d (failed) 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-Mailman-Approved-At: Tue, 21 Dec 2021 20:24:47 -0500 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 68a6302184..22a1f6776e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -970,21 +970,27 @@ QemuCocoaView *cocoaView; */ /* - * 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] != 0) { + if ([event deltaY] != 0 || [event deltaX] != 0) { /* Determine if this is a scroll up or scroll down event */ - buttons = ([event deltaY] > 0) ? + if ([event deltaY] != 0) { + buttons = ([event deltaY] > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; + } else if ([event deltaX] != 0) { + buttons = ([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 mouse + * Since deltaX/deltaY also report scroll wheel events we prevent mouse * movement code from executing. */ mouse_event = false; -- 2.32.0