mirror of
https://github.com/X11Libre/xf86-input-synaptics.git
synced 2026-03-24 01:34:04 +00:00
Soft buttons are only available on clickpad devices, disable them otherwise.
If the clickpad support is runtime enabled/disabled, the property appears/disappears accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
@@ -520,6 +520,7 @@ the total height of the touchpad. Property: "Synaptics Area"
|
||||
.
|
||||
.TP
|
||||
.BI "Option \*qSoftButtonAreas\*q \*q" "RBL RBR RBT RBB MBL MBR MBT MBB" \*q
|
||||
This option is only available on ClickPad devices.
|
||||
Enable soft button click area support on ClickPad devices. The first four
|
||||
parameters define the area of the right button, and the second four parameters
|
||||
define the area of the middle button. The areas are defined by the left, right,
|
||||
@@ -942,6 +943,7 @@ default.
|
||||
|
||||
.TP 7
|
||||
.BI "Synaptics Soft Button Areas"
|
||||
This property is only available on ClickPad devices.
|
||||
The Right and middle soft button areas are used to support right and middle
|
||||
click actions on a ClickPad device. Providing 0 for all values of a given button
|
||||
disables the button area.
|
||||
|
||||
@@ -151,6 +151,24 @@ InitFloatAtom(DeviceIntPtr dev, char *name, int nvalues, float *values)
|
||||
return atom;
|
||||
}
|
||||
|
||||
static void
|
||||
InitSoftButtonProperty(InputInfoPtr pInfo)
|
||||
{
|
||||
SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
|
||||
SynapticsParameters *para = &priv->synpara;
|
||||
int values[8];
|
||||
|
||||
values[0] = para->softbutton_areas[0][0];
|
||||
values[1] = para->softbutton_areas[0][1];
|
||||
values[2] = para->softbutton_areas[0][2];
|
||||
values[3] = para->softbutton_areas[0][3];
|
||||
values[4] = para->softbutton_areas[1][0];
|
||||
values[5] = para->softbutton_areas[1][1];
|
||||
values[6] = para->softbutton_areas[1][2];
|
||||
values[7] = para->softbutton_areas[1][3];
|
||||
prop_softbutton_areas = InitAtom(pInfo->dev, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 8, values);
|
||||
}
|
||||
|
||||
void
|
||||
InitDeviceProperties(InputInfoPtr pInfo)
|
||||
{
|
||||
@@ -301,15 +319,8 @@ InitDeviceProperties(InputInfoPtr pInfo)
|
||||
values[3] = para->area_bottom_edge;
|
||||
prop_area = InitAtom(pInfo->dev, SYNAPTICS_PROP_AREA, 32, 4, values);
|
||||
|
||||
values[0] = para->softbutton_areas[0][0];
|
||||
values[1] = para->softbutton_areas[0][1];
|
||||
values[2] = para->softbutton_areas[0][2];
|
||||
values[3] = para->softbutton_areas[0][3];
|
||||
values[4] = para->softbutton_areas[1][0];
|
||||
values[5] = para->softbutton_areas[1][1];
|
||||
values[6] = para->softbutton_areas[1][2];
|
||||
values[7] = para->softbutton_areas[1][3];
|
||||
prop_softbutton_areas = InitAtom(pInfo->dev, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 8, values);
|
||||
if (para->clickpad)
|
||||
InitSoftButtonProperty(pInfo);
|
||||
|
||||
values[0] = para->hyst_x;
|
||||
values[1] = para->hyst_y;
|
||||
@@ -407,9 +418,20 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
||||
para->tap_time_2 = timeouts[1];
|
||||
para->click_time = timeouts[2];
|
||||
} else if (property == prop_clickpad) {
|
||||
BOOL value;
|
||||
|
||||
if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
value = *(BOOL*)prop->data;
|
||||
if (!para->clickpad && value && !prop_softbutton_areas)
|
||||
InitSoftButtonProperty(pInfo);
|
||||
else if (para->clickpad && !value && prop_softbutton_areas)
|
||||
{
|
||||
XIDeleteDeviceProperty(dev, prop_softbutton_areas, FALSE);
|
||||
prop_softbutton_areas = 0;
|
||||
}
|
||||
|
||||
para->clickpad = *(BOOL*)prop->data;
|
||||
} else if (property == prop_tap_fast)
|
||||
{
|
||||
|
||||
@@ -516,6 +516,9 @@ static void set_softbutton_areas_option(InputInfoPtr pInfo)
|
||||
char *end_str;
|
||||
int i;
|
||||
|
||||
if (!pars->clickpad)
|
||||
return;
|
||||
|
||||
option_string = xf86CheckStrOption(pInfo->options, "SoftButtonAreas", NULL);
|
||||
if (!option_string)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user