summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/synaptics-properties.h3
-rw-r--r--man/synaptics.man8
-rw-r--r--src/properties.c9
-rw-r--r--src/synaptics.c55
-rw-r--r--src/synapticsstr.h1
-rw-r--r--tools/synclient.c1
6 files changed, 76 insertions, 1 deletions
diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h
index b717880..19bd2b2 100644
--- a/include/synaptics-properties.h
+++ b/include/synaptics-properties.h
@@ -116,6 +116,9 @@
#define SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER "Synaptics Circular Scrolling Trigger"
/* 8 bit (BOOL) */
+#define SYNAPTICS_PROP_CIRCULAR_PAD "Synaptics Circular Pad"
+
+/* 8 bit (BOOL) */
#define SYNAPTICS_PROP_PALM_DETECT "Synaptics Palm Detection"
/* 32 bit, 2 values, width, z */
diff --git a/man/synaptics.man b/man/synaptics.man
index 7652404..eb04eb2 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -351,6 +351,13 @@ l l.
.TE
Property: "Synaptics Circular Scrolling Trigger"
.TP
+.BI "Option \*qCircularPad\*q \*q" boolean \*q
+.
+Instead of being a rectangle, the edge is the ellipse enclosed by the
+Left/Right/Top/BottomEdge parameters.
+.
+For circular touchpads. Property: "Synaptics Circular Pad"
+.TP
.BI "Option \*qPalmDetect\*q \*q" boolean \*q
If palm detection should be enabled.
.
@@ -933,7 +940,6 @@ The following options are no longer part of the driver configuration:
.TP
.BI "Option \*qEdgeMotionUseAlways\*q \*q" boolean \*q
.TP
-.BI "Option \*qCircularPad\*q \*q" boolean \*q
.SH "AUTHORS"
.LP
diff --git a/src/properties.c b/src/properties.c
index 0041544..886d8c2 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -295,6 +295,9 @@ InitDeviceProperties(InputInfoPtr pInfo)
prop_circscroll_trigger =
InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 1,
&para->circular_trigger);
+ prop_circpad =
+ InitAtom(pInfo->dev, SYNAPTICS_PROP_CIRCULAR_PAD, 8, 1,
+ &para->circular_pad);
prop_palm =
InitAtom(pInfo->dev, SYNAPTICS_PROP_PALM_DETECT, 8, 1,
&para->palm_detect);
@@ -666,6 +669,12 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
para->circular_trigger = trigger;
}
+ else if (property == prop_circpad) {
+ if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
+ return BadMatch;
+
+ para->circular_pad = *(BOOL *) prop->data;
+ }
else if (property == prop_palm) {
if (prop->size != 1 || prop->format != 8 || prop->type != XA_INTEGER)
return BadMatch;
diff --git a/src/synaptics.c b/src/synaptics.c
index 493986d..1c22873 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -701,6 +701,7 @@ set_default_parameters(InputInfoPtr pInfo)
pars->circular_scrolling =
xf86SetBoolOption(opts, "CircularScrolling", FALSE);
pars->circular_trigger = xf86SetIntOption(opts, "CircScrollTrigger", 0);
+ pars->circular_pad = xf86SetBoolOption(opts, "CircularPad", FALSE);
pars->palm_detect = xf86SetBoolOption(opts, "PalmDetect", FALSE);
pars->palm_min_width = xf86SetIntOption(opts, "PalmMinWidth", palmMinWidth);
pars->palm_min_z = xf86SetIntOption(opts, "PalmMinZ", palmMinZ);
@@ -1328,6 +1329,32 @@ DeviceInit(DeviceIntPtr dev)
return !Success;
}
+/*
+ * Convert from absolute X/Y coordinates to a coordinate system where
+ * -1 corresponds to the left/upper edge and +1 corresponds to the
+ * right/lower edge.
+ */
+static void
+relative_coords(SynapticsPrivate * priv, int x, int y,
+ double *relX, double *relY)
+{
+ int minX = priv->synpara.left_edge;
+ int maxX = priv->synpara.right_edge;
+ int minY = priv->synpara.top_edge;
+ int maxY = priv->synpara.bottom_edge;
+ double xCenter = (minX + maxX) / 2.0;
+ double yCenter = (minY + maxY) / 2.0;
+
+ if ((maxX - xCenter > 0) && (maxY - yCenter > 0)) {
+ *relX = (x - xCenter) / (maxX - xCenter);
+ *relY = (y - yCenter) / (maxY - yCenter);
+ }
+ else {
+ *relX = 0;
+ *relY = 0;
+ }
+}
+
/* return angle of point relative to center */
static double
angle(SynapticsPrivate * priv, int x, int y)
@@ -1352,10 +1379,38 @@ diffa(double a1, double a2)
}
static enum EdgeType
+circular_edge_detection(SynapticsPrivate * priv, int x, int y)
+{
+ enum EdgeType edge = 0;
+ double relX, relY, relR;
+
+ relative_coords(priv, x, y, &relX, &relY);
+ relR = SQR(relX) + SQR(relY);
+
+ if (relR > 1) {
+ /* we are outside the ellipse enclosed by the edge parameters */
+ if (relX > M_SQRT1_2)
+ edge |= RIGHT_EDGE;
+ else if (relX < -M_SQRT1_2)
+ edge |= LEFT_EDGE;
+
+ if (relY < -M_SQRT1_2)
+ edge |= TOP_EDGE;
+ else if (relY > M_SQRT1_2)
+ edge |= BOTTOM_EDGE;
+ }
+
+ return edge;
+}
+
+static enum EdgeType
edge_detection(SynapticsPrivate * priv, int x, int y)
{
enum EdgeType edge = NO_EDGE;
+ if (priv->synpara.circular_pad)
+ return circular_edge_detection(priv, x, y);
+
if (x > priv->synpara.right_edge)
edge |= RIGHT_EDGE;
else if (x < priv->synpara.left_edge)
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 3f66b14..54bc154 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -190,6 +190,7 @@ typedef struct _SynapticsParameters {
Bool circular_scrolling; /* Enable circular scrolling */
double scroll_dist_circ; /* Scrolling angle radians */
int circular_trigger; /* Trigger area for circular scrolling */
+ Bool circular_pad; /* Edge has an oval or circular shape */
Bool palm_detect; /* Enable Palm Detection */
int palm_min_width; /* Palm detection width */
int palm_min_z; /* Palm detection depth */
diff --git a/tools/synclient.c b/tools/synclient.c
index f999311..ac31a66 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -121,6 +121,7 @@ static struct Parameter params[] = {
{"CircularScrolling", PT_BOOL, 0, 1, SYNAPTICS_PROP_CIRCULAR_SCROLLING, 8, 0},
{"CircScrollDelta", PT_DOUBLE, .01, 3, SYNAPTICS_PROP_CIRCULAR_SCROLLING_DIST, 0 /* float */, 0},
{"CircScrollTrigger", PT_INT, 0, 8, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 0},
+ {"CircularPad", PT_BOOL, 0, 1, SYNAPTICS_PROP_CIRCULAR_PAD, 8, 0},
{"PalmDetect", PT_BOOL, 0, 1, SYNAPTICS_PROP_PALM_DETECT, 8, 0},
{"PalmMinWidth", PT_INT, 0, 15, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 0},
{"PalmMinZ", PT_INT, 0, 255, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 1},