emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master e37eb7f: Add support for pixel wheel deltas on NS


From: Po Lu
Subject: Re: master e37eb7f: Add support for pixel wheel deltas on NS
Date: Fri, 26 Nov 2021 19:44:59 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

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

Thanks!  I really appreciate it.

>> 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?

I'll do that, thanks.

> 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"?

Yes, I'm using the method recommended by the XInput 2 developers, and on
X-based systems there's no option to control that arbitrary behaviour
that I know of.

It seems to be that every X-Windows program I checked (which includes
non-GTK programs such as Mozilla Firefox and Qt) also computes the pixel
information the same way.

>> 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?

I don't know about NS, but there's no such option in GTK based systems.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]