1 /***************************************************************************
4 * Copyright (C) 2011 Ryan Bourgeois <bluedragonx@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 **************************************************************************/
25 #include "capabilities.h"
27 #define DEFAULT_TRACKPAD_DISABLE 0
28 #define DEFAULT_TOUCH_DOWN 5
29 #define DEFAULT_TOUCH_UP 5
30 #define DEFAULT_IGNORE_THUMB 0
31 #define DEFAULT_IGNORE_PALM 0
32 #define DEFAULT_DISABLE_ON_THUMB 0
33 #define DEFAULT_DISABLE_ON_PALM 0
34 #define DEFAULT_THUMB_RATIO 70
35 #define DEFAULT_THUMB_SIZE 25
36 #define DEFAULT_PALM_SIZE 40
37 #define DEFAULT_BOTTOM_EDGE 10
38 #define DEFAULT_BUTTON_ENABLE 1
39 #define DEFAULT_BUTTON_INTEGRATED 1
40 #define DEFAULT_BUTTON_ZONES 0
41 #define DEFAULT_BOTTOM_EDGE_ZONES 0
42 #define DEFAULT_BUTTON_1TOUCH 3
43 #define DEFAULT_BUTTON_2TOUCH 2
44 #define DEFAULT_BUTTON_3TOUCH 0
45 #define DEFAULT_BUTTON_MOVE 1
46 #define DEFAULT_BUTTON_EXPIRE 100
47 #define DEFAULT_TAP_1TOUCH 1
48 #define DEFAULT_TAP_2TOUCH 3
49 #define DEFAULT_TAP_3TOUCH 2
50 #define DEFAULT_TAP_4TOUCH 0
51 #define DEFAULT_TAP_TIMEOUT 120
52 #define DEFAULT_TAP_HOLD 50
53 #define DEFAULT_TAP_DIST 400
54 #define DEFAULT_GESTURE_HOLD 10
55 #define DEFAULT_GESTURE_WAIT 100
56 #define DEFAULT_SCROLL_DIST 150
57 #define DEFAULT_SCROLL_UP_BTN 4
58 #define DEFAULT_SCROLL_DN_BTN 5
59 #define DEFAULT_SCROLL_LT_BTN 6
60 #define DEFAULT_SCROLL_RT_BTN 7
61 #define DEFAULT_SWIPE_DIST 700
62 #define DEFAULT_SWIPE_UP_BTN 8
63 #define DEFAULT_SWIPE_DN_BTN 9
64 #define DEFAULT_SWIPE_LT_BTN 10
65 #define DEFAULT_SWIPE_RT_BTN 11
66 #define DEFAULT_SWIPE4_DIST 700
67 #define DEFAULT_SWIPE4_UP_BTN 0
68 #define DEFAULT_SWIPE4_DN_BTN 0
69 #define DEFAULT_SWIPE4_LT_BTN 0
70 #define DEFAULT_SWIPE4_RT_BTN 0
71 #define DEFAULT_SCALE_DIST 150
72 #define DEFAULT_SCALE_UP_BTN 12
73 #define DEFAULT_SCALE_DN_BTN 13
74 #define DEFAULT_ROTATE_DIST 150
75 #define DEFAULT_ROTATE_LT_BTN 14
76 #define DEFAULT_ROTATE_RT_BTN 15
77 #define DEFAULT_DRAG_ENABLE 1
78 #define DEFAULT_DRAG_TIMEOUT 350
79 #define DEFAULT_DRAG_WAIT 40
80 #define DEFAULT_DRAG_DIST 200
81 #define DEFAULT_AXIS_X_INVERT 0
82 #define DEFAULT_AXIS_Y_INVERT 0
83 #define DEFAULT_SENSITIVITY 1.0
88 #define MCFG_PRESSURE 3
94 int touch_type; // How to determine touch? 0 for none, 1 for scale, 2 for size, 3 for pressure
95 int touch_minor; // Does the touchpad report touches as ellipses? 0 or 1
96 int touch_min; // Minimum touch value.
97 int touch_max; // Maximum touch value.
98 int pad_width; // Width of the touchpad.
99 int pad_height; // Height of the touchpad.
100 int pad_xmin; // Minimum x coordinate.
101 int pad_ymin; // Minimum y coordinate.
104 int touch_down; // When is a finger touching? 0 - 100 (percentage)
105 int touch_up; // When is a finger released? 0 - 100 (percentage)
106 int ignore_thumb; // Whether or not to ignore thumbs. 0 or 1
107 int ignore_palm; // Whether or not to ignore palms. 0 or 1
108 int disable_on_thumb; // Disable the touchpad if thumb detected. 0 or 1
109 int disable_on_palm; // Disable the touchpad if palm detected. 0 or 1
110 int thumb_ratio; // Ratio of width to length that makes a touch a thumb. 0 - 100
111 int thumb_size; // Minimum touch size for a thumb. 0 - 100
112 int palm_size; // Minimum touch size for a palm. 0 - 100
113 int bottom_edge; // Percent of bottom of trackpad to ignore for new touches. 0 - 100
114 int axis_x_invert; // Whether or not to invert the x axis. 0 or 1.
115 int axis_y_invert; // Whether or not to invert the y axis. 0 or 1.
117 /* Used by Gestures */
120 int trackpad_disable; // Disable the trackpad? 0 or 1
121 int button_enable; // Enable physical buttons? 0 or 1
122 int button_integrated; // Is the button under the touchpad? 0 or 1
123 int button_expire; // How long to consider a touch for button emulation. >= 0
124 int button_zones; // Use button zones for emulation?
125 int bottom_edge_zones; // Use bottom edge zones for emulation?
126 int button_1touch; // What button to emulate when one finger is on the
127 // pad or the first zone is clicked? 0 to 32
128 int button_2touch; // What button to emulate when two fingers are on the
129 // pad or the second zone is clicked? 0 to 32
130 int button_3touch; // What button to emulate when three fingers are on the
131 // pad or the third zone is clicked? 0 to 32
132 int button_move; // Whether or not to count the moving touch towards button
134 int tap_1touch; // What button to emulate for one touch taps? 0 to 32
135 int tap_2touch; // What button to emulate for two touch taps? 0 to 32
136 int tap_3touch; // What button to emulate for three touch taps? 0 to 32
137 int tap_4touch; // What button to emulate for four touch taps? 0 to 32
138 int tap_timeout; // Window for touches when counting for the button. > 0
139 int tap_hold; // How long to "hold down" the emulated button on tap. > 0
140 int tap_dist; // How far to allow a touch to move before it's a moving touch. > 0
141 int gesture_hold; // How long to "hold down" the emulated button for gestures. > 0
142 int gesture_wait; // How long after a gesture to wait before movement is allowed. >= 0
143 int scroll_dist; // Distance needed to trigger a button. >= 0, 0 disables
144 int scroll_up_btn; // Button to use for scroll up. >= 0, 0 is none
145 int scroll_dn_btn; // Button to use for scroll down. >= 0, 0 is none
146 int scroll_lt_btn; // Button to use for scroll left. >= 0, 0 is none
147 int scroll_rt_btn; // Button to use for scroll right. >= 0, 0 is none
148 int swipe_dist; // Distance needed to trigger a button. >= 0, 0 disables
149 int swipe_up_btn; // Button to use for swipe up. >= 0, 0 is none
150 int swipe_dn_btn; // Button to use for swipe down. >= 0, 0 is none
151 int swipe_lt_btn; // Button to use for swipe left. >= 0, 0 is none
152 int swipe_rt_btn; // Button to use for swipe right. >= 0, 0 is none
153 int swipe4_dist; // Distance needed to trigger a button. >= 0, 0 disables
154 int swipe4_up_btn; // Button to use for four finger swipe up. >= 0, 0 is none
155 int swipe4_dn_btn; // Button to use for four finger swipe down. >= 0, 0 is none
156 int swipe4_lt_btn; // Button to use for four finger swipe left. >= 0, 0 is none
157 int swipe4_rt_btn; // Button to use for four finger swipe right. >= 0, 0 is none
158 int scale_dist; // Distance needed to trigger a button. >= 0, 0 disables
159 int scale_up_btn; // Button to use for scale up. >= 0, 0 is none
160 int scale_dn_btn; // Button to use for scale down. >= 0, 0 is none
161 int rotate_dist; // Distance needed to trigger a button. >= 0, 0 disables
162 int rotate_lt_btn; // Button to use for rotate left. >= 0, 0 is none
163 int rotate_rt_btn; // Button to use for rotate right. >= 0, 0 is none
164 int drag_enable; // Enable tap-to-drag? 0 or 1
165 int drag_timeout; // How long to wait for a move after tapping? > 0
166 int drag_wait; // How long to wait before triggering button down? >= 0
167 int drag_dist; // How far is the finger allowed to move during wait time? >= 0
168 double sensitivity_big; // Mouse movement multiplier. >= 1.0 } real sensitivity is
169 double sensitivity_smalldiv; // Mouse movement divisor. >= 1.0 } big * smalldiv
172 /* Load the MConfig struct with its defaults.
174 void mconfig_defaults(struct MConfig* cfg);
176 /* Set and read ->sensitivity_big and _small.
178 * Configuration code must always use these get/set functions.
180 * Runtime code which uses the sensitivity to process events is
181 * expected to access the value in cfg directly.
183 void mconfig_set_sensitivity(struct MConfig *cfg, double sensitivity);
184 double mconfig_get_sensitivity(const struct MConfig *cfg);
186 /* Initialize the MConfig struct.
188 void mconfig_init(struct MConfig* cfg,
189 const struct Capabilities* caps);
191 void mconfig_configure(struct MConfig* cfg,