|
Lines 513-518
Link Here
|
| 513 |
vertResolution = priv->resy; |
513 |
vertResolution = priv->resy; |
| 514 |
} |
514 |
} |
| 515 |
|
515 |
|
|
|
516 |
/* Clickpad mode -- bottom area is used as buttons */ |
| 517 |
if (priv->is_clickpad) { |
| 518 |
int button_bottom; |
| 519 |
/* Clickpad devices usually the button area at the bottom, and |
| 520 |
* its size seems ca. 20% of the touchpad height no matter how |
| 521 |
* large the pad is. |
| 522 |
*/ |
| 523 |
button_bottom = priv->maxy - (abs(priv->maxy - priv->miny) * 20) / 100; |
| 524 |
if (button_bottom < b && button_bottom >= t) |
| 525 |
b = button_bottom; |
| 526 |
} |
| 527 |
|
| 516 |
/* set the parameters */ |
528 |
/* set the parameters */ |
| 517 |
pars->left_edge = xf86SetIntOption(opts, "LeftEdge", l); |
529 |
pars->left_edge = xf86SetIntOption(opts, "LeftEdge", l); |
| 518 |
pars->right_edge = xf86SetIntOption(opts, "RightEdge", r); |
530 |
pars->right_edge = xf86SetIntOption(opts, "RightEdge", r); |
|
Lines 2241-2246
Link Here
|
| 2241 |
} |
2253 |
} |
| 2242 |
} |
2254 |
} |
| 2243 |
|
2255 |
|
|
|
2256 |
/* clickpad event handling */ |
| 2257 |
static void |
| 2258 |
handle_clickpad(InputInfoPtr pInfo, struct SynapticsHwState *hw, edge_type edge) |
| 2259 |
{ |
| 2260 |
SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); |
| 2261 |
SynapticsParameters *para = &priv->synpara; |
| 2262 |
|
| 2263 |
if (edge & BOTTOM_EDGE) { |
| 2264 |
/* button area */ |
| 2265 |
int width = priv->maxx - priv->minx; |
| 2266 |
int left_button_x, right_button_x; |
| 2267 |
|
| 2268 |
/* left and right clickpad button ranges; |
| 2269 |
* the gap between them is interpreted as a middle-button click |
| 2270 |
*/ |
| 2271 |
left_button_x = width * 2/ 5 + priv->minx; |
| 2272 |
right_button_x = width * 3 / 5 + priv->minx; |
| 2273 |
|
| 2274 |
/* clickpad reports only one button, and we need |
| 2275 |
* to fake left/right buttons depending on the touch position |
| 2276 |
*/ |
| 2277 |
if (hw->left) { /* clicked? */ |
| 2278 |
hw->left = 0; |
| 2279 |
if (hw->x < left_button_x) |
| 2280 |
hw->left = 1; |
| 2281 |
else if (hw->x > right_button_x) |
| 2282 |
hw->right = 1; |
| 2283 |
else |
| 2284 |
hw->middle = 1; |
| 2285 |
} |
| 2286 |
|
| 2287 |
/* Don't move pointer position in the button area during clicked, |
| 2288 |
* except for horiz/vert scrolling is enabled. |
| 2289 |
* |
| 2290 |
* The synaptics driver tends to be pretty sensitive. This hack |
| 2291 |
* is to avoid that the pointer moves slightly and misses the |
| 2292 |
* poistion you aimed to click. |
| 2293 |
* |
| 2294 |
* Also, when the pointer movement is reported, the dragging |
| 2295 |
* (with a sort of multi-touching) doesn't work well, too. |
| 2296 |
*/ |
| 2297 |
if (hw->left || !(para->scroll_edge_horiz || |
| 2298 |
((edge & RIGHT_EDGE) && para->scroll_edge_vert))) |
| 2299 |
hw->z = 0; /* don't move pointer */ |
| 2300 |
|
| 2301 |
} else if (hw->left) { |
| 2302 |
/* dragging */ |
| 2303 |
hw->left = priv->prev_hw.left; |
| 2304 |
hw->right = priv->prev_hw.right; |
| 2305 |
hw->middle = priv->prev_hw.middle; |
| 2306 |
} |
| 2307 |
priv->prev_hw = *hw; |
| 2308 |
} |
| 2244 |
|
2309 |
|
| 2245 |
/* Update the hardware state in shared memory. This is read-only these days, |
2310 |
/* Update the hardware state in shared memory. This is read-only these days, |
| 2246 |
* nothing in the driver reads back from SHM. SHM configuration is a thing of the past. |
2311 |
* nothing in the driver reads back from SHM. SHM configuration is a thing of the past. |
|
Lines 2314-2319
Link Here
|
| 2314 |
SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); |
2379 |
SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); |
| 2315 |
SynapticsParameters *para = &priv->synpara; |
2380 |
SynapticsParameters *para = &priv->synpara; |
| 2316 |
|
2381 |
|
|
|
2382 |
edge_type edge = edge_detection(priv, hw->x, hw->y); |
| 2383 |
|
| 2384 |
/* Clickpad handling for button area */ |
| 2385 |
if (priv->is_clickpad) |
| 2386 |
handle_clickpad(pInfo, hw, edge); |
| 2387 |
|
| 2317 |
/* Treat the first two multi buttons as up/down for now. */ |
2388 |
/* Treat the first two multi buttons as up/down for now. */ |
| 2318 |
hw->up |= hw->multi[0]; |
2389 |
hw->up |= hw->multi[0]; |
| 2319 |
hw->down |= hw->multi[1]; |
2390 |
hw->down |= hw->multi[1]; |