From patchwork Fri Jul 6 02:53:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 10510525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE25560532 for ; Fri, 6 Jul 2018 02:54:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD2ED2851D for ; Fri, 6 Jul 2018 02:54:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1B8C2852C; Fri, 6 Jul 2018 02:54:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 82AFC2851D for ; Fri, 6 Jul 2018 02:54:50 +0000 (UTC) Received: from localhost ([::1]:55579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbGtV-0003ar-At for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Jul 2018 22:54:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbGsp-000398-OE for qemu-devel@nongnu.org; Thu, 05 Jul 2018 22:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbGsk-0006U9-Tn for qemu-devel@nongnu.org; Thu, 05 Jul 2018 22:54:07 -0400 Received: from mail-io0-x241.google.com ([2607:f8b0:4001:c06::241]:46985) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fbGsk-0006Tn-Oz for qemu-devel@nongnu.org; Thu, 05 Jul 2018 22:54:02 -0400 Received: by mail-io0-x241.google.com with SMTP id p7-v6so9575956ioh.13 for ; Thu, 05 Jul 2018 19:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dW9aG5uMzFDYFYhECaDgGWKWMaGi5VYzpSJPZgZQgRQ=; b=Iejo9oJzANPC8j4vF7EifRq/+/8TkG+mr/6gwEMk6y6Ti50QRRvaSn+BrkFSO/v4g2 LdDITiFv0CSggkfwCjOtc2yY8wc0BJtecFrqtNDviflOVji6kmThYnY3vBnEVzg+bY4E Z16IJ3lD9pAbo2SgmJP/tfaLqurOQM9uFKvZtazj32nYdUEKT5Rmvp0ybuVj74SAtvFk QWIpVPj/zeB3DIUc1gfcjoET3BnDMmPr75veVxw5RzOyX7T+xOtPqDaB/uVRaoACfBsl gO05NA1Q075WXzslsgyhM1sVzmC1+eXHl3MNgtpkgzeA5sKIot8IKgGgh9MSU0YIKKmy bBag== 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; bh=dW9aG5uMzFDYFYhECaDgGWKWMaGi5VYzpSJPZgZQgRQ=; b=l7RQk2o5yBXggzgjPL7WaG5FTPE0J9MnlKVgZQh/LEs8lTbR9i2WUc6AoZgagIVw9d eGguomzKZOSfooMbi+DQaqai+lh+AucDLBYbuPAy01wrtSrCGsrWXdh24g3/3tKMDu/4 W+/N1NgNAzTbaq75csfobUZj5mjr4a+h/L/lbI5IkVRmYbX2XUr83d9etAT+8s3S+qwU MioaLb/kwLxyCToKfM3HNXe+coflAtAMeYRbMO+l4z17BP0sV86KEyuxMwgx/giXCJcy mLumlu3HNw6+MJAZBkePM4zT+GtkLC1VBMoglyNzEx+yQHYLFxGzRUiGMf5zQ2bE3sp5 odWg== X-Gm-Message-State: AOUpUlEbEcPsiFzCmHJfkdVZxkEX1Bfi7fnQr+hR+SzbrCHLHeH71p3c HeNkwCR8BhOfdL62m4KbGys= X-Google-Smtp-Source: AAOMgpeFwCzMmF2fyWIIpN23CiWi2AIyEOonl/TKw9tfp7zICVnhQOlGGNh7MjpvjVBuRvYzzHlPpw== X-Received: by 2002:a6b:dce:: with SMTP id 197-v6mr4591046ion.122.1530845642037; Thu, 05 Jul 2018 19:54:02 -0700 (PDT) Received: from localhost.localdomain ([69.14.184.20]) by smtp.gmail.com with ESMTPSA id m66-v6sm1885088ite.0.2018.07.05.19.54.00 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 05 Jul 2018 19:54:01 -0700 (PDT) From: John Arbuckle To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 5 Jul 2018 22:53:52 -0400 Message-Id: <20180706025352.42643-1-programmingkidx@gmail.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c06::241 Subject: [Qemu-devel] [PATCH v2] ui/cocoa.m: replace scrollingDeltaY with deltaY 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: John Arbuckle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The NSEvent class method scrollingDeltaY is available for Mac OS 10.7 and newer. Since QEMU supports Mac OS 10.5 and up, we need to be using a method that is available on these version of Mac OS X. The deltaY method is a method that does the same thing as scrollingDeltaY and is available on Mac OS 10.5 and up. So we simply replace scrollingDeltaY with deltaY. Signed-off-by: John Arbuckle --- v2 changes: - Added a condition that drops scroll events that have a deltaY value of zero. ui/cocoa.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 2991ed4..f371469 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -802,14 +802,15 @@ QemuCocoaView *cocoaView; * This is in-line with standard Mac OS X UI behaviour. */ + if ([event deltaY] != 0) { /* Determine if this is a scroll up or scroll down event */ - buttons = ([event scrollingDeltaY] > 0) ? - INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; - qemu_input_queue_btn(dcl->con, buttons, true); - qemu_input_event_sync(); - qemu_input_queue_btn(dcl->con, buttons, false); - qemu_input_event_sync(); - + buttons = ([event deltaY] > 0) ? + INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; + 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 * movement code from executing.