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_BUTTON_1TOUCH 3
42 #define DEFAULT_BUTTON_2TOUCH 2
43 #define DEFAULT_BUTTON_3TOUCH 0
44 #define DEFAULT_BUTTON_MOVE 1
45 #define DEFAULT_BUTTON_EXPIRE 100
46 #define DEFAULT_TAP_1TOUCH 1
47 #define DEFAULT_TAP_2TOUCH 3
48 #define DEFAULT_TAP_3TOUCH 2
49 #define DEFAULT_TAP_4TOUCH 0
50 #define DEFAULT_TAP_TIMEOUT 120
51 #define DEFAULT_TAP_HOLD 50
52 #define DEFAULT_TAP_DIST 400
53 #define DEFAULT_GESTURE_HOLD 10
54 #define DEFAULT_GESTURE_WAIT 100
55 #define DEFAULT_SCROLL_DIST 150
56 #define DEFAULT_SCROLL_UP_BTN 4
57 #define DEFAULT_SCROLL_DN_BTN 5
58 #define DEFAULT_SCROLL_LT_BTN 6
59 #define DEFAULT_SCROLL_RT_BTN 7
60 #define DEFAULT_SWIPE_DIST 700
61 #define DEFAULT_SWIPE_UP_BTN 8
62 #define DEFAULT_SWIPE_DN_BTN 9
63 #define DEFAULT_SWIPE_LT_BTN 10
64 #define DEFAULT_SWIPE_RT_BTN 11
65 #define DEFAULT_SWIPE4_DIST 700
66 #define DEFAULT_SWIPE4_UP_BTN 0
67 #define DEFAULT_SWIPE4_DN_BTN 0
68 #define DEFAULT_SWIPE4_LT_BTN 0
69 #define DEFAULT_SWIPE4_RT_BTN 0
70 #define DEFAULT_SCALE_DIST 150
71 #define DEFAULT_SCALE_UP_BTN 12
72 #define DEFAULT_SCALE_DN_BTN 13
73 #define DEFAULT_ROTATE_DIST 150
74 #define DEFAULT_ROTATE_LT_BTN 14
75 #define DEFAULT_ROTATE_RT_BTN 15
76 #define DEFAULT_DRAG_ENABLE 1
77 #define DEFAULT_DRAG_TIMEOUT 350
78 #define DEFAULT_DRAG_WAIT 40
79 #define DEFAULT_DRAG_DIST 200
80 #define DEFAULT_AXIS_X_INVERT 0
81 #define DEFAULT_AXIS_Y_INVERT 0
82 #define DEFAULT_SENSITIVITY 1.0
87 #define MCFG_PRESSURE 3
93 int touch_type; // How to determine touch? 0 for none, 1 for scale, 2 for size, 3 for pressure
94 int touch_minor; // Does the touchpad report touches as ellipses? 0 or 1
95 int touch_min; // Minimum touch value.
96 int touch_max; // Maximum touch value.
97 int pad_width; // Width of the touchpad.
98 int pad_height; // Height of the touchpad.
101 int touch_down; // When is a finger touching? 0 - 100 (percentage)
102 int touch_up; // When is a finger released? 0 - 100 (percentage)
103 int ignore_thumb; // Whether or not to ignore thumbs. 0 or 1
104 int ignore_palm; // Whether or not to ignore palms. 0 or 1
105 int disable_on_thumb; // Disable the touchpad if thumb detected. 0 or 1
106 int disable_on_palm; // Disable the touchpad if palm detected. 0 or 1
107 int thumb_ratio; // Ratio of width to length that makes a touch a thumb. 0 - 100
108 int thumb_size; // Minimum touch size for a thumb. 0 - 100
109 int palm_size; // Minimum touch size for a palm. 0 - 100
110 int bottom_edge; // Percent of bottom of trackpad to ignore for new touches. 0 - 100
111 int axis_x_invert; // Whether or not to invert the x axis. 0 or 1.
112 int axis_y_invert; // Whether or not to invert the y axis. 0 or 1.
114 /* Used by Gestures */
117 int trackpad_disable; // Disable the trackpad? 0 or 1
118 int button_enable; // Enable physical buttons? 0 or 1
119 int button_integrated; // Is the button under the touchpad? 0 or 1
120 int button_expire; // How long to consider a touch for button emulation. >= 0
121 int button_zones; // Use button zones for emulation?
122 int button_1touch; // What button to emulate when one finger is on the
123 // pad or the first zone is clicked? 0 to 32
124 int button_2touch; // What button to emulate when two fingers are on the
125 // pad or the second zone is clicked? 0 to 32
126 int button_3touch; // What button to emulate when three fingers are on the
127 // pad or the third zone is clicked? 0 to 32
128 int button_move; // Whether or not to count the moving touch towards button
130 int tap_1touch; // What button to emulate for one touch taps? 0 to 32
131 int tap_2touch; // What button to emulate for two touch taps? 0 to 32
132 int tap_3touch; // What button to emulate for three touch taps? 0 to 32
133 int tap_4touch; // What button to emulate for four touch taps? 0 to 32
134 int tap_timeout; // Window for touches when counting for the button. > 0
135 int tap_hold; // How long to "hold down" the emulated button on tap. > 0
136 int tap_dist; // How far to allow a touch to move before it's a moving touch. > 0
137 int gesture_hold; // How long to "hold down" the emulated button for gestures. > 0
138 int gesture_wait; // How long after a gesture to wait before movement is allowed. >= 0
139 int scroll_dist; // Distance needed to trigger a button. >= 0, 0 disables
140 int scroll_up_btn; // Button to use for scroll up. >= 0, 0 is none
141 int scroll_dn_btn; // Button to use for scroll down. >= 0, 0 is none
142 int scroll_lt_btn; // Button to use for scroll left. >= 0, 0 is none
143 int scroll_rt_btn; // Button to use for scroll right. >= 0, 0 is none
144 int swipe_dist; // Distance needed to trigger a button. >= 0, 0 disables
145 int swipe_up_btn; // Button to use for swipe up. >= 0, 0 is none
146 int swipe_dn_btn; // Button to use for swipe down. >= 0, 0 is none
147 int swipe_lt_btn; // Button to use for swipe left. >= 0, 0 is none
148 int swipe_rt_btn; // Button to use for swipe right. >= 0, 0 is none
149 int swipe4_dist; // Distance needed to trigger a button. >= 0, 0 disables
150 int swipe4_up_btn; // Button to use for four finger swipe up. >= 0, 0 is none
151 int swipe4_dn_btn; // Button to use for four finger swipe down. >= 0, 0 is none
152 int swipe4_lt_btn; // Button to use for four finger swipe left. >= 0, 0 is none
153 int swipe4_rt_btn; // Button to use for four finger swipe right. >= 0, 0 is none
154 int scale_dist; // Distance needed to trigger a button. >= 0, 0 disables
155 int scale_up_btn; // Button to use for scale up. >= 0, 0 is none
156 int scale_dn_btn; // Button to use for scale down. >= 0, 0 is none
157 int rotate_dist; // Distance needed to trigger a button. >= 0, 0 disables
158 int rotate_lt_btn; // Button to use for rotate left. >= 0, 0 is none
159 int rotate_rt_btn; // Button to use for rotate right. >= 0, 0 is none
160 int drag_enable; // Enable tap-to-drag? 0 or 1
161 int drag_timeout; // How long to wait for a move after tapping? > 0
162 int drag_wait; // How long to wait before triggering button down? >= 0
163 int drag_dist; // How far is the finger allowed to move during wait time? >= 0
164 double sensitivity; // Mouse movement multiplier. >= 0
167 /* Load the MConfig struct with its defaults.
169 void mconfig_defaults(struct MConfig* cfg);
171 /* Initialize the MConfig struct.
173 void mconfig_init(struct MConfig* cfg,
174 const struct Capabilities* caps);
176 void mconfig_configure(struct MConfig* cfg,