@@ -134,6 +134,7 @@
double press_motion_min_factor; /* factor applied on speed when finger pressure is at minimum */
double press_motion_max_factor; /* factor applied on speed when finger pressure is at minimum */
Bool grab_event_device; /* grab event device for exclusive use? */
+ Bool clickpad; /* clickpad mode */
} SynapticsSHM;
/*
@@ -499,6 +499,7 @@
pars->press_motion_min_factor = xf86SetRealOption(opts, "PressureMotionMinFactor", 1.0);
pars->press_motion_max_factor = xf86SetRealOption(opts, "PressureMotionMaxFactor", 1.0);
pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE);
+ pars->clickpad = xf86SetBoolOption(opts, "Clickpad", FALSE);
/* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
if (pars->top_edge > pars->bottom_edge) {
@@ -1902,6 +1903,44 @@
}
}
+/* left and right clickpad button ranges;
+ * the gap between them is interpreted as a middle-button click
+ */
+#define CLICKPAD_LEFT_BTN_X(p) \
+ (((p)->maxx - (p)->minx) * 2 / 5 + (p)->minx)
+#define CLICKPAD_RIGHT_BTN_X(p) \
+ (((p)->maxx - (p)->minx) * 3 / 5 + (p)->minx)
+
+static void
+MangleClickpad(SynapticsPrivate *priv, struct SynapticsHwState *hw)
+{
+ SynapticsSHM *para = priv->synpara;
+
+ /* clickpad mode reports Y over YMAX as a button area */
+ if (hw->y > priv->maxy) {
+ /* clickpad reports only the middle button, and we need
+ * to fake left/right buttons depending on the touch position
+ */
+ if (hw->left || hw->middle || hw->right) { /* clicked? */
+ hw->left = hw->middle = hw->right = 0;
+ if (hw->x < CLICKPAD_LEFT_BTN_X(priv));
+ hw->left = 1;
+ else if (hw->x > CLICKPAD_RIGHT_BTN_X(priv))
+ hw->right = 1;
+ else
+ hw->middle = 1;
+ }
+ /* don't move pointer in the button area */
+ hw->x = para->x;
+ hw->y = para->y;
+ hw->z = 0;
+ } else if (hw->left || hw->middle || hw->right) {
+ /* dragging */
+ hw->left = para->left;
+ hw->right = para->right;
+ hw->middle = para->middle;
+ }
+}
/*
* React on changes in the hardware state. This function is called every time
@@ -1924,6 +1963,9 @@
int timeleft;
int i;
+ if (para->clickpad)
+ MangleClickpad(priv, hw);
+
/* update hardware state in shared memory */
para->x = hw->x;
para->y = hw->y;
@@ -154,6 +154,7 @@
Bool has_pressure; /* device reports pressure */
enum TouchpadModel model; /* The detected model */
+ Bool clickpad; /* clickpad mode */
} SynapticsPrivate;
#endif /* _SYNAPTICSSTR_H_ */
@@ -411,6 +411,11 @@
.
This can be achieved by switching to a text console and then switching
back to X.
+.TP 7
+.BI "Option \*qClickpad\*q \*q" boolean \*q
+Supports Clickpad. The driver handles a middle-button click in the
+special low area as left/right/middle buttons according to the position.
+This mode works only with evdev protocol.
.
.
.LP
@@ -209,6 +209,8 @@
SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 1),
DEFINE_PAR("GrabEventDevice", grab_event_device, PT_BOOL, 0, 1,
SYNAPTICS_PROP_GRAB, 8, 0),
+ DEFINE_PAR("Clickpad", clickpad, PT_BOOL, 0, 1,
+ SYNAPTICS_PROP_CLICKPAD, 8, 0),
{ NULL, 0, 0, 0, 0 }
};
@@ -142,4 +142,7 @@
/* 8 bit (BOOL) */
#define SYNAPTICS_PROP_GRAB "Synaptics Grab Event Device"
+/* 8 bit (BOOL) */
+#define SYNAPTICS_PROP_CLICKPAD "Synaptics Clickpad Mode"
+
#endif /* _SYNAPTICS_PROPERTIES_H_ */