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
);
20 // absolut mode (unused)
28 struct hardware_specs
{
29 uint16 edgeMotionWidth
;
37 // the value you reach when you hammer really hard on the touchpad
38 uint16 realMaxPressure
;
43 /*! The raw movement calculation is calibrated on ths synaptics touchpad. */
44 // increase the touchpad size a little bit
45 #define SYN_AREA_TOP_LEFT_OFFSET 40
46 #define SYN_AREA_BOTTOM_RIGHT_OFFSET 60
47 #define SYN_AREA_START_X (1472 - SYN_AREA_TOP_LEFT_OFFSET)
48 #define SYN_AREA_END_X (5472 + SYN_AREA_BOTTOM_RIGHT_OFFSET)
49 #define SYN_WIDTH (SYN_AREA_END_X - SYN_AREA_START_X)
50 #define SYN_AREA_START_Y (1408 - SYN_AREA_TOP_LEFT_OFFSET)
51 #define SYN_AREA_END_Y (4448 + SYN_AREA_BOTTOM_RIGHT_OFFSET)
52 #define SYN_HEIGHT (SYN_AREA_END_Y - SYN_AREA_START_Y)
57 void SetSettings(touchpad_settings
* settings
);
58 void SetSpecs(hardware_specs
* specs
);
67 void StartNewMovment();
68 void GetMovement(uint32 posX
, uint32 posY
);
69 void GetScrolling(uint32 posX
, uint32 posY
);
71 touchpad_settings
* fSettings
;
72 hardware_specs
* fSpecs
;
79 void _GetRawMovement(uint32 posX
, uint32 posY
);
80 void _ComputeAcceleration(int8 accel_factor
);
83 bool fMovementMakerStarted
;
103 class TouchpadMovement
: public MovementMaker
{
107 status_t
EventToMovement(touch_event
*event
,
108 mouse_movement
*movement
);
110 bool TapDragStarted() { return fTapdragStarted
; }
111 bool WasEdgeMotion() { return fValidEdgeMotion
; }
113 void UpdateButtons(mouse_movement
*movement
);
115 bigtime_t click_speed
;
117 bool _EdgeMotion(mouse_movement
*movement
,
118 touch_event
*event
, bool validStart
);
119 inline void _NoTouchToMovement(touch_event
*event
,
120 mouse_movement
*movement
);
121 inline void _MoveToMovement(touch_event
*event
,
122 mouse_movement
*movement
);
123 inline bool _CheckScrollingToMovement(touch_event
*event
,
124 mouse_movement
*movement
);
126 bool fMovementStarted
;
127 bool fScrollingStarted
;
133 bool fTapdragStarted
;
135 bool fValidEdgeMotion
;
136 bigtime_t fLastEdgeMotion
;
137 float fRestEdgeMotion
;
141 bigtime_t fClickLastTime
;
143 uint32 fButtonsState
;