2008-07-10 15:03:39 +02:00
|
|
|
/*
|
2008-07-23 09:28:06 +02:00
|
|
|
*
|
2009-06-24 11:16:24 +02:00
|
|
|
* Copyright © 2006-2009 Simon Thum simon dot thum at gmx dot de
|
2008-07-23 09:28:06 +02:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
#ifndef POINTERVELOCITY_H
|
|
|
|
#define POINTERVELOCITY_H
|
|
|
|
|
|
|
|
#include <input.h> /* DeviceIntPtr */
|
|
|
|
|
2009-05-06 10:39:16 +02:00
|
|
|
/* constants for acceleration profiles */
|
2008-07-23 11:28:09 +02:00
|
|
|
|
2009-05-06 10:39:16 +02:00
|
|
|
#define AccelProfileNone -1
|
2008-07-23 11:28:09 +02:00
|
|
|
#define AccelProfileClassic 0
|
|
|
|
#define AccelProfileDeviceSpecific 1
|
|
|
|
#define AccelProfilePolynomial 2
|
|
|
|
#define AccelProfileSmoothLinear 3
|
|
|
|
#define AccelProfileSimple 4
|
|
|
|
#define AccelProfilePower 5
|
|
|
|
#define AccelProfileLinear 6
|
2010-01-01 19:58:05 +01:00
|
|
|
#define AccelProfileSmoothLimited 7
|
|
|
|
#define AccelProfileLAST AccelProfileSmoothLimited
|
2008-07-23 11:28:09 +02:00
|
|
|
|
|
|
|
/* fwd */
|
2008-07-10 15:03:39 +02:00
|
|
|
struct _DeviceVelocityRec;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* profile
|
|
|
|
* returns actual acceleration depending on velocity, acceleration control,...
|
|
|
|
*/
|
|
|
|
typedef float (*PointerAccelerationProfileFunc)
|
2009-06-24 11:16:24 +02:00
|
|
|
(DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
|
|
|
|
float velocity, float threshold, float accelCoeff);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
/**
|
2009-02-28 22:17:47 +01:00
|
|
|
* a motion history, with just enough information to
|
|
|
|
* calc mean velocity and decide which motion was along
|
|
|
|
* a more or less straight line
|
2008-07-10 15:03:39 +02:00
|
|
|
*/
|
2009-02-28 22:17:47 +01:00
|
|
|
typedef struct _MotionTracker {
|
|
|
|
int dx, dy; /* accumulated delta for each axis */
|
|
|
|
int time; /* time of creation */
|
|
|
|
int dir; /* initial direction bitfield */
|
|
|
|
} MotionTracker, *MotionTrackerPtr;
|
2008-07-10 15:03:39 +02:00
|
|
|
|
2010-04-29 21:24:49 +02:00
|
|
|
/* number of properties for predictable acceleration */
|
|
|
|
#define NPROPS_PREDICTABLE_ACCEL 4
|
|
|
|
|
2008-07-10 15:03:39 +02:00
|
|
|
/**
|
|
|
|
* Contains all data needed to implement mouse ballistics
|
|
|
|
*/
|
|
|
|
typedef struct _DeviceVelocityRec {
|
2009-02-28 22:17:47 +01:00
|
|
|
MotionTrackerPtr tracker;
|
|
|
|
int num_tracker;
|
|
|
|
int cur_tracker; /* current index */
|
2008-07-10 15:03:39 +02:00
|
|
|
float velocity; /* velocity as guessed by algorithm */
|
2008-07-29 10:07:43 +02:00
|
|
|
float last_velocity; /* previous velocity estimate */
|
2009-02-28 22:17:47 +01:00
|
|
|
int last_dx; /* last time-difference */
|
|
|
|
int last_dy ; /* phase of last/current estimate */
|
2008-07-10 15:03:39 +02:00
|
|
|
float corr_mul; /* config: multiply this into velocity */
|
|
|
|
float const_acceleration; /* config: (recipr.) const deceleration */
|
|
|
|
float min_acceleration; /* config: minimum acceleration */
|
|
|
|
short reset_time; /* config: reset non-visible state after # ms */
|
|
|
|
short use_softening; /* config: use softening of mouse values */
|
2009-02-28 22:17:47 +01:00
|
|
|
float max_rel_diff; /* config: max. relative difference */
|
|
|
|
float max_diff; /* config: max. difference */
|
|
|
|
int initial_range; /* config: max. offset used as initial velocity */
|
2008-07-29 10:07:43 +02:00
|
|
|
Bool average_accel; /* config: average acceleration over velocity */
|
2008-07-10 15:03:39 +02:00
|
|
|
PointerAccelerationProfileFunc Profile;
|
|
|
|
PointerAccelerationProfileFunc deviceSpecificProfile;
|
|
|
|
void* profile_private;/* extended data, see SetAccelerationProfile() */
|
|
|
|
struct { /* to be able to query this information */
|
|
|
|
int profile_number;
|
|
|
|
} statistics;
|
2010-04-29 21:24:49 +02:00
|
|
|
long prop_handlers[NPROPS_PREDICTABLE_ACCEL];
|
2008-07-10 15:03:39 +02:00
|
|
|
} DeviceVelocityRec, *DeviceVelocityPtr;
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT void
|
2009-06-24 11:33:19 +02:00
|
|
|
InitVelocityData(DeviceVelocityPtr vel);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
2009-02-28 22:17:47 +01:00
|
|
|
extern _X_EXPORT void
|
2009-06-24 11:33:19 +02:00
|
|
|
InitTrackers(DeviceVelocityPtr vel, int ntracker);
|
2009-02-28 22:17:47 +01:00
|
|
|
|
2009-06-24 11:16:24 +02:00
|
|
|
extern _X_EXPORT short
|
|
|
|
ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
|
|
|
|
|
|
|
|
extern _X_EXPORT float
|
|
|
|
BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
|
|
|
|
float velocity, float threshold, float acc);
|
|
|
|
|
|
|
|
extern _X_EXPORT void
|
|
|
|
FreeVelocityData(DeviceVelocityPtr vel);
|
|
|
|
|
2009-06-20 18:57:22 +02:00
|
|
|
extern _X_INTERNAL BOOL
|
2009-06-24 11:16:24 +02:00
|
|
|
InitializePredictableAccelerationProperties(DeviceIntPtr dev);
|
2008-11-19 07:01:21 +01:00
|
|
|
|
2009-11-18 05:39:25 +01:00
|
|
|
extern _X_INTERNAL BOOL
|
|
|
|
DeletePredictableAccelerationProperties(DeviceIntPtr dev);
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT int
|
2009-06-24 11:33:19 +02:00
|
|
|
SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT DeviceVelocityPtr
|
2009-06-24 11:33:19 +02:00
|
|
|
GetDevicePredictableAccelData(DeviceIntPtr dev);
|
2008-07-23 11:33:25 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT void
|
2009-06-24 11:33:19 +02:00
|
|
|
SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
|
2008-07-10 15:03:39 +02:00
|
|
|
PointerAccelerationProfileFunc profile);
|
|
|
|
|
2009-06-20 18:57:22 +02:00
|
|
|
extern _X_INTERNAL void
|
2009-06-24 11:33:19 +02:00
|
|
|
AccelerationDefaultCleanup(DeviceIntPtr dev);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
2009-06-20 18:57:22 +02:00
|
|
|
extern _X_INTERNAL void
|
2009-06-24 11:33:19 +02:00
|
|
|
acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
|
2008-07-10 15:03:39 +02:00
|
|
|
int num_valuators, int *valuators, int evtime);
|
|
|
|
|
2009-06-20 18:57:22 +02:00
|
|
|
extern _X_INTERNAL void
|
2009-06-24 11:33:19 +02:00
|
|
|
acceleratePointerLightweight(DeviceIntPtr dev, int first_valuator,
|
|
|
|
int num_valuators, int *valuators, int ignored);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
#endif /* POINTERVELOCITY_H */
|