On Sun, 6 Nov 2005, Stéphane Rosi wrote:

> I have made some modifications to my patch to make it better.
...
> If I have forgotten something or if you have
> questions/critics/suggestions, don't hesitate to make me know!

Thanks for the patch, it looks good. Just one comment though. There is no
need for the PressureMotion boolean parameter, because you can get the
same effect by setting MinFactor=MaxFactor=1. What do you think about the
patch below? I'll include it in the next driver release if you don't mind.

diff -u -r synaptics/README synaptics.new/README
--- synaptics/README    2005-11-14 21:45:56.000000000 +0100
+++ synaptics.new/README        2005-11-14 21:02:23.000000000 +0100
@@ -27,6 +27,7 @@
 - Multifinger taps: two finger for middle button and three finger
   for right button events. (Needs hardware support. Not all models
   implement this feature.)
+- Pressure dependent motion speed.
 - Run-time configuration using shared memory. This means you can
   change parameter settings without restarting the X server.

diff -u -r synaptics/manpages/synaptics.5 synaptics.new/manpages/synaptics.5
--- synaptics/manpages/synaptics.5      2005-11-14 21:45:56.000000000 +0100
+++ synaptics.new/manpages/synaptics.5  2005-11-14 21:35:13.000000000 +0100
@@ -44,6 +44,8 @@
 .
 Not all models implement this feature.)
 .IP \(bu 4
+Pressure dependent motion speed.
+.IP \(bu 4
 Run-time configuration using shared memory. This means you can change
 parameter settings without restarting the X server.
 .LP
@@ -152,6 +154,18 @@
 \fBAccelFactor\fR (Float)
 Acceleration factor.
 .TP
+\fBPressureMotionMinZ\fR (Integer)
+Finger pressure at which minimum pressure motion factor is applied.
+.TP
+\fBPressureMotionMaxZ\fR (Integer)
+Finger pressure at which maximum pressure motion factor is applied.
+.TP
+\fBPressureMotionMinFactor\fR (Integer)
+Lowest setting for pressure motion factor.
+.TP
+\fBPressureMotionMaxFactor\fR (Integer)
+Greatest setting for pressure motion factor.
+.TP
 \fBUpDownScrolling\fR (Bool)
 If on, the up/down buttons generate button 4/5 events.
 .
@@ -395,6 +409,28 @@
 speed is increased linearly.
 .
 .LP
+When pressure motion is activated, the cursor motion speed depends
+on the pressure exerted on the touchpad (the more pressure exerted on
+the touchpad, the faster the pointer).
+.
+More precisely the speed is first calculated according to MinSpeed,
+MaxSpeed and AccelFactor, and then is multiplied by a sensitivity
+factor.
+.
+The sensitivity factor can be adjusted using the PressureMotion
+parameters.
+.
+If the pressure is below PressureMotionMinZ, PressureMotionMinFactor
+is used, and if the pressure is greater than PressureMotionMaxZ,
+PressureMotionMaxFactor is used.
+.
+By default, PressureMotionMinZ and PressureMotionMaxZ are equal to
+EdgeMotionMinZ and EdgeMotionMaxZ.
+.
+For a pressure value between PressureMotionMinZ and
+PressureMotionMaxZ, the factor is increased linearly.
+.
+.LP
 Since most synaptics touchpad models don't have a button that
 corresponds to the middle button on a mouse, the driver can emulate
 middle mouse button events.
diff -u -r synaptics/synaptics.c synaptics.new/synaptics.c
--- synaptics/synaptics.c       2005-11-14 21:45:56.000000000 +0100
+++ synaptics.new/synaptics.c   2005-11-14 21:37:24.000000000 +0100
@@ -384,6 +384,8 @@
     pars->palm_detect        = xf86SetBoolOption(local->options, "PalmDetect", 
TRUE);
     pars->palm_min_width     = xf86SetIntOption(local->options, 
"PalmMinWidth", 10);
     pars->palm_min_z         = xf86SetIntOption(local->options, "PalmMinZ", 
200);
+    pars->press_motion_min_z = xf86SetIntOption(local->options, 
"PressureMotionMinZ", pars->edge_motion_min_z);
+    pars->press_motion_max_z = xf86SetIntOption(local->options, 
"PressureMotionMaxZ", pars->edge_motion_max_z);

     str_par = xf86FindOptionValue(local->options, "MinSpeed");
     if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->min_speed) != 1))
