Lines 506-511
Link Here
|
506 |
vertResolution = priv->resy; |
506 |
vertResolution = priv->resy; |
507 |
} |
507 |
} |
508 |
|
508 |
|
|
|
509 |
/* Clickpad mode -- bottom area is used as buttons */ |
510 |
if (priv->is_clickpad) { |
511 |
int button_bottom; |
512 |
/* Clickpad devices usually the button area at the bottom, and |
513 |
* its size seems ca. 20% of the touchpad height no matter how |
514 |
* large the pad is. |
515 |
*/ |
516 |
button_bottom = priv->maxy - (abs(priv->maxy - priv->miny) * 20) / 100; |
517 |
if (button_bottom < b && button_bottom >= t) |
518 |
b = button_bottom; |
519 |
} |
520 |
|
509 |
/* set the parameters */ |
521 |
/* set the parameters */ |
510 |
pars->left_edge = xf86SetIntOption(opts, "LeftEdge", l); |
522 |
pars->left_edge = xf86SetIntOption(opts, "LeftEdge", l); |
511 |
pars->right_edge = xf86SetIntOption(opts, "RightEdge", r); |
523 |
pars->right_edge = xf86SetIntOption(opts, "RightEdge", r); |
Lines 2153-2158
Link Here
|
2153 |
} |
2165 |
} |
2154 |
} |
2166 |
} |
2155 |
|
2167 |
|
|
|
2168 |
/* clickpad event handling */ |
2169 |
static void |
2170 |
handle_clickpad(LocalDevicePtr local, struct SynapticsHwState *hw, edge_type edge) |
2171 |
{ |
2172 |
SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); |
2173 |
SynapticsParameters *para = &priv->synpara; |
2174 |
|
2175 |
if (edge & BOTTOM_EDGE) { |
2176 |
/* button area */ |
2177 |
int width = priv->maxx - priv->minx; |
2178 |
int left_button_x, right_button_x; |
2179 |
|
2180 |
/* left and right clickpad button ranges; |
2181 |
* the gap between them is interpreted as a middle-button click |
2182 |
*/ |
2183 |
left_button_x = width * 2/ 5 + priv->minx; |
2184 |
right_button_x = width * 3 / 5 + priv->minx; |
2185 |
|
2186 |
/* clickpad reports only one button, and we need |
2187 |
* to fake left/right buttons depending on the touch position |
2188 |
*/ |
2189 |
if (hw->left) { /* clicked? */ |
2190 |
hw->left = 0; |
2191 |
if (hw->x < left_button_x) |
2192 |
hw->left = 1; |
2193 |
else if (hw->x > right_button_x) |
2194 |
hw->right = 1; |
2195 |
else |
2196 |
hw->middle = 1; |
2197 |
} |
2198 |
|
2199 |
/* Don't move pointer position in the button area during clicked, |
2200 |
* except for horiz/vert scrolling is enabled. |
2201 |
* |
2202 |
* The synaptics driver tends to be pretty sensitive. This hack |
2203 |
* is to avoid that the pointer moves slightly and misses the |
2204 |
* poistion you aimed to click. |
2205 |
* |
2206 |
* Also, when the pointer movement is reported, the dragging |
2207 |
* (with a sort of multi-touching) doesn't work well, too. |
2208 |
*/ |
2209 |
if (hw->left || !(para->scroll_edge_horiz || |
2210 |
((edge & RIGHT_EDGE) && para->scroll_edge_vert))) |
2211 |
hw->z = 0; /* don't move pointer */ |
2212 |
|
2213 |
} else if (hw->left) { |
2214 |
/* dragging */ |
2215 |
hw->left = priv->prev_hw.left; |
2216 |
hw->right = priv->prev_hw.right; |
2217 |
hw->middle = priv->prev_hw.middle; |
2218 |
} |
2219 |
priv->prev_hw = *hw; |
2220 |
} |
2156 |
|
2221 |
|
2157 |
/* Update the hardware state in shared memory. This is read-only these days, |
2222 |
/* Update the hardware state in shared memory. This is read-only these days, |
2158 |
* nothing in the driver reads back from SHM. SHM configuration is a thing of the past. |
2223 |
* nothing in the driver reads back from SHM. SHM configuration is a thing of the past. |
Lines 2226-2231
Link Here
|
2226 |
SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); |
2291 |
SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); |
2227 |
SynapticsParameters *para = &priv->synpara; |
2292 |
SynapticsParameters *para = &priv->synpara; |
2228 |
|
2293 |
|
|
|
2294 |
edge_type edge = edge_detection(priv, hw->x, hw->y); |
2295 |
|
2296 |
/* Clickpad handling for button area */ |
2297 |
if (priv->is_clickpad) |
2298 |
handle_clickpad(local, hw, edge); |
2299 |
|
2229 |
/* Treat the first two multi buttons as up/down for now. */ |
2300 |
/* Treat the first two multi buttons as up/down for now. */ |
2230 |
hw->up |= hw->multi[0]; |
2301 |
hw->up |= hw->multi[0]; |
2231 |
hw->down |= hw->multi[1]; |
2302 |
hw->down |= hw->multi[1]; |