unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: rpluim@gmail.com, emacs-devel@gnu.org
Subject: Re: master e37eb7f: Add support for pixel wheel deltas on NS
Date: Fri, 26 Nov 2021 13:32:08 +0200	[thread overview]
Message-ID: <83r1b32lvr.fsf@gnu.org> (raw)
In-Reply-To: <87fsrjfeb1.fsf@yahoo.com> (message from Po Lu on Fri, 26 Nov 2021 17:37:22 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: rpluim@gmail.com,  emacs-devel@gnu.org
> Date: Fri, 26 Nov 2021 17:37:22 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > How to compute the amount of pixels for a given amount of wheel delta?
> 
> I don't know, but I will try to ask some people I know who know
> something about this.

Thanks.  But if this conversion is arbitrary (see below), I think I
know how to implement the MS-Windows version of "arbitrary".

> > The wheel delta on MS-Windows is reported in abstract units, not
> > directly related to any pixels, AFAICT.  I don't see the logic of the
> > conversion to pixels documented anywhere in the X or NS code, and the
> > comments, such as they are, make no sense at all to someone who knows
> > nothing about X mouse-wheel handling.  In xterm.c, it seems like some
> > kind of query of the device "valuators" (whatever that is) is being
> > used?
> 
> On X, the states of the mouse wheels in each axis are stored as absolute
> values inside "valuators" attached to each mouse device.  To obtain the
> delta of the scroll wheel from a motion event (which is used to report
> that some valuator has changed), it is necessary to iterate over every
> valuator that changed, and compare its previous value to the current
> value of the valuator.
> 
> Each individual valuator also has an "interval", which is the amount you
> must divide that delta by in order to obtain a delta in the terms of
> scroll units.
> 
> This delta however is still intermediate, to make driver implementations
> easier.  The XInput developers recommend the following algorithm to
> convert from scroll unit deltas to pixel deltas:
> 
>   pixels_scrolled = pow (window_height, 2.0 / 3.0) * delta;

All of this should be in comments in xterm.c.

Btw, the code calculates pixels_scrolled when it is not yet clear that
the value will be used, which is a waste of cycles, AFAICT.  How about
moving this closer to where the value is actually used?

In any case, are you saying that the conversion to pixels is somewhat
arbitrary?  And that users of X based systems have no control on this
conversion, i.e. users cannot determine the pixel equivalent of each
"delta"?

> > And on NS, it seems like the delta is already reported in pixels?
> 
> Yes.  The PGTK port can do something similar if it gains support for
> this, as GTK also reports it in pixels directly.

Same question here: do users have any system-wide control on the
conversion to pixels under these environments?



  reply	other threads:[~2021-11-26 11:32 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211125030922.2353.1129@vcs0.savannah.gnu.org>
     [not found] ` <20211125030924.7258E2094B@vcs0.savannah.gnu.org>
2021-11-25 10:26   ` master e37eb7f: Add support for pixel wheel deltas on NS Robert Pluim
2021-11-25 10:34     ` Po Lu
2021-11-25 10:47       ` Robert Pluim
2021-11-25 11:02       ` Eli Zaretskii
2021-11-26  0:39         ` Po Lu
2021-11-26  6:35           ` Eli Zaretskii
2021-11-26  7:00             ` Po Lu
2021-11-26  8:17               ` Eli Zaretskii
2021-11-26  9:37                 ` Po Lu
2021-11-26 11:32                   ` Eli Zaretskii [this message]
2021-11-26 11:44                     ` Po Lu
2021-11-26 16:55                       ` Eli Zaretskii
2021-11-27  0:02                         ` Po Lu
2021-11-27  6:09                           ` Eli Zaretskii
2021-11-27  6:41                             ` Po Lu
2021-11-27  7:05                               ` Eli Zaretskii
2021-11-27  7:14                                 ` Po Lu
2021-11-27 10:47                                   ` Eli Zaretskii
2021-11-27 10:54                                     ` Po Lu
2021-11-27 11:03                                       ` Eli Zaretskii
2021-11-27 11:05                                         ` Po Lu
2021-11-27 11:13                                           ` Po Lu
2021-11-27 11:32                                             ` Eli Zaretskii
2021-11-27 11:34                                               ` Po Lu
2021-11-27 11:40                                                 ` Eli Zaretskii
2021-11-27 11:44                                                   ` Po Lu
2021-11-27 12:02                                                     ` Eli Zaretskii
2021-11-27 12:11                                                       ` Po Lu
2021-11-27 12:36                                                         ` Eli Zaretskii
2021-11-27 12:48                                                           ` Po Lu
2021-11-26 11:48                     ` Eli Zaretskii
2021-11-26 12:05                       ` Po Lu
2021-11-26 12:23                         ` Eli Zaretskii
2021-11-26 12:37                           ` Po Lu
2021-11-26 19:39                             ` Alan Third
2021-11-26 19:45                               ` Eli Zaretskii
2021-11-26 19:54                                 ` Alan Third
2021-11-28  2:54                             ` Po Lu
2021-11-28  7:53                               ` Eli Zaretskii
2021-11-28  7:58                                 ` Po Lu
2021-11-28  8:28                                   ` Eli Zaretskii
2021-11-29  7:39                                     ` Po Lu
2021-11-29 12:50                                       ` Eli Zaretskii
2021-11-29 13:19                                         ` Po Lu
2021-11-25 11:00     ` Eli Zaretskii
2021-11-25 18:46       ` Stefan Monnier
2021-11-25 18:58         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83r1b32lvr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).