Hi,

I have a macbook, and a while ago (May 2008, when synaptics wasn't
included in the Xorg project), I made a patch in order to improve
usability of touchpad with one mouse button only.

I tried to send it to the maintainer of synaptics at this time, but I
had no answer. I also sent it on the mactel-linux mailing list.

Included the patch
if there wasn't any drastic modifications to the driver, it should
still apply since it is very simple.

Are you interested ?

How it works.
When configured that way, and if there is two or three fingers detected
on the touchpad while the (left) button is pressed, a middle or right
button click is generated.


Mildred
-- 
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk: <[EMAIL PROTECTED]>
│ Site: <http://ki.lya.online.fr>              GPG ID: 9A7D 2E2B
│ Fingerprint: 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 9A7D 2E2B
diff --git a/manpages/synaptics.5 b/manpages/synaptics.5
index 6e99bd0..2d804ba 100644
--- a/manpages/synaptics.5
+++ b/manpages/synaptics.5
@@ -288,6 +288,21 @@ Which mouse button is reported on a non-corner three-finger tap.
 .
 Set to 0 to disable.
 .TP
+\fBClickFinger1\fR (Integer)
+Which mouse button is reported when left-clicking with one finger.
+.
+Set to 0 to disable.
+.TP
+\fBClickFinger2\fR (Integer)
+Which mouse button is reported when left-clicking with two fingers.
+.
+Set to 0 to disable.
+.TP
+\fBClickFinger3\fR (Integer)
+Which mouse button is reported when left-clicking with three fingers.
+.
+Set to 0 to disable.
+.TP
 \fBCircularScrolling\fR (Bool)
 If on, circular scrolling is used.
 .TP
diff --git a/synaptics.c b/synaptics.c
index 802132c..98f4af8 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -454,6 +454,9 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
     pars->tap_action[F1_TAP] = xf86SetIntOption(opts, "TapButton1",     1);
     pars->tap_action[F2_TAP] = xf86SetIntOption(opts, "TapButton2",     2);
     pars->tap_action[F3_TAP] = xf86SetIntOption(opts, "TapButton3",     3);
+    pars->click_action[F1_CLICK1] = xf86SetIntOption(opts, "ClickFinger1",     1);
+    pars->click_action[F2_CLICK1] = xf86SetIntOption(opts, "ClickFinger2",     1);
+    pars->click_action[F3_CLICK1] = xf86SetIntOption(opts, "ClickFinger3",     1);
     pars->circular_scrolling = xf86SetBoolOption(opts, "CircularScrolling", FALSE);
     pars->circular_trigger   = xf86SetIntOption(opts, "CircScrollTrigger", 0);
     pars->circular_pad       = xf86SetBoolOption(opts, "CircularPad", FALSE);
@@ -1730,6 +1733,37 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
     return delay;
 }
 
+static int
+HandleClickWithFingers(SynapticsSHM *para, struct SynapticsHwState *hw)
+{
+    int action = 0;
+    switch(hw->numFingers){
+        case 1:
+            action = para->click_action[F1_CLICK1];
+            break;
+        case 2:
+            action = para->click_action[F2_CLICK1];
+            break;
+        case 3:
+            action = para->click_action[F3_CLICK1];
+            break;
+    }
+    switch(action){
+        case 1:
+            hw->left = 1;
+            break;
+        case 2:
+            hw->left = 0;
+            hw->middle = 1;
+            break;
+        case 3:
+            hw->left = 0;
+            hw->right = 1;
+            break;
+    }
+}
+
+
 /*
  * React on changes in the hardware state. This function is called every time
  * the hardware state changes. The return value is used to specify how many
@@ -1787,6 +1821,11 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
     /* 3rd button emulation */
     hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
 
+    /* Fingers emulate other buttons */
+    if(hw->left && hw->numFingers >= 1){
+        HandleClickWithFingers(para, hw);
+    }
+
     /* Two finger emulation */
     if (hw->z >= para->emulate_twofinger_z && hw->numFingers == 1) {
 	hw->numFingers = 2;
diff --git a/synaptics.h b/synaptics.h
index f780849..e5493e7 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -18,6 +18,13 @@ typedef enum {
     MAX_TAP
 } TapEvent;
 
+typedef enum {
+    F1_CLICK1 = 0,			    /* Click left, one finger */
+    F2_CLICK1,				    /* Click left, two fingers */
+    F3_CLICK1,				    /* Click left, three fingers */
+    MAX_CLICK
+} ClickFingerEvent;
+
 #define SYN_MAX_BUTTONS 12		    /* Max number of mouse buttons */
 
 struct SynapticsHwInfo {
@@ -90,6 +97,7 @@ typedef struct _SynapticsSHM
     Bool locked_drags;			    /* Enable locked drags */
     int locked_drag_time;		    /* timeout for locked drags */
     int tap_action[MAX_TAP];		    /* Button to report on tap events */
+    int click_action[MAX_CLICK];	    /* Button to report on click with fingers */
     Bool circular_scrolling;		    /* Enable circular scrolling */
     double scroll_dist_circ;		    /* Scrolling angle radians */
     int circular_trigger;		    /* Trigger area for circular scrolling */
diff --git a/synclient.c b/synclient.c
index aa5479c..cd35e73 100644
--- a/synclient.c
+++ b/synclient.c
@@ -96,6 +96,9 @@ static struct Parameter params[] = {
     DEFINE_PAR("TapButton1",           tap_action[F1_TAP],      PT_INT,    0, SYN_MAX_BUTTONS),
     DEFINE_PAR("TapButton2",           tap_action[F2_TAP],      PT_INT,    0, SYN_MAX_BUTTONS),
     DEFINE_PAR("TapButton3",           tap_action[F3_TAP],      PT_INT,    0, SYN_MAX_BUTTONS),
+    DEFINE_PAR("ClickFinger1",         click_action[F1_CLICK1], PT_INT,    0, SYN_MAX_BUTTONS),
+    DEFINE_PAR("ClickFinger2",         click_action[F2_CLICK1], PT_INT,    0, SYN_MAX_BUTTONS),
+    DEFINE_PAR("ClickFinger3",         click_action[F3_CLICK1], PT_INT,    0, SYN_MAX_BUTTONS),
     DEFINE_PAR("CircularScrolling",    circular_scrolling,      PT_BOOL,   0, 1),
     DEFINE_PAR("CircScrollDelta",      scroll_dist_circ,        PT_DOUBLE, .01, 3),
     DEFINE_PAR("CircScrollTrigger",    circular_trigger,        PT_INT,    0, 8),
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to