Hi!

I have made some modifications to my patch to make it better.

>>1. The PressureFactor parameter is redundant, because the driver behavior
>>   only depends on the product PressureFactor * AccelFactor. Maybe it
>>   would be better to have a boolean parameter that enables the edge
>>   motion parameters to be used also when not on an edge.

The pressure motion feature is now controlled by 5 parameters:
* PressureMotion: to enable or disable the feature
* PressionMotionMinZ and MaxZ: by default the values are those of
EdgeMotion parameters. I have added these ones in case someone wanted to
use differents settings.
* PressureMotionMinFactor and MaxFactor: they control by how much the
speed of the cursor is multiplied (see 2). I have not used min and max
speed parameters as they conflict with MinSpeed and MaxSpeed.


>>2. It's not possible to disable speed dependent acceleration but have
>>   pressure dependent acceleration enabled.

The speed is calculated this way:
* first, the speed is calculated as before with MinSpeed, MaxSpeed and
AccelFactor
* then, the result is multiplied by a factor, determined linearly
between PressureMotionMinFactor and MaxFactor.

So now:
* the pression motion is independant from the accelaration. Acceleration
 can be disabled by setting MinSpeed=MaxSpeed as before and the pressure
motion will continue to work.
* The real min speed is MinSpeed*PressureMotionMinFactor (the same for
max).

I have been thinking about other ways to implement the pressure
sensitivity but this seems to be the best way.
In fact, in order to make acceleration and pressure independant, the
speed modification must take place after acceleration computation (or
disabling acceleration, would imply loosing pressure sensitivity).
I could also have applied the factor to dx at the beggining, but then a
change in PressureMotion parameters would also change the acceleration
behaviour. This would make the effects less predictable.



>>3. There is no man page update describing what the new parameters do.

Done.


>>4. I think the default behavior should not be changed. On some touchpads
>>   it can be hard to accurately control the Z pressure, so pressure
>>   dependent speed could behave like randomly changing speed.

By default PressureMotion is off now.


I attach the new patch this this mail.

If I have forgotten something or if you have
questions/critics/suggestions, don't hesitate to make me know!

-- 
Steph
diff -Naur xfree86-driver-synaptics-0.14.3/manpages/synaptics.5 xfree86-driver-synaptics-0.14.3-patch/manpages/synaptics.5
--- xfree86-driver-synaptics-0.14.3/manpages/synaptics.5	2005-11-03 15:09:32.000000000 -0800
+++ xfree86-driver-synaptics-0.14.3-patch/manpages/synaptics.5	2005-11-06 15:39:02.000000000 -0800
@@ -44,6 +44,8 @@
 .
 Not all models implement this feature.)
 .IP \(bu 4
+Pressure dependant 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,21 @@
 \fBAccelFactor\fR (Float)
 Acceleration factor.
 .TP
+\fBPressureMotion (Bool)
+Switch on/off pressure dependant motion speed.
+.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 edge motion factor.
+.TP
+\fBPressureMotionMaxFactor\fR (Integer)
+Greatest setting for edge motion factor.
+.TP
 \fBUpDownScrolling\fR (Bool)
 If on, the up/down buttons generate button 4/5 events.
 .
@@ -388,13 +405,35 @@
 The sensitivity can be adjusted using the EdgeMotion parameters.
 .
 If the pressure is below EdgeMotionMinZ, EdgeMotionMinSpeed is used,
-and if the pressure is greater than EdgeMotionMaxZ, EdgeMotionMaxSpeed
-is used.
+and if the pressure is greater than EdgeMotionMaxZ,
+EdgeMotionMaxSpeed is used.
 .
 For a pressure value between EdgeMotionMinZ and EdgeMotionMaxZ, the
 speed is increased linearly.
 .
 .LP
+When pressure motion is activated, the cursor motion speed depends
+on the pressure exerced on the touchpad (the more pressure exerced 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 isgreater than PressureMotionMaxZ,
+PressureMotionMaxFactor is used.
+.
+By default, PressureMotionMinZ and PressureMotionMaxZ are equal to
+EdgeMotionMinZ and EdgeMotionMaxZ.
+.
+For a pressure value between EdgeMotionMinZ and EdgeMotionMaxZ, 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 -Naur xfree86-driver-synaptics-0.14.3/README xfree86-driver-synaptics-0.14.3-patch/README
--- xfree86-driver-synaptics-0.14.3/README	2005-07-09 15:09:40.000000000 -0700
+++ xfree86-driver-synaptics-0.14.3-patch/README	2005-11-06 01:55:06.000000000 -0800
@@ -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 dependant motion speed.
 - Run-time configuration using shared memory. This means you can
   change parameter settings without restarting the X server.
 
diff -Naur xfree86-driver-synaptics-0.14.3/synaptics.c xfree86-driver-synaptics-0.14.3-patch/synaptics.c
--- xfree86-driver-synaptics-0.14.3/synaptics.c	2005-07-09 15:09:40.000000000 -0700
+++ xfree86-driver-synaptics-0.14.3-patch/synaptics.c	2005-11-05 20:24:42.000000000 -0800
@@ -385,7 +385,10 @@
     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       = xf86SetBoolOption(local->options, "PressureMotion", FALSE);
+    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))
 	pars->min_speed=0.09;
@@ -401,7 +404,14 @@
     str_par = xf86FindOptionValue(local->options, "CoastingSpeed");
     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=0.5;
+    str_par = xf86FindOptionValue(local->options, "PressureMotionMaxFactor");
+    if ((!str_par) || (xf86sscanf(str_par, "%lf", &pars->press_motion_max_factor) != 1))
+	pars->press_motion_max_factor=2.;		
+    
+    /* 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;
@@ -1243,7 +1253,7 @@
 		    y_edge_speed = (int)(edge_speed * relY);
 		}
 	    }
-
+		
 	    /* speed depending on distance/packet */
 	    dist = move_distance(dx, dy);
 	    speed = dist * para->accl;
@@ -1253,6 +1263,22 @@
 		speed = para->min_speed;
 	    }
 
+	    /* modify speed according to pressure */
+	    if (para->press_motion) {
+                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 -Naur xfree86-driver-synaptics-0.14.3/synaptics.h xfree86-driver-synaptics-0.14.3-patch/synaptics.h
--- xfree86-driver-synaptics-0.14.3/synaptics.h	2005-07-09 15:09:40.000000000 -0700
+++ xfree86-driver-synaptics-0.14.3-patch/synaptics.h	2005-11-05 20:15:23.000000000 -0800
@@ -87,7 +87,12 @@
     int palm_min_width;			    /* Palm detection width */
     int palm_min_z;			    /* Palm detection depth */
     double coasting_speed;		    /* Coasting threshold scrolling speed */
-} SynapticsSHM;
+    Bool press_motion;			    /* Activate motion with with pressure control */
+    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;
 
 /*
  * Minimum and maximum values for scroll_button_repeat
diff -Naur xfree86-driver-synaptics-0.14.3/synclient.c xfree86-driver-synaptics-0.14.3-patch/synclient.c
--- xfree86-driver-synaptics-0.14.3/synclient.c	2005-07-09 15:09:40.000000000 -0700
+++ xfree86-driver-synaptics-0.14.3-patch/synclient.c	2005-11-05 20:32:42.000000000 -0800
@@ -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 }
 };
 

Reply via email to