VirtualBox

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

Last change on this file since 99743 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 4.9 KB
Line 
1/*
2 *
3 * Copyright © 2006-2009 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/* 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 AccelProfileLAST AccelProfileLinear
41
42/* fwd */
43struct _DeviceVelocityRec;
44
45/**
46 * profile
47 * returns actual acceleration depending on velocity, acceleration control,...
48 */
49typedef float (*PointerAccelerationProfileFunc)
50 (DeviceIntPtr dev, struct _DeviceVelocityRec* vel,
51 float velocity, float threshold, float accelCoeff);
52
53/**
54 * a motion history, with just enough information to
55 * calc mean velocity and decide which motion was along
56 * a more or less straight line
57 */
58typedef struct _MotionTracker {
59 int dx, dy; /* accumulated delta for each axis */
60 int time; /* time of creation */
61 int dir; /* initial direction bitfield */
62} MotionTracker, *MotionTrackerPtr;
63
64/**
65 * Contains all data needed to implement mouse ballistics
66 */
67typedef struct _DeviceVelocityRec {
68 MotionTrackerPtr tracker;
69 int num_tracker;
70 int cur_tracker; /* current index */
71 float velocity; /* velocity as guessed by algorithm */
72 float last_velocity; /* previous velocity estimate */
73 int last_dx; /* last time-difference */
74 int last_dy ; /* phase of last/current estimate */
75 float corr_mul; /* config: multiply this into velocity */
76 float const_acceleration; /* config: (recipr.) const deceleration */
77 float min_acceleration; /* config: minimum acceleration */
78 short reset_time; /* config: reset non-visible state after # ms */
79 short use_softening; /* config: use softening of mouse values */
80 float max_rel_diff; /* config: max. relative difference */
81 float max_diff; /* config: max. difference */
82 int initial_range; /* config: max. offset used as initial velocity */
83 Bool average_accel; /* config: average acceleration over velocity */
84 PointerAccelerationProfileFunc Profile;
85 PointerAccelerationProfileFunc deviceSpecificProfile;
86 void* profile_private;/* extended data, see SetAccelerationProfile() */
87 struct { /* to be able to query this information */
88 int profile_number;
89 } statistics;
90} DeviceVelocityRec, *DeviceVelocityPtr;
91
92
93extern _X_EXPORT void
94InitVelocityData(DeviceVelocityPtr vel);
95
96extern _X_EXPORT void
97InitTrackers(DeviceVelocityPtr vel, int ntracker);
98
99extern _X_EXPORT short
100ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time);
101
102extern _X_EXPORT float
103BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
104 float velocity, float threshold, float acc);
105
106extern _X_EXPORT void
107FreeVelocityData(DeviceVelocityPtr vel);
108
109extern _X_INTERNAL BOOL
110InitializePredictableAccelerationProperties(DeviceIntPtr dev);
111
112extern _X_EXPORT int
113SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
114
115extern _X_EXPORT DeviceVelocityPtr
116GetDevicePredictableAccelData(DeviceIntPtr dev);
117
118extern _X_EXPORT void
119SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
120 PointerAccelerationProfileFunc profile);
121
122extern _X_INTERNAL void
123AccelerationDefaultCleanup(DeviceIntPtr dev);
124
125extern _X_INTERNAL void
126acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
127 int num_valuators, int *valuators, int evtime);
128
129extern _X_INTERNAL void
130acceleratePointerLightweight(DeviceIntPtr dev, int first_valuator,
131 int num_valuators, int *valuators, int ignored);
132
133#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