1 #ifndef MOVEMENT_MAKER_H
2 #define MOVEMENT_MAKER_H
6 #include <keyboard_mouse_driver.h>
7 #include <touchpad_settings.h>
10 float floorf(float x
);
13 int32
make_small(float value
);
21 // absolut mode (unused)
29 struct hardware_specs
{
30 uint16 edgeMotionWidth
;
38 // the value you reach when you hammer really hard on the touchpad
39 uint16 realMaxPressure
;
44 /*! The raw movement calculation is calibrated on ths synaptics touchpad. */
45 // increase the touchpad size a little bit
46 #define SYN_AREA_TOP_LEFT_OFFSET 40
47 #define SYN_AREA_BOTTOM_RIGHT_OFFSET 60
48 #define SYN_AREA_START_X (1472 - SYN_AREA_TOP_LEFT_OFFSET)
49 #define SYN_AREA_END_X (5472 + SYN_AREA_BOTTOM_RIGHT_OFFSET)
50 #define SYN_WIDTH (SYN_AREA_END_X - SYN_AREA_START_X)
51 #define SYN_AREA_START_Y (1408 - SYN_AREA_TOP_LEFT_OFFSET)
52 #define SYN_AREA_END_Y (4448 + SYN_AREA_BOTTOM_RIGHT_OFFSET)
53 #define SYN_HEIGHT (SYN_AREA_END_Y - SYN_AREA_START_Y)
58 void SetSettings(touchpad_settings
* settings
);
59 void SetSpecs(hardware_specs
* specs
);
68 void StartNewMovment();
69 void GetMovement(uint32 posX
, uint32 posY
);
70 void GetScrolling(uint32 posX
, uint32 posY
);
72 touchpad_settings
* fSettings
;
73 hardware_specs
* fSpecs
;
80 void _GetRawMovement(uint32 posX
, uint32 posY
);
81 void _ComputeAcceleration(int8 accel_factor
);
84 bool fMovementMakerStarted
;
104 class TouchpadMovement
: public MovementMaker
{
108 status_t
EventToMovement(touch_event
*event
,
109 mouse_movement
*movement
);
111 bool TapDragStarted() { return fTapdragStarted
; }
112 bool WasEdgeMotion() { return fValidEdgeMotion
; }
114 void UpdateButtons(mouse_movement
*movement
);
116 bigtime_t click_speed
;
118 bool _EdgeMotion(mouse_movement
*movement
,
119 touch_event
*event
, bool validStart
);
120 inline void _NoTouchToMovement(touch_event
*event
,
121 mouse_movement
*movement
);
122 inline void _MoveToMovement(touch_event
*event
,
123 mouse_movement
*movement
);
124 inline bool _CheckScrollingToMovement(touch_event
*event
,
125 mouse_movement
*movement
);
127 bool fMovementStarted
;
128 bool fScrollingStarted
;
134 bool fTapdragStarted
;
136 bool fValidEdgeMotion
;
137 bigtime_t fLastEdgeMotion
;
138 float fRestEdgeMotion
;
142 bigtime_t fClickLastTime
;
144 uint32 fButtonsState
;