@@ -401,6 +403,14 @@
     if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->coasting_speed) != 1))
        pars->coasting_speed = 0.0;

+    str_par = xf86FindOptionValue(local->options, "PressureMotionMinFactor");
+    if ((!str_par) || (xf86sscanf(str_par, "%lf", 
&pars->press_motion_min_factor) != 1))
+       pars->press_motion_min_factor = 1;
+    str_par = xf86FindOptionValue(local->options, "PressureMotionMaxFactor");
+    if ((!str_par) || (xf86sscanf(str_par, "%lf", 
&pars->press_motion_max_factor) != 1))
+       pars->press_motion_max_factor = 1;
+
+    /* Warn about (and fix) incorrectly configured CircScrollTrigger 
parameters */
     if (pars->circular_trigger < 0 || pars->circular_trigger > 8) {
        xf86Msg(X_WARNING, "Unknown circular scrolling trigger, using 0 
(edges)");
        pars->circular_trigger = 0;
@@ -1248,6 +1258,22 @@
                speed = para->min_speed;
            }

+           /* modify speed according to pressure */
+           {
+               int minZ = para->press_motion_min_z;
+               int maxZ = para->press_motion_max_z;
+               double minFctr = para->press_motion_min_factor;
+               double maxFctr = para->press_motion_max_factor;
+
+               if (hw->z <= minZ) {
+                   speed *= minFctr;
+               } else if (hw->z >= maxZ) {
+                   speed *= maxFctr;
+               } else {
+                   speed *= minFctr + (hw->z - minZ) * (maxFctr - minFctr) / 
(maxZ - minZ);
+               }
+           }
+
            /* save the fraction, report the integer part */
            tmpf = dx * speed + x_edge_speed * dtime + priv->frac_x;
            priv->frac_x = xf86modf(tmpf, &integral);
diff -u -r synaptics/synaptics.h synaptics.new/synaptics.h
--- synaptics/synaptics.h       2005-11-14 21:45:56.000000000 +0100
+++ synaptics.new/synaptics.h   2005-11-14 21:35:44.000000000 +0100
@@ -89,6 +89,10 @@
     int palm_min_width;                            /* Palm detection width */
     int palm_min_z;                        /* Palm detection depth */
     double coasting_speed;                 /* Coasting threshold scrolling 
speed */
+    int press_motion_min_z;                /* finger pressure at which minimum 
pressure motion factor is applied */
+    int press_motion_max_z;                /* finger pressure at which maximum 
pressure motion factor is applied */
+    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 */
 } SynapticsSHM;

 /*
diff -u -r synaptics/synclient.c synaptics.new/synclient.c
--- synaptics/synclient.c       2005-11-14 21:45:56.000000000 +0100
+++ synaptics.new/synclient.c   2005-11-14 21:35:50.000000000 +0100
@@ -94,6 +94,10 @@
     DEFINE_PAR("PalmMinWidth",         palm_min_width,          PT_INT,    0, 
15),
     DEFINE_PAR("PalmMinZ",             palm_min_z,              PT_INT,    0, 
255),
     DEFINE_PAR("CoastingSpeed",        coasting_speed,          PT_DOUBLE, 0, 
20),
+    DEFINE_PAR("PressureMotionMinZ",   press_motion_min_z,      PT_INT,    1, 
255),
+    DEFINE_PAR("PressureMotionMaxZ",   press_motion_max_z,      PT_INT,    1, 
255),
+    DEFINE_PAR("PressureMotionMinFactor", press_motion_min_factor, PT_DOUBLE, 
0, 10.0),
+    DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 
0, 10.0),
     { 0, 0, 0, 0, 0 }
 };


-- 
Peter Osterlund - [EMAIL PROTECTED]
http://web.telia.com/~u89404340

Reply via email to