From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Touch events Date: Wed, 28 Jun 2017 22:06:40 +0100 Message-ID: <20170628210640.GB74167@breton.holly.idiocy.org> References: <20170624085335.GA10629@breton.holly.idiocy.org> <20170627200807.GA73858@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1498684017 32294 195.159.176.226 (28 Jun 2017 21:06:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Jun 2017 21:06:57 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: Emacs-Devel devel To: Anders Lindgren Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 28 23:06:52 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQKAj-00081p-ES for ged-emacs-devel@m.gmane.org; Wed, 28 Jun 2017 23:06:49 +0200 Original-Received: from localhost ([::1]:35668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQKAo-0002sS-LD for ged-emacs-devel@m.gmane.org; Wed, 28 Jun 2017 17:06:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQKAf-0002sJ-Nt for emacs-devel@gnu.org; Wed, 28 Jun 2017 17:06:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQKAe-0005gU-Ia for emacs-devel@gnu.org; Wed, 28 Jun 2017 17:06:45 -0400 Original-Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:34928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQKAe-0005eu-BL for emacs-devel@gnu.org; Wed, 28 Jun 2017 17:06:44 -0400 Original-Received: by mail-wm0-x22b.google.com with SMTP id w126so64654287wme.0 for ; Wed, 28 Jun 2017 14:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1xNE4fMolLtngFF9VtZNCbr1HLl29S1anFGEF9RttY0=; b=fZc2HU+jhsBoPmf0nAuwdm2UPcf+pMC/axAZKDwyFvXKfTRjhuoBzLi8uHONX7wwQJ X7P9IKJcZ/gIvhFvCzrxy6Fya5oY0knMLUSlzDKG7YxpJpKzCmDXwo4/qneims2+VWrH MfyGoHEsAMTHjGQVPKN8fjqeiRl6JRs6YyQBRX4q8OlJJIa05QQoO964CVaVuRM8eVus hrx6yZHJbogArWLge90ei6sJ+WBPhK4DUDOJx8WcHw89FVD1tYHR/dHj1wPOldVLFlSu ZomBf1atx8xtekpgkqgvZrOb9FLZ/iDIPCyERfvVPGDkRG7MnVYawWLo5XpDMyluacK3 I44A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=1xNE4fMolLtngFF9VtZNCbr1HLl29S1anFGEF9RttY0=; b=FOmCCC+X7y0RmCUEHut70C77HSY4FwJD86Mybop5zh/26t8e9D0fV4MXFLmeS0lQ6O 0qnjLsiMxkHg/tgXgLoBJ6a/Z8eTJrYxLUe2qBaNt8y32ZD/7jbdS76JUqm9p9dGXxeI dMweyrCqDEhp9LHdiiIbNzi6WcWlY0XPKOXdBtBmD3Z1CefvFth9tjpquyA/uzJypdK2 Q7OO1Fc50IfGWVAOAcCS4t0QMJpR+OP78AmRa3x1SwYoCzXq3BiBMyjmFaKk6hkDnpUj aH1fgj7HohnZ0rKXpwBc8qhWPWU7WIZ4/sA36TF2EgJTKbzu7jM/lVLJYbt6M5lIEF+1 gprA== X-Gm-Message-State: AKS2vOwOYx7eZAw35xb2BA/wixRgt3Lx4x6cqA8Mf4D/f/125DSOcjcR aSVchQ02Ydag6Q== X-Received: by 10.28.22.4 with SMTP id 4mr8700191wmw.68.1498684003226; Wed, 28 Jun 2017 14:06:43 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-205b-50d9-f643-4e78.holly.idiocy.org. [2001:8b0:3f8:8129:205b:50d9:f643:4e78]) by smtp.gmail.com with ESMTPSA id 201sm8855301wmy.15.2017.06.28.14.06.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 14:06:42 -0700 (PDT) Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216041 Archived-At: On Wed, Jun 28, 2017 at 11:40:13AM +0200, Anders Lindgren wrote: > > > > I’ve kept a separate ‘touch-scroll’ event as the mac port just embeds > > that into the mouse-wheel events, but I feel there’s an argument to be > > made that they should be handled differently. > > > > One thing that has annoyed me with the existing mouse-wheel events is that > macOS sends implements a kind of inertia, resulting is a sequence of events > a few seconds after I've stopped scrolling. Furthermore, if I have pressed, > say, shift while scrolling and release the shift key while the extra events > are arriving, the remaning events are treated as though they were > unshifted, possibly executing a different Emacs command. What makes scrolling with the trackpad on macOS so awkward is that Cocoa is expecting the application to implement smooth scrolling, so it sends events at a fairly high frequency. These events have pixel based deltas, which are very often less than one line‐height. Emacs sends one wheel up/down event per NS event, which results in far more scrolling than expected. The correct way to handle it is to add up the deltas until they exceed one line‐height, and then scroll the relevant number of lines. I’ve tried to implement something like that in lisp/touch.el in the scratch/touch branch. The other part of this is momentum. We should probably add a customisation option to ignore events from the momentum phase. I wouldn’t want to always ignore them, because people might expect Emacs to scroll the same as other macOS apps. Especially if pixel scrolling is available. > It would be good to be able to get a single event for swipe commands (even > though the inertia is useful for some commands). > > Ps. In the package https://github.com/Lindydancer/multicolumn I've > implemented support for moving to next/prev/first/last window using > horizontal swipes. To get around the extra events passed by the macOS, I'm > using timers to silence scroll events for a while after a command has been > handled, which clearly isn't a good technical solution. Cocoa has a ‘swipe’ gesture separate from the normal scrolling gesture. I don’t know what the difference is as I haven’t seen the swipe gesture events showing up in my emacs yet, and I can’t find any description of them online. It’s possible they’re a three‐finger gesture, which are normally intercepted by the WM. I believe you can turn the interception off. -- Alan Third