Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensitivity: Handle sensitivities < 1.0 without rounding errors #111

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ijackson
Copy link

Sensitivity: Handle sensitivities < 1.0 without rounding errors.
Including two preparatory patches.

In particular, although emacs generally doesn't generate ~ backup
files when working in a git tree, autoreconf does generate
config.h.in~, which should be ignored.

Signed-off-by: Ian Jackson <[email protected]>
In a moment, we are going to make the in-use representation of the
sensitivity more complicated.  We will need accessor methods for use
by the configuration machinery.

Provide these accessor methods now, to reduce noise in the substantive
patch.  For now they just access the single double.

Rename the variable so that we catch all of the references.

Signed-off-by: Ian Jackson <[email protected]>
Background: We tell the xf86 core that our x and y ranges are the
overall range of the trackpad.  The xf86 core scales the supplied
values in the same way for relative and absolute pointers.  The result
is that at sensitivity 1.0, the scale of the whole trackpad
corresponds to the scale of the whole screen (so for example moving
the pointer from the very LHS to the very RHS of the screen can be
achieved by moving a finger from the very LHS to the very RHS of the
trackpad).

On some modern machines the resolution of the screen is much higher
than the resolution of the trackpad.  When this occurs, due to
rounding error, it can be impossible to reach the bottom and right
edges of the screen.  This is because even a 1-unit movement on the
trackpad is multipled by a >1-pixel pointer movement, and pointer
movements which would take the pointer off the screen are ignored.
(Arguably this is some kind of bug.)  In any case the user will
probably want to be able to control the pointer position with 1-pixel
accuracy.

This requires mtrack to specify a higher resolution.  Otherwise, the
fact that the values provided by mtrack to xf86 are integers means
that attempts to set the sensitivity to values < 1.0 are not properly
effective - resulting in "lumpy" response.

Fix this as follows:

 * Split sensitivity_val into sensitivity_big and _smalldiv,
   both >= 1.0, such that sensitivity_big/sensitivity_smalldiv is the
   specified sensitivity.

 * Multiply the size we tell xf86 by sensitivity_smalldiv.

As a result, when sensitivity is < 1.0, instead of scaling down
motions (resulting in unwanted rounding), we scale up the nominal size
(resulting in a lower scaling factor being applied by xf86).

When the sensitivity is > 1.0, everything behaves as before.

There is no change to the visible configuration.

Signed-off-by: Ian Jackson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant