VirtualBox

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

Last change on this file was 45134, checked in by vboxsync, 12 years ago

Additions/X11: build vboxvideo_drv.so for X.Org Server 1.14.

  • Property svn:eol-style set to native
File size: 5.4 KB
Line 
1/*
2 *
3 * Copyright © 2006-2011 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>
29
30/* constants for acceleration profiles */
31
32#define AccelProfileNone -1
33#define AccelProfileClassic 0
34#define AccelProfileDeviceSpecific 1
35#define AccelProfilePolynomial 2
36#define AccelProfileSmoothLinear 3
37#define AccelProfileSimple 4
38#define AccelProfilePower 5
39#define AccelProfileLinear 6
40#define AccelProfileSmoothLimited 7
41#define AccelProfileLAST AccelProfileSmoothLimited
42
43/* fwd */
44struct _DeviceVelocityRec;
45
46/**
47 * profile
48 * returns actual acceleration depending on velocity, acceleration control,...
49 */
50typedef double (*PointerAccelerationProfileFunc)
51 (DeviceIntPtr dev, struct _DeviceVelocityRec * vel,
52 double velocity, double threshold, double accelCoeff);
53
54/**
55 * a motion history, with just enough information to
56 * calc mean velocity and decide which motion was along
57 * a more or less straight line
58 */
59typedef struct _MotionTracker {
60 double dx, dy; /* accumulated delta for each axis */
61 int time; /* time of creation */
62 int dir; /* initial direction bitfield */
63} MotionTracker, *MotionTrackerPtr;
64
65/**
66 * Contains all data needed to implement mouse ballistics
67 */
68typedef struct _DeviceVelocityRec {
69 MotionTrackerPtr tracker;
70 int num_tracker;
71 int cur_tracker; /* current index */
72 double velocity; /* velocity as guessed by algorithm */
73 double last_velocity; /* previous velocity estimate */
74 double last_dx; /* last time-difference */
75 double last_dy; /* phase of last/current estimate */
76 double corr_mul; /* config: multiply this into velocity */
77 double const_acceleration; /* config: (recipr.) const deceleration */
78 double min_acceleration; /* config: minimum acceleration */
79 short reset_time; /* config: reset non-visible state after # ms */
80 short use_softening; /* config: use softening of mouse values */
81 double max_rel_diff; /* config: max. relative difference */
82 double max_diff; /* config: max. difference */
83 int initial_range; /* config: max. offset used as initial velocity */
84 Bool average_accel; /* config: average acceleration over velocity */
85 PointerAccelerationProfileFunc Profile;
86 PointerAccelerationProfileFunc deviceSpecificProfile;
87 void *profile_private; /* extended data, see SetAccelerationProfile() */
88 struct { /* to be able to query this information */
89 int profile_number;
90 } statistics;
91} DeviceVelocityRec, *DeviceVelocityPtr;
92
93/**
94 * contains the run-time data for the predictable scheme, that is, a
95 * DeviceVelocityPtr and the property handlers.
96 */
97typedef struct _PredictableAccelSchemeRec {
98 DeviceVelocityPtr vel;
99 long *prop_handlers;
100 int num_prop_handlers;
101} PredictableAccelSchemeRec, *PredictableAccelSchemePtr;
102
103extern _X_EXPORT void
104InitVelocityData(DeviceVelocityPtr vel);
105
106extern _X_EXPORT void
107InitTrackers(DeviceVelocityPtr vel, int ntracker);
108
109extern _X_EXPORT BOOL
110ProcessVelocityData2D(DeviceVelocityPtr vel, double dx, double dy, int time);
111
112extern _X_EXPORT double
113BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
114 double velocity, double threshold, double acc);
115
116extern _X_EXPORT void
117FreeVelocityData(DeviceVelocityPtr vel);
118
119extern _X_EXPORT int
120SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
121
122extern _X_EXPORT DeviceVelocityPtr
123GetDevicePredictableAccelData(DeviceIntPtr dev);
124
125extern _X_EXPORT void
126SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
127 PointerAccelerationProfileFunc profile);
128
129extern _X_INTERNAL void
130AccelerationDefaultCleanup(DeviceIntPtr dev);
131
132extern _X_INTERNAL Bool
133InitPredictableAccelerationScheme(DeviceIntPtr dev,
134 struct _ValuatorAccelerationRec *protoScheme);
135
136extern _X_INTERNAL void
137acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val,
138 CARD32 evtime);
139
140extern _X_INTERNAL void
141acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask *val,
142 CARD32 evtime);
143
144#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