From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: master 101bbd1392: Add support for pinch gestures to the XI2 build Date: Sun, 26 Dec 2021 18:03:31 +0800 Message-ID: <87fsqf65u4.fsf@yahoo.com> References: <83r19zq0l9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11228"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 26 11:04:51 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n1QOY-0002fe-Sl for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Dec 2021 11:04:50 +0100 Original-Received: from localhost ([::1]:55954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n1QOW-0006Ii-Pk for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Dec 2021 05:04:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1QNS-0005cJ-M3 for emacs-devel@gnu.org; Sun, 26 Dec 2021 05:03:42 -0500 Original-Received: from sonic316-22.consmr.mail.ne1.yahoo.com ([66.163.187.148]:40782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n1QNQ-0000h6-On for emacs-devel@gnu.org; Sun, 26 Dec 2021 05:03:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1640513019; bh=IFxgAgijhfJI1BhsmrgohgwEN00n2+sLRl8TFsqDc5Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=HICVi709YO6ptOluQVfhLSl6lULuoAf22YaeRcpfdeZRcbWosVUvEt30iEo61HNcQMdZ4pZOPY8QK9ysaojz3Fe8Ax+qEAfY63PXc/1rwlZeJFiHnmCp7gmd/FWj65FMhaVHfya/A1+83Mk9+czWJPAyKK/FjDfpRfnOJXjPkbAOVZEWuoyReGqSZ1snexOdkqYrEeO/yS9VgsmDgXx0wjch7Wu+r5bBlQJ/b6pg6VfmQys69AfSBbTLlbId2UtzXvGmGt7dNCn2HsehMdt0UKQt/J70uEBT911du1VmriAApl5SsjZ4/ftOfggdIiH+ARrkO1YH+sXVv9bD1gbZWQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1640513019; bh=np41x6VmlKkGxHj10/pv8h2j470REl207+/ZYpipycc=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=m8iq0G0Sdgd3s+LbBF3OwY9tjkDe3HUrcLu0Ty0qPvh13l4SM2rUS4/If0MUrfZ82e1l5yosTE4bpXZWMV+ei/0ENXh4WC+9zEq2qD0ByjUV8FQwqAa6Jetc+wgk/3Yo2znEMFsUWUMtVK6tDORfNYoCn3x7CmxCBi3TSgweVLMOPPfFWRQPAlBHi/UuFV7vn/f1lHBGulM/RwVNHarqtlv5miT+ZquwDEsoR34O5lL0ACvV9GMsapF52tFxa3NjhCATWE9if7Zr7twiVC1P5M2VU1y7/fVxFMZrFx8bQxIag8cGRlGP/EjGoqXnPqaA8DU07aselyzKWQKGyr31JQ== X-YMail-OSG: AiIRugIVM1mn_1j1ZLp5.jzvxW_tOYFKmfksntI1bM1.fvsgG4u_fLmValo8PXW bYkHFsRtsE01j3tPd8T7CegdTIGmBdBWjKK.3t7OPcMzCKCbPLVO8y_a7IKcwjy9YEHFPoefRlJO D._dJUJL306Kq.q6M_BT21GXMYUHDyzuHptyeA0XnirzOlqa4L.Gdwg6jL5YzzhuNgLOXWkFUH5C kmFaDgzWklx.RDmjjaWvjDgLvbrtjkshwG308V7oVMiNsuHjDIvIWEaN8UlF48JxW8Wl9YXfylmn DZ7EbeBdEiJGHUki5sislMrfVraPem1uyEkhvVmj7Ccm9TkyXisHMEOEQwS9AEi4Tlk5pCI630Cf tLK6z2YJj3BpV25YQqzC8LWN7JxQFpl5RrY0dkm8q.BK_Q6IvLaYqZiCx.d.liVxjR9ZZMohoLdA NConCVC4oyd4wi_dNFMlSctAjrAaZJQNNtH94uKFLy1DoyH083gVGOhdbNFBJD23kN5_xVsJKX6V BwxHA9s2XSnSu_HsqsuuiEAH_45_ftHKL1Ap34r9pY931jFRQY_YPzAJbFb0oG3le02_k0_Wpg8b QTz.zl7ZhOLM6BIK_xEclF6vAZrXR1At9dLhiGNv_7QGboZ9ViVwze_C4HCvNWaynxlCLubZq0Mn J_7hrVd5nNWxCPoINjXe.nhU0xINEMJi7YXKa6OLUIP9U30dWU3ny1MZrwEat9lwmxfPOrM8mjor uCnXP9q.0_fEJ3YrouV3hVX.t7lYMyaMDNsnSj8pocSsvcTNunp158C9xEySwF28_BckoC9T8Rwf oQN6eVFRB9gdl6tJt8CoMSw24nvLeUvsEwNqB95iNN X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Sun, 26 Dec 2021 10:03:39 +0000 Original-Received: by kubenode509.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID f732865d6b5b7dd15b80d3c969c45656; Sun, 26 Dec 2021 10:03:35 +0000 (UTC) In-Reply-To: <83r19zq0l9.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 26 Dec 2021 09:36:34 +0200") X-Mailer: WebService/1.1.19498 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.187.148; envelope-from=luangruo@yahoo.com; helo=sonic316-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:283272 Archived-At: Eli Zaretskii writes: > I have a few comments and issues about this changeset: > This should explain what is a "pinch" gesture. It isn't self-evident. > The same goes for the NEWS entries. Thanks. >> @var{position} is a mouse >> +position list (@pxref{Click Events}) detailing the position of the >> +mouse cursor when the event occured, > ^^^^^^^^^^^^ > "mouse pointer" Thanks. >> @var{dx} is the distance between >> +the horizontal positions of the fingers since the last event in the >> +same sequence, @var{dy} is the vertical movement of the fingers since >> +the last event in the same sequence, > > What is the meaning of "the distance ... since last event"? Did you > mean the _change_ in the distance since the last event? And anyway, > what does "last event" mean in this context -- this is not explained > anywhere. I tried to explain what a sequence is later on, and yes, I meant the change in distance. >> @var{scale} is the division of >> +the current distance between the fingers and the distance at the start > Not "the division of X and Y", but "the ratio of X to Y". Thanks. > And I think this kind of event is too high-level. Usually, pinch > (a.k.a. "zoom") gestures and rotation gestures are reported > separately, because they have different semantics and will probably > have different command bindings. Why should be lump them together? > Moreover, in the corresponding command you require that the rotation > angle be zero, something that will be hard on the users, I think. XInput doesn't yet have support for reporting rotation gestures; the angle here is only reported as part of a pinch sequence, and pinch sequence only started when actual pinching occurs. > The doc string should say something about "pinch", and perhaps point > to the manual. Thanks. >> + (interactive "e") >> + (let ((window (posn-window (nth 1 event))) >> + (scale (nth 4 event)) >> + (dx (nth 2 event)) >> + (dy (nth 3 event)) >> + (angle (nth 5 event))) >> + (with-selected-window window >> + (when (and (zerop dx) >> + (zerop dy) >> + (zerop angle) >> + (equal scale 1.0)) >> + (setq text-scale--pinch-start-scale >> + (if text-scale-mode text-scale-mode-amount 0))) >> + (text-scale-set >> + (+ text-scale--pinch-start-scale >> + (round (log scale text-scale-mode-step))))))) > > Shouldn't this command ensure it gets a pinch event? Yes, I'll fix that. > We could potentially be flooded with input messages, and the question > is whether the above command should process all the pending events of > this time at once? If it should, perhaps keyboard.c should fetch all > the consecutive pinch events and produce a single event out of it, or > at least produce a structure that supplies all the events as one form > to the application level? > At least for text-scale, I think you will have a lot of unpleasant > flickering if you process each event separately. I didn't notice that, but it's because we round the result of the scaling. I will try to fix this, thanks. However, I think TRT here is not for keyboard.c to "coalesce" these events: the best approach would probably be to use `read-event' inside individual user commands with a timeout. That way, the commands themselves get to decide the granularity of the gestures they receive. > Finally, as this is a user command, we should start documenting such > commands in the user manual. Thanks, where would you prefer to put it?