Commit Graph

86 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Keith Packard 6a5a4e6037 Remove SIGIO support for input [v5]
This removes all of the SIGIO handling support used for input
throughout the X server, preparing the way for using threads for input
handling instead.

Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
to stub functions input_lock/input_unlock so that we don't lose this
information.

xfree86 SIGIO support is reworked to use internal versions of
OsBlockSIGIO and OsReleaseSIGIO.

v2: Don't change locking order (Peter Hutterer)
v3: Comment weird && FALSE in xf86Helper.c
    Leave errno save/restore in xf86ReadInput
    Squash with stub adding patch (Peter Hutterer)
v4: Leave UseSIGIO config parameter so that
    existing config files don't break (Peter Hutterer)
v5: Split a couple of independent patch bits out
    of kinput.c (Peter Hutterer)

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26 16:07:54 -07:00
Simon Thum 16e4bce9e5 dix/ptraccel: Remove float literals
This was fine back when valuators were integer. Device
properties are float (not double), so some instances remain.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-22 14:32:30 +10:00
Simon Thum c8e5fc3057 dix/ptraccel: Fix memory leak in InitPredictableAccelerationScheme
This was quite unlikely except in situations where a proper startup
would have been impossible anyway, but since automated checks don't
grade likelyhood just fix it.

Detected by Jeremy Huddleston's clang checks.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-22 14:32:24 +10:00
Peter Hutterer 74469895e3 dix: allow a ConstantDeceleration between 0 and 1 (#66134)
A constant deceleration of x simply means (delta * 1/x). We limited that to
values >= 1.0f for obvious reasons, but can also allow values from 0-1.
That means that ConstantDeceleration is actually a ConstantAcceleration, but
hey, if someone needs it...

X.Org Bug 66134 <http://bugs.freedesktop.org/show_bug.cgi?id=66134>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-07-17 14:27:26 +10:00
Peter Hutterer a6ba2b79ae dix: unify prefix for ptraccel debugging in DebugAccelF macro
If we're already using our own custom macro, might as well use it properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer 0d7d794060 dix: use BUG_RETURN_VAL for an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer a0c38ea6cb dix: add some more info to a ptraccel debug msg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:56 +10:00
Peter Hutterer 95125a7c0c dix: fix ptraccel debugging printfs
This is mostly sigsafe code, so use sigsave printf. And update some fields
to double that used to be int.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-02-08 14:00:53 +10:00
Peter Hutterer adde4e6448 dix: typo fix in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-11 14:57:48 +10:00
Simon Thum 693a31e704 dix: indentation fixes for pointer acceleration
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-16 10:59:35 +10:00
Michal Suchanek 36377fb0e8 dix: Remove redundant declarations.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-14 13:17:17 +01:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Peter Hutterer 1ecc427a39 dix: move #if statement to stop compiler warning
ptrveloc.c: In function 'QueryTrackers':
ptrveloc.c:598:34: warning: variable 'used_offset' set but not used
[-Wunused-but-set-variable]

used_offset is used, but only in the debugging code. Move the #if statement
to ignore that warning.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-25 14:06:41 +10:00
Daniel Stone 0882b788da Input: Convert acceleration code to using ValuatorMask
Instead of passing a set of int* to the acceleration code, pass it a
mask instead, which avoids an unfortunate loss of precision.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-09-29 12:24:34 +10:00
Daniel Stone 2b8f1d07bd Input: Widen pointer acceleration types to double
This widens almost all of the float-using code in ptrveloc.[ch] to
doubles, other than values coming from properties which are specified to
be floats by the property API.

Bumps input API to v14 as this changes the AccelScheme signature, as
used by xf86-input-synaptics.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 12:24:33 +10:00
Daniel Stone 8a4a4e1b8a Input: Use trunc instead of lrintf in acceleration code
For compatibility with all the rest of the input code.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-09-29 12:23:52 +10:00
Peter Hutterer 6f97fe5df1 dix: improve control flow in QueryTrackers
If the velocity is 0, skip the remainder.
If we're not in range, skip the remainder.

No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-04-21 16:05:16 +10:00
Peter Hutterer a0eda8cd36 dix: rename a bunch of variables to be more self-explanatory
i → used_offset
iveloc → initial_velocity
res → result
vdiff → velocity_diff
vfac → velocity_factor
tmp → tracker_velocity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:45:09 +10:00
Peter Hutterer e490190590 dix: reduce scope of tmp and mult.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:22:52 +10:00
Peter Hutterer 81c6e79f42 dix: reduce the work done by ApplySoftening
We can modify fdx/fdy in-place rather than requiring dx/dy as well. And the
decision to soften can be made in the caller (unless decided by the velocity
state).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:22:30 +10:00
Peter Hutterer 5870d507ce dix: split softening and constant deceleration into two functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:22:19 +10:00
Peter Hutterer 8ae90552f9 dix: use single return statement in ApplySimpleSoftening
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:21:30 +10:00
Peter Hutterer c45f4cc6bd dix: rename od, d to prev_delta, delta
And res to result.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:21:26 +10:00
Peter Hutterer 5ffe06bada dix: Don't use short as bool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:20:11 +10:00
Peter Hutterer 97c1967689 dix: rename "res" to "result" for improved readability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:19:51 +10:00
Peter Hutterer 1c162ebcab dix: change ProcessVelocityData2D to BOOL.
Don't confuse users with a return type of short, that's even less indicative
that it returns 0/non-0 than "int".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-04-21 14:17:55 +10:00
Peter Hutterer 70b76286db dix: add some more documentation to ptraccel code
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:15:49 +10:00
Peter Hutterer 6b3a4cc6af dix: don't pass the index for a tracker around, pass the tracker
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 14:13:51 +10:00
Peter Hutterer 9e8645cacf dix: CalcTracker only uses the tracker, thus only pass the tracker.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-21 14:00:44 +10:00
Peter Hutterer 62f4bef82d dix: use single return statement in DoGetDirection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:58:55 +10:00
Peter Hutterer 5f8edbe47e dix: use single return value in GetDirection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:55:49 +10:00
Peter Hutterer afaa178125 dix: document GetDirection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:49:38 +10:00
Peter Hutterer df90db892d dix: document DoGetDirection's maths
This is the best explanation I can come up with, but it seems to hold true
for my example values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:48:41 +10:00
Peter Hutterer 7513190ec7 dix: improve comment, directions flagged are 45° each
The two directions returned by this calculation are always the two boundary
conditions. Since we don't do quadrants but octants, the flagged ones are
45° each. e.g. an angle of 35° flags E and NE.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-04-21 13:48:11 +10:00
Peter Hutterer e804ae85fe dix: improve readbility of DoGetDirection.
Use enums for the direction bits, not hardcoded bitfield values that are
added up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:48:01 +10:00
Peter Hutterer 709b291972 dix: only use a single return where only one is needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:47:52 +10:00
Peter Hutterer 8c528c667d dix: fix typo in direction calculation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2011-04-21 13:47:42 +10:00
Simon Thum 1c008e7e78 dix: change all timestamps in pointer acceleration to CARD32
CARD32 is being returned by GetTimeInMilis(), so use it consistently.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-02 15:00:08 +10:00
Simon Thum a4b8526185 dix: update pointer acceleration code to use ValuatorMask
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-02 14:54:03 +10:00
Simon Thum 8128846e16 dix: refactor predictable scheme initialization
This intends to clean up the predictable accel struct
from purely scheme-related things like input properties,
as they would be useless in other use cases such
as wheel acceleration.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-02 14:47:58 +10:00
Simon Thum 31ddb7ef4f dix: avoid FP promotion during pointer acceleration
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17 10:26:10 +10:00
Simon Thum 006157f203 dix: refactor scheme init
This makes it possible to init a scheme in one init call, so we
get rid of the tightly coupled two-phase init used before.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17 10:23:01 +10:00
Cyril Brulebois 99275ad2fa Remove superfluous if(p!=NULL) checks around free(p); p=NULL;
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@
-  if (E != NULL) {
-   free(E);
(
-   E = NULL;
|
-   E = 0;
)
-  }
+ free(E);
+ E = NULL;

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 08:22:59 +10:00
Mikhail Gusarov 7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -07:00
Mikhail Gusarov 3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Keith Packard 65e961fcc1 Replace some input devPrivates with regular struct fields
In the process, fixes a memory leak in CloseDevice, and an unchecked
memory allocation in InitializePredictableAccelerationProperties.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-04-30 13:05:11 -07:00
Simon Thum 1763550d01 dix: add smooth limited pointer acceleration profile
This profile is inspired by the accel code removed from the wacom driver.
It ascends from zero to acceleration, maxing out at threshold. This means you
can control the slope using threshold, which wasn't possible in wacom.
For sanity's sake, threshold should grow with acceleration.

Works best with adaptive deceleration, since otherwise it only generates
acceleration above 1, causing seldom pixel skips.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-01-01 11:22:42 -08:00
Peter Hutterer 0e6cee853d dix: clean up accel old scheme data when switching schemes.
InitValuatorClassDeviceStruct always initializes with the default profile.
The default profile allocs data and adds a few properties which become
obsolete if the profile is changed lateron by the driver.

The property handlers are stored in the device's devPrivates and cleaned up.
Ideally, the property handler ID's could be stored somewhere more obvious,
but that seems to require breaking the ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Simon Thum <simon.thum@gmx.de>
2009-11-25 10:57:07 +10:00
Oliver McFadden b5f6da1e9b Revert "Coverity Prevent: RESOURCE_LEAK in AccelSetProfileProperty:"
This reverts commit 7333dc2969.

False positive.
2009-07-17 06:34:00 +03:00