summaryrefslogtreecommitdiff
path: root/src/properties.c
diff options
context:
space:
mode:
authorAlberto Milone <alberto.milone@canonical.com>2009-07-16 12:08:08 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-17 10:42:31 +1000
commit7179a0eb11a842d9d5a420f5702a411b0dc217a2 (patch)
tree86133842e0ba038c7cc4fab5c8aa7095d932aff7 /src/properties.c
parent0c3fbceb1b2a18f92166fe75c44b5aaada693c4b (diff)
Add active area outside of which movements, scrolling, tapping are ignored.
On some touchpads physical buttons are located under the touchpad surface. As a result, when users try to perform a click, by pressing that part of the surface of the touchpad, they get a click, a movement, a tap and (in some cases) a scroll, which can make clicks quite inaccurate. The "Synaptics Area" property can be used to define the edges of the active area of the touchpad so that all movement, scrolling and tapping which take place outside of this area will be ignored. This property is disabled by default. Fixes xorg bug #21613. Signed-off-by: Alberto Milone <alberto.milone@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/properties.c')
-rw-r--r--src/properties.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/properties.c b/src/properties.c
index 43bcabb..d03ea6e 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -83,6 +83,7 @@ Atom prop_grab = 0;
Atom prop_gestures = 0;
Atom prop_capabilities = 0;
Atom prop_resolution = 0;
+Atom prop_area = 0;
static Atom
InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values)
@@ -268,6 +269,11 @@ InitDeviceProperties(LocalDevicePtr local)
values[1] = para->resolution_horiz;
prop_resolution = InitAtom(local->dev, SYNAPTICS_PROP_RESOLUTION, 32, 2, values);
+ values[0] = para->area_left_edge;
+ values[1] = para->area_right_edge;
+ values[2] = para->area_top_edge;
+ values[3] = para->area_bottom_edge;
+ prop_area = InitAtom(local->dev, SYNAPTICS_PROP_AREA, 32, 4, values);
}
int
@@ -622,6 +628,20 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
{
/* read-only */
return BadValue;
+ } else if (property == prop_area)
+ {
+ INT32 *area;
+ if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER)
+ return BadMatch;
+
+ area = (INT32*)prop->data;
+ if ((((area[0] != 0) && (area[1] != 0)) && (area[0] > area[1]) ) || (((area[2] != 0) && (area[3] != 0)) && (area[2] > area[3])))
+ return BadValue;
+
+ para->area_left_edge = area[0];
+ para->area_right_edge = area[1];
+ para->area_top_edge = area[2];
+ para->area_bottom_edge = area[3];
}
return Success;