VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.5/ptrveloc.h@ 99743

Last change on this file since 99743 was 49174, checked in by vboxsync, 11 years ago

Additions/x11: replace header files for X.Org Server 1.6.0 with those for version 1.6.5 due to an ABI bump in-between.

  • Property svn:eol-style set to native
File size: 4.9 KB
Line 
1/*
2 *
3 * Copyright © 2006-2008 Simon Thum simon dot thum at gmx dot de
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef POINTERVELOCITY_H
26#define POINTERVELOCITY_H
27
28#include <input.h> /* DeviceIntPtr */
29
30/* maximum number of filters to approximate velocity.
31 * ABI-breaker!
32 */
33#define MAX_VELOCITY_FILTERS 8
34
35/* constants for acceleration profiles;
36 * see */
37
38#define AccelProfileClassic 0
39#define AccelProfileDeviceSpecific 1
40#define AccelProfilePolynomial 2
41#define AccelProfileSmoothLinear 3
42#define AccelProfileSimple 4
43#define AccelProfilePower 5
44#define AccelProfileLinear 6
45#define AccelProfileReserved 7
46
47/* fwd */
48struct _DeviceVelocityRec;
49
50/**
51 * profile
52 * returns actual acceleration depending on velocity, acceleration control,...
53 */
54typedef float (*PointerAccelerationProfileFunc)
55 (struct _DeviceVelocityRec* /*pVel*/,
56 float /*velocity*/, float /*threshold*/, float /*acc*/);
57
58/**
59 * a filter stage contains the data for adaptive IIR filtering.
60 * To improve results, one may run several parallel filters
61 * which have different decays. Since more integration means more
62 * delay, a given filter only does good matches in a specific phase of
63 * a stroke.
64 *
65 * Basically, the coupling feature makes one filter fairly enough,
66 * so that is the default.
67 */
68typedef struct _FilterStage {
69 float* fading_lut; /* lookup for adaptive IIR filter */
70 int fading_lut_size; /* size of lookup table */
71 float rdecay; /* reciprocal weighting halflife in ms */
72 float current;
73} FilterStage, *FilterStagePtr;
74
75/**
76 * Contains all data needed to implement mouse ballistics
77 */
78typedef struct _DeviceVelocityRec {
79 FilterStage filters[MAX_VELOCITY_FILTERS];
80 float velocity; /* velocity as guessed by algorithm */
81 float last_velocity; /* previous velocity estimate */
82 int lrm_time; /* time the last motion event was processed */
83 int last_dx, last_dy; /* last motion delta */
84 int last_diff; /* last time-difference */
85 Bool last_reset; /* whether a nv-reset occurred just before */
86 float corr_mul; /* config: multiply this into velocity */
87 float const_acceleration; /* config: (recipr.) const deceleration */
88 float min_acceleration; /* config: minimum acceleration */
89 short reset_time; /* config: reset non-visible state after # ms */
90 short use_softening; /* config: use softening of mouse values */
91 float coupling; /* config: max. divergence before coupling */
92 Bool average_accel; /* config: average acceleration over velocity */
93 PointerAccelerationProfileFunc Profile;
94 PointerAccelerationProfileFunc deviceSpecificProfile;
95 void* profile_private;/* extended data, see SetAccelerationProfile() */
96 struct { /* to be able to query this information */
97 int profile_number;
98 int filter_usecount[MAX_VELOCITY_FILTERS +1];
99 } statistics;
100} DeviceVelocityRec, *DeviceVelocityPtr;
101
102
103extern void
104InitVelocityData(DeviceVelocityPtr s);
105
106extern void
107InitFilterChain(DeviceVelocityPtr s, float rdecay, float degression,
108 int lutsize, int stages);
109
110extern int
111SetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
112
113extern DeviceVelocityPtr
114GetDevicePredictableAccelData(DeviceIntPtr pDev);
115
116extern void
117SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr s,
118 PointerAccelerationProfileFunc profile);
119
120extern void
121AccelerationDefaultCleanup(DeviceIntPtr pDev);
122
123extern void
124acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator,
125 int num_valuators, int *valuators, int evtime);
126
127extern void
128acceleratePointerLightweight(DeviceIntPtr pDev, int first_valuator,
129 int num_valuators, int *valuators, int ignore);
130
131#endif /* POINTERVELOCITY_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette