Commit 4f543ce1 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Revert "Drop circular pad support"

This reverts commit 3b02e7fd

.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>

Conflicts:
	man/synaptics.man
	src/synaptics.c
Acked-by: Daniel Stone's avatarDaniel Stone <daniel@fooishbar.org>
parent 5d8cdaf4
......@@ -115,6 +115,9 @@
* left, left, left + top */
#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"
......
......@@ -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
......
......@@ -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;
......
......@@ -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)
......@@ -1351,11 +1378,39 @@ diffa(double a1, double a2)
return da;
}
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)
......
......@@ -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 */
......
......@@ -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},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment