Hi,

Excuse me for the delay, but I had many other things to do. So I just
had to wait until I had some time to spend on synaptics. So here are
the modified patches.


Le Thu 13/11/2008 à 12:09 Peter Hutterer à écrit:
> Then send these patches to the list (e.g. with git-send-email).
> Reason being is that it's easier to quote and point out things to
> change.

Well, I send them manually, and I used mercurial queues, I hope you'll
forgive me :) I'm more used to them, that's all. Even if git seems very
similar, it's still a bit different.



> > From 3a4cb5a4e3b2856d3aba4f9abfb9732b555494bf Mon Sep 17 00:00:00
> > 2001 From: Mildred Ki'Lya <mildred593(at)online.fr>
> > Date: Tue, 11 Nov 2008 13:02:36 +0100
> > Subject: [PATCH] Added Orientation option
> 
> > Changed bits of code all around to handle that properly. Especially
> > in the function ComputeDeltas() and HandleScrolling(). Those two
> > functions convert (using helper functions that I've added) the
> > hw->x and hw->y coordinates to oriented_x and oriented_y
> > coordinates. The angle used for circular scrolling do not use
> > oriented coordinates as i've taught it was not necessary, but I
> > haven't tested it though (i don't use circular scrolling).
> 
> > Moreover, in the function HandleState(), the variable edge contains
> > how the oriented edge. So the functions that use the edge are
> > automatically oriented. This is useful for HandleTap(). The buttons
> > in the corners of the pads are oriented without effort.
> 
> I like extensive commit messages where appropriate, but these ones
> are a bit noisy. There's a lot of stuff that is obvious through the
> code, so shortening it down to what is not immediately obvious would
> be good. That goes for all three commits.

Well, probably, but in fact, I often find myself reading and reading
the code to find out what it is doing. And if I could just read a
summary of it, it would take me less much time. But I agree that for
someone who knows the code, much of it may be unnecessary.

But, well, with patches, you won't have that kind of problems :)

> > ... man page ...
> 
> ... This option changes the orientation ...
> 
>                         ^^ typo
> 
> Again, please keep it short and to-the point. e.g. the second-to-last
> sentence is superfluous, last one can be shortened (no "You may
> notice").

fixed

> > @@ -1593,6 +1649,9 @@ HandleScrolling(SynapticsPrivate *priv,
> > struct SynapticsHwState *hw, {
> >      SynapticsSHM *para = priv->synpara;
> >      int delay = 1000000000;
> > +    int oriented_x = hw->x, oriented_y = hw->y;
> 
> Just use x, y instead of oriented_x, oriented_y please.

fixed

> >      edge = edge_detection(priv, hw->x, hw->y);
> > +    edge = HandleEdgeOrientation(para->orientation, edge);
> 
> can we merge that into edge_detection so we don't have separate calls?

merged

> Missing from this patch is the code to readjust the valuators if the
> orientation was specified at startup.
> i.e. if option Orientation is set, change the
> xf86InitValuatorAxisStruct around accordingly so the ranges are
> correct. we can't do anything about run-time changes, but at least it
> should be correct for the startup setting.

done

> Also, if the orientation is to be changed at runtime, it should have
> property support. You can provide that as a separate patch if you
> want to.

I don't exactly understand what you mean here. If by property support
you mean the possibility to modify the configuration using the shared
memory, it's already implemented (there would be no point otherwise).
If you mean something else ... well, I don't understand what it is.

> > From 3c16621ca139ea6c4ef121da9a245c5456fe59ec Mon Sep 17 00:00:00
> > 2001 From: Mildred Ki'Lya <mildred593(at)online.fr>
> > Date: Tue, 11 Nov 2008 13:11:58 +0100
> > Subject: [PATCH] Added DontReportSize option
> 
> Replace as ReportSize option, set to TRUE by default.

done

> 
> > +Along with this option, you might be interested to enable the
> > DontReportSize +option. Read its documentation to know why.
> 
> replace with "See also: ReportSize"

done

> > +.
> > +.TP
> > +.BI "Option \*qDontReportSize\*q \*q" boolean \*q
> 
> less verbose please.

is that ok?


.BI "Option \*qReportSize\*q \*q" boolean \*q
When enabled (default behaviour), this option will report the size of the
trackpad to Xorg. The server usually uses this information to modify the speed
of the axis depending on the size of the trackpad. Thus, it can lean to
unreachable pixels (when the speed is increased too much) and can lead to
strange behaviours when the trackpad is oriented (the speed is over-amplified in
a direction). So if you plan to use the orientation feature, you probably want
to disable this (there is no way to change the trackpad size at runtime).


> s/.../This option always specifies the vertical speed, regardless of
> the orientation./
> 
> Just merge it into the VertSpeed section (see below) and adjust the
> description accordingly:

Changed to:

.TP
.BI "Option \*qHorizSpeed\*q \*q" float \*q
Speed scale for the X axis. Modify the speed regardless of the orientation.
.
.TP
.BI "Option \*qVertSpeed\*q \*q" float \*q
Speed scale for the Y axis. Modify the speed regardless of the orientation.


I think this is better, isn't it? I just took inspiration from
TrackstickSpeed. I also moved it just below TrackstickSpeed.


> >         if (priv->moving_state == MS_TRACKSTICK) {
> > -           dx = (hw->x - priv->trackstick_neutral_x);
> > -           dy = (hw->y - priv->trackstick_neutral_y);
> > +           dx = (hw->x - priv->trackstick_neutral_x) *
> > para->horiz_speed;
> > +           dy = (hw->y - priv->trackstick_neutral_y) *
> > para->vert_speed;
> 
> different horiz/vert speed for the trackstick? That doesn't seem like
> a good idea.

Seems like an error, thanks. When i did this, I probably didn't
knew what was the trackstick :/
Fixed

> 
> Now we have 
>     MinSpeed
>     MaxSpeed
>     TrackstickSpeed
>     VertSpeed
>     HorizSpeed
> 
> Min/Max is applied on top of Vert/Horiz, which is confusing at best.
> I'd be good to re-think the in-driver speed settings and see if we
> can simplify them a bit.

Well, MinSpeed and MaxSpeed are used to change the speed according to
the finger pressure (or do I miss something?). HorizSpeed, VertSpeed
and TrackstickSpeed are used to globally change the speed. I don't see
any problem in all that.

> 
> 
> > From 90c87f36f3a6940d39759588e48c6104b12fb6f2 Mon Sep 17 00:00:00
> > 2001 From: Mildred Ki'Lya <mildred593(at)online.fr>
> > Date: Tue, 11 Nov 2008 13:20:38 +0100
> > Subject: [PATCH] Unimportant changes
> 
> Please split into two patches, not titled "Unimportant changes"
> 

Just split it.


Thanks for your review, and I hope I didn't made you wait too long.

:)

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 -r 9eb9da460bd8 include/synaptics.h
--- a/include/synaptics.h	Sun Nov 23 11:17:50 2008 +0100
+++ b/include/synaptics.h	Sun Nov 23 11:48:02 2008 +0100
@@ -133,6 +133,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? */
+    int orientation;			    /* orientation of the trackpad */
 } SynapticsSHM;
 
 /*
diff -r 9eb9da460bd8 man/synaptics.man
--- a/man/synaptics.man	Sun Nov 23 11:17:50 2008 +0100
+++ b/man/synaptics.man	Sun Nov 23 11:48:02 2008 +0100
@@ -384,6 +384,14 @@
 .
 This can be achieved by switching to a text console and then switching
 back to X.
+.TP
+.BI "Option \*qOrientation\*q \*q" integer \*q
+This option changes the orientation of the trackpad and can
+takes values from 0 to 3. The default value 0 implies a normal orientation,
+other values can be used to have respectively an orientation set to the
+left, an inverted orientation, and an orientation set to the right.
+This may be useful in combination with the orientation option of the XRandR
+extension. The values used are the same to the values used by XRandR \-o option.
 .
 .
 .LP
diff -r 9eb9da460bd8 src/synaptics.c
--- a/src/synaptics.c	Sun Nov 23 11:17:50 2008 +0100
+++ b/src/synaptics.c	Sun Nov 23 11:48:02 2008 +0100
@@ -123,6 +123,7 @@
 static Bool DeviceClose(DeviceIntPtr);
 static Bool QueryHardware(LocalDevicePtr);
 static void ReadDevDimensions(LocalDevicePtr);
+static void HandleOrientation_int(int orientation, int *dx, int *dy);
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
 void InitDeviceProperties(LocalDevicePtr local);
@@ -475,6 +476,7 @@
     pars->single_tap_timeout = xf86SetIntOption(opts, "SingleTapTimeout", 180);
     pars->press_motion_min_z = xf86SetIntOption(opts, "PressureMotionMinZ", pressureMotionMinZ);
     pars->press_motion_max_z = xf86SetIntOption(opts, "PressureMotionMaxZ", pressureMotionMaxZ);
+    pars->orientation        = xf86SetIntOption(opts, "Orientation", 0);
 
     pars->min_speed = synSetFloatOption(opts, "MinSpeed", 0.4);
     pars->max_speed = synSetFloatOption(opts, "MaxSpeed", 0.7);
@@ -751,6 +753,8 @@
     SynapticsPrivate *priv = (SynapticsPrivate *) (local->private);
     unsigned char map[SYN_MAX_BUTTONS + 1];
     int i;
+    int valuator_minx = 0, valuator_miny = 0;
+    int valuator_maxx = -1, valuator_maxy = -1;
 
     DBG(3, ErrorF("Synaptics DeviceInit called\n"));
 
@@ -773,17 +777,34 @@
 			    GetMotionHistorySize(), 2
 #endif
 			    );
+
+
+    /* Handle orientation and size of trackpad */
+
+    if(priv->synpara->orientation) {
+	if(priv->minx < priv->maxx && priv->miny < priv->maxy){
+	    valuator_minx = priv->minx;
+	    valuator_miny = priv->miny;
+	    valuator_maxx = priv->maxx;
+	    valuator_maxy = priv->maxy;
+	    HandleOrientation_int(priv->synpara->orientation,
+				  &valuator_minx, &valuator_miny);
+	    HandleOrientation_int(priv->synpara->orientation,
+				  &valuator_maxx, &valuator_maxy);
+	}
+    } else if(priv->minx < priv->maxx) {
+	valuator_minx = priv->minx;
+	valuator_maxx = priv->maxx;
+    } else if(priv->miny < priv->maxy) {
+	valuator_miny = priv->miny;
+	valuator_maxy = priv->maxy;
+    }
+
     /* X valuator */
-    if (priv->minx < priv->maxx)
-	xf86InitValuatorAxisStruct(dev, 0, priv->minx, priv->maxx, 1, 0, 1);
-    else
-	xf86InitValuatorAxisStruct(dev, 0, 0, -1, 1, 0, 1);
+    xf86InitValuatorAxisStruct(dev, 0, valuator_minx, valuator_maxx, 1, 0, 1);
     xf86InitValuatorDefaults(dev, 0);
     /* Y valuator */
-    if (priv->miny < priv->maxy)
-	xf86InitValuatorAxisStruct(dev, 1, priv->miny, priv->maxy, 1, 0, 1);
-    else
-	xf86InitValuatorAxisStruct(dev, 1, 0, -1, 1, 0, 1);
+    xf86InitValuatorAxisStruct(dev, 1, valuator_miny, valuator_maxy, 1, 0, 1);
     xf86InitValuatorDefaults(dev, 1);
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0
@@ -882,7 +903,7 @@
 static edge_type
 edge_detection(SynapticsPrivate *priv, int x, int y)
 {
-    edge_type edge = 0;
+    edge_type edge = 0, oriented_edge = 0;
 
     if (priv->synpara->circular_pad)
 	return circular_edge_detection(priv, x, y);
@@ -897,7 +918,43 @@
     else if (y > priv->synpara->bottom_edge)
 	edge |= BOTTOM_EDGE;
 
-    return edge;
+    /* orient edge -> oriented_edge */
+
+    if(edge & BOTTOM_EDGE) {
+      switch(priv->synpara->orientation) {
+	  default:
+	  case 0:  oriented_edge |= BOTTOM_EDGE;	break;
+	  case 1:  oriented_edge |= LEFT_EDGE;	break;
+	  case 2:  oriented_edge |= TOP_EDGE;	break;
+	  case 3:  oriented_edge |= RIGHT_EDGE;	break;
+      }
+    } else if(edge & TOP_EDGE) {
+      switch(priv->synpara->orientation) {
+	  default:
+	  case 0:  oriented_edge |= TOP_EDGE;	break;
+	  case 1:  oriented_edge |= RIGHT_EDGE;	break;
+	  case 2:  oriented_edge |= BOTTOM_EDGE;	break;
+	  case 3:  oriented_edge |= LEFT_EDGE;	break;
+      }
+    }
+    if(edge & LEFT_EDGE) {
+      switch(priv->synpara->orientation) {
+	  default:
+	  case 0:  oriented_edge |= LEFT_EDGE;	break;
+	  case 1:  oriented_edge |= TOP_EDGE;	break;
+	  case 2:  oriented_edge |= RIGHT_EDGE;	break;
+	  case 3:  oriented_edge |= BOTTOM_EDGE;	break;
+      }
+    } else if(edge & RIGHT_EDGE) {
+      switch(priv->synpara->orientation) {
+	  default:
+	  case 0:  oriented_edge |= RIGHT_EDGE;	break;
+	  case 1:  oriented_edge |= BOTTOM_EDGE;	break;
+	  case 2:  oriented_edge |= LEFT_EDGE;	break;
+	  case 3:  oriented_edge |= TOP_EDGE;	break;
+      }
+    }
+    return oriented_edge;
 }
 
 static CARD32
@@ -1397,6 +1454,54 @@
     return x0 * 0.3 + x1 * 0.1 - x2 * 0.1 - x3 * 0.3;
 }
 
+static void
+HandleOrientation_double(int orientation, double *dx, double *dy) {
+    double tmp;
+    switch(orientation) {
+	default:
+	case 0:
+	    break;
+	case 1: /* left */
+	    tmp =  *dx;
+	    *dx = -*dy;
+	    *dy =  tmp;
+	    break;
+	case 2: /* inverted */
+	    *dx = -*dx;
+	    *dy = -*dy;
+	    break;
+	case 3: /* right */
+	    tmp =  *dx;
+	    *dx =  *dy;
+	    *dy = -tmp;
+	    break;
+    }
+}
+
+static void
+HandleOrientation_int(int orientation, int *dx, int *dy) {
+    int tmp;
+    switch(orientation) {
+	default:
+	case 0:
+	    break;
+	case 1: /* left */
+	    tmp =  *dx;
+	    *dx = -*dy;
+	    *dy =  tmp;
+	    break;
+	case 2: /* inverted */
+	    *dx = -*dx;
+	    *dy = -*dy;
+	    break;
+	case 3: /* right */
+	    tmp =  *dx;
+	    *dx =  *dy;
+	    *dy = -tmp;
+	    break;
+    }
+}
+
 static int
 ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 	      edge_type edge, int *dxP, int *dyP)
@@ -1442,11 +1547,15 @@
 		dx = (hw->x - priv->trackstick_neutral_x);
 		dy = (hw->y - priv->trackstick_neutral_y);
 
+		HandleOrientation_double(para->orientation, &dx, &dy);
+
 		dx = dx * dtime * para->trackstick_speed;
 		dy = dy * dtime * para->trackstick_speed;
 	    } else if (moving_state == MS_TOUCHPAD_RELATIVE) {
 		dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x);
 		dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y);
+
+		HandleOrientation_double(para->orientation, &dx, &dy);
 
 		if ((priv->tap_state == TS_DRAG) || para->edge_motion_use_always) {
 		    int minZ = para->edge_motion_min_z;
@@ -1481,6 +1590,9 @@
 			relative_coords(priv, hw->x, hw->y, &relX, &relY);
 			x_edge_speed = (int)(edge_speed * relX);
 			y_edge_speed = (int)(edge_speed * relY);
+
+			HandleOrientation_int(para->orientation,
+			    &x_edge_speed, &y_edge_speed);
 		    }
 		}
 	    }
@@ -1544,7 +1656,7 @@
 };
 
 static void
-start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw, edge_type edge,
+start_coasting(SynapticsPrivate *priv, int x, int y, edge_type edge,
 	       Bool vertical)
 {
     SynapticsSHM *para = priv->synpara;
@@ -1561,7 +1673,7 @@
 		double scrolls_per_sec = dy / pkt_time / sdelta;
 		if (fabs(scrolls_per_sec) >= para->coasting_speed) {
 		    priv->autoscroll_yspd = scrolls_per_sec;
-		    priv->autoscroll_y = (hw->y - priv->scroll_y) / (double)sdelta;
+		    priv->autoscroll_y = (y - priv->scroll_y) / (double)sdelta;
 		}
 	    }
 	} else {
@@ -1571,7 +1683,7 @@
 		double scrolls_per_sec = dx / pkt_time / sdelta;
 		if (fabs(scrolls_per_sec) >= para->coasting_speed) {
 		    priv->autoscroll_xspd = scrolls_per_sec;
-		    priv->autoscroll_x = (hw->x - priv->scroll_x) / (double)sdelta;
+		    priv->autoscroll_x = (x - priv->scroll_x) / (double)sdelta;
 		}
 	    }
 	}
@@ -1593,6 +1705,9 @@
 {
     SynapticsSHM *para = priv->synpara;
     int delay = 1000000000;
+    int x = hw->x, y = hw->y;
+
+    HandleOrientation_int(para->orientation, &x, &y);
 
     sd->left = sd->right = sd->up = sd->down = 0;
 
@@ -1633,14 +1748,14 @@
 		    (para->scroll_twofinger_vert) && (para->scroll_dist_vert != 0)) {
 		    priv->vert_scroll_twofinger_on = TRUE;
 		    priv->vert_scroll_edge_on = FALSE;
-		    priv->scroll_y = hw->y;
+		    priv->scroll_y = y;
 		    DBG(7, ErrorF("vert two-finger scroll detected\n"));
 		}
 		if (!priv->horiz_scroll_twofinger_on &&
 		    (para->scroll_twofinger_horiz) && (para->scroll_dist_horiz != 0)) {
 		    priv->horiz_scroll_twofinger_on = TRUE;
 		    priv->horiz_scroll_edge_on = FALSE;
-		    priv->scroll_x = hw->x;
+		    priv->scroll_x = x;
 		    DBG(7, ErrorF("horiz two-finger scroll detected\n"));
 		}
 	    }
@@ -1650,13 +1765,13 @@
 		if ((para->scroll_edge_vert) && (para->scroll_dist_vert != 0) &&
 		    (edge & RIGHT_EDGE)) {
 		    priv->vert_scroll_edge_on = TRUE;
-		    priv->scroll_y = hw->y;
+		    priv->scroll_y = y;
 		    DBG(7, ErrorF("vert edge scroll detected on right edge\n"));
 		}
 		if ((para->scroll_edge_horiz) && (para->scroll_dist_horiz != 0) &&
 		    (edge & BOTTOM_EDGE)) {
 		    priv->horiz_scroll_edge_on = TRUE;
-		    priv->scroll_x = hw->x;
+		    priv->scroll_x = x;
 		    DBG(7, ErrorF("horiz edge scroll detected on bottom edge\n"));
 		}
 	    }
@@ -1706,7 +1821,7 @@
 	if ((oldv || oldh) && !para->scroll_edge_corner &&
 	    !(priv->circ_scroll_on || priv->vert_scroll_edge_on ||
 	      priv->horiz_scroll_edge_on)) {
-	    start_coasting(priv, hw, edge, oldv);
+	    start_coasting(priv, x, y, edge, oldv);
 	}
     }
 
@@ -1721,7 +1836,7 @@
 		 * we're in the corner, but we were moving so slowly when we
 		 * got here that we didn't actually start coasting. */
 		DBG(7, ErrorF("corner edge scroll on\n"));
-		start_coasting(priv, hw, edge, TRUE);
+		start_coasting(priv, x, y, edge, TRUE);
 	    }
 	} else if (para->circular_scrolling) {
 	    priv->vert_scroll_edge_on = FALSE;
@@ -1740,7 +1855,7 @@
 		 * we're in the corner, but we were moving so slowly when we
 		 * got here that we didn't actually start coasting. */
 		DBG(7, ErrorF("corner edge scroll on\n"));
-		start_coasting(priv, hw, edge, FALSE);
+		start_coasting(priv, x, y, edge, FALSE);
 	    }
 	} else if (para->circular_scrolling) {
 	    priv->horiz_scroll_edge_on = FALSE;
@@ -1761,11 +1876,11 @@
 	/* + = down, - = up */
 	int delta = para->scroll_dist_vert;
 	if (delta > 0) {
-	    while (hw->y - priv->scroll_y > delta) {
+	    while (y - priv->scroll_y > delta) {
 		sd->down++;
 		priv->scroll_y += delta;
 	    }
-	    while (hw->y - priv->scroll_y < -delta) {
+	    while (y - priv->scroll_y < -delta) {
 		sd->up++;
 		priv->scroll_y -= delta;
 	    }
@@ -1775,11 +1890,11 @@
 	/* + = right, - = left */
 	int delta = para->scroll_dist_horiz;
 	if (delta > 0) {
-	    while (hw->x - priv->scroll_x > delta) {
+	    while (x - priv->scroll_x > delta) {
 		sd->right++;
 		priv->scroll_x += delta;
 	    }
-	    while (hw->x - priv->scroll_x < -delta) {
+	    while (x - priv->scroll_x < -delta) {
 		sd->left++;
 		priv->scroll_x -= delta;
 	    }
diff -r 9eb9da460bd8 tools/synclient.c
--- a/tools/synclient.c	Sun Nov 23 11:17:50 2008 +0100
+++ b/tools/synclient.c	Sun Nov 23 11:48:02 2008 +0100
@@ -123,6 +123,7 @@
     DEFINE_PAR("PressureMotionMinFactor", press_motion_min_factor, PT_DOUBLE, 0, 10.0),
     DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 0, 10.0),
     DEFINE_PAR("GrabEventDevice",      grab_event_device,       PT_BOOL,   0, 1),
+    DEFINE_PAR("Orientation",          orientation,             PT_INT,    0, 3),
     { NULL, 0, 0, 0, 0 }
 };
 
diff -r 2a2d09e8b175 include/synaptics.h
--- a/include/synaptics.h	Sun Nov 23 11:48:02 2008 +0100
+++ b/include/synaptics.h	Sun Nov 23 12:04:14 2008 +0100
@@ -134,6 +134,7 @@
     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? */
     int orientation;			    /* orientation of the trackpad */
+    Bool report_size;			    /* Report the size of the trackpad to Xorg */
 } SynapticsSHM;
 
 /*
diff -r 2a2d09e8b175 man/synaptics.man
--- a/man/synaptics.man	Sun Nov 23 11:48:02 2008 +0100
+++ b/man/synaptics.man	Sun Nov 23 12:04:14 2008 +0100
@@ -393,6 +393,18 @@
 This may be useful in combination with the orientation option of the XRandR
 extension. The values used are the same to the values used by XRandR \-o option.
 .
+See also: ReportSize
+.
+.TP
+.BI "Option \*qReportSize\*q \*q" boolean \*q
+When enabled (default behaviour), this option will report the size of the
+trackpad to Xorg. The server usually uses this information to modify the speed
+of the axis depending on the size of the trackpad. Thus, it can lean to
+unreachable pixels (when the speed is increased too much) and can lead to
+strange behaviours when the trackpad is oriented (the speed is over-amplified in
+a direction). So if you plan to use the orientation feature, you probably want
+to disable this (there is no way to change the trackpad size at runtime).
+.
 .
 .LP
 The LeftEdge, RightEdge, TopEdge and BottomEdge parameters are used to
diff -r 2a2d09e8b175 src/synaptics.c
--- a/src/synaptics.c	Sun Nov 23 11:48:02 2008 +0100
+++ b/src/synaptics.c	Sun Nov 23 12:04:14 2008 +0100
@@ -477,6 +477,7 @@
     pars->press_motion_min_z = xf86SetIntOption(opts, "PressureMotionMinZ", pressureMotionMinZ);
     pars->press_motion_max_z = xf86SetIntOption(opts, "PressureMotionMaxZ", pressureMotionMaxZ);
     pars->orientation        = xf86SetIntOption(opts, "Orientation", 0);
+    pars->report_size   = xf86SetBoolOption(opts, "ReportSize", TRUE);
 
     pars->min_speed = synSetFloatOption(opts, "MinSpeed", 0.4);
     pars->max_speed = synSetFloatOption(opts, "MaxSpeed", 0.7);
@@ -781,23 +782,25 @@
 
     /* Handle orientation and size of trackpad */
 
-    if(priv->synpara->orientation) {
-	if(priv->minx < priv->maxx && priv->miny < priv->maxy){
+    if(priv->synpara->report_size == TRUE) {
+	if(priv->synpara->orientation) {
+	    if(priv->minx < priv->maxx && priv->miny < priv->maxy){
+		valuator_minx = priv->minx;
+		valuator_miny = priv->miny;
+		valuator_maxx = priv->maxx;
+		valuator_maxy = priv->maxy;
+		HandleOrientation_int(priv->synpara->orientation,
+				      &valuator_minx, &valuator_miny);
+		HandleOrientation_int(priv->synpara->orientation,
+				      &valuator_maxx, &valuator_maxy);
+	    }
+	} else if(priv->minx < priv->maxx) {
 	    valuator_minx = priv->minx;
+	    valuator_maxx = priv->maxx;
+	} else if(priv->miny < priv->maxy) {
 	    valuator_miny = priv->miny;
-	    valuator_maxx = priv->maxx;
 	    valuator_maxy = priv->maxy;
-	    HandleOrientation_int(priv->synpara->orientation,
-				  &valuator_minx, &valuator_miny);
-	    HandleOrientation_int(priv->synpara->orientation,
-				  &valuator_maxx, &valuator_maxy);
 	}
-    } else if(priv->minx < priv->maxx) {
-	valuator_minx = priv->minx;
-	valuator_maxx = priv->maxx;
-    } else if(priv->miny < priv->maxy) {
-	valuator_miny = priv->miny;
-	valuator_maxy = priv->maxy;
     }
 
     /* X valuator */
diff -r 2a2d09e8b175 tools/synclient.c
--- a/tools/synclient.c	Sun Nov 23 11:48:02 2008 +0100
+++ b/tools/synclient.c	Sun Nov 23 12:04:14 2008 +0100
@@ -124,6 +124,7 @@
     DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 0, 10.0),
     DEFINE_PAR("GrabEventDevice",      grab_event_device,       PT_BOOL,   0, 1),
     DEFINE_PAR("Orientation",          orientation,             PT_INT,    0, 3),
+    DEFINE_PAR("DontReportSize",       dont_report_size,        PT_BOOL,   0, 1),
     { NULL, 0, 0, 0, 0 }
 };
 
diff -r 7a734f5e122b include/synaptics.h
--- a/include/synaptics.h	Sun Nov 23 12:04:14 2008 +0100
+++ b/include/synaptics.h	Sun Nov 23 12:21:26 2008 +0100
@@ -135,6 +135,8 @@
     Bool grab_event_device;		    /* grab event device for exclusive use? */
     int orientation;			    /* orientation of the trackpad */
     Bool report_size;			    /* Report the size of the trackpad to Xorg */
+    double horiz_speed;			    /* Horizontal speed for mouse movements */
+    double vert_speed;			    /* Vertical speed for mouse movements */
 } SynapticsSHM;
 
 /*
diff -r 7a734f5e122b man/synaptics.man
--- a/man/synaptics.man	Sun Nov 23 12:04:14 2008 +0100
+++ b/man/synaptics.man	Sun Nov 23 12:21:26 2008 +0100
@@ -196,6 +196,12 @@
 .TP
 .BI "Option \*qTrackstickSpeed\fR (\*q \*q" float \*q)
 Speed scale when in trackstick emulation mode.
+.TP
+.BI "Option \*qHorizSpeed\*q \*q" float \*q
+Speed scale for the X axis. Modify the speed regardless of the orientation.
+.TP
+.BI "Option \*qVertSpeed\*q \*q" float \*q
+Speed scale for the Y axis. Modify the speed regardless of the orientation.
 .TP
 .BI "Option \*qPressureMotionMinZ\*q \*q" integer \*q
 Finger pressure at which minimum pressure motion factor is applied.
diff -r 7a734f5e122b src/synaptics.c
--- a/src/synaptics.c	Sun Nov 23 12:04:14 2008 +0100
+++ b/src/synaptics.c	Sun Nov 23 12:21:26 2008 +0100
@@ -487,6 +487,8 @@
     pars->coasting_speed = synSetFloatOption(opts, "CoastingSpeed", 0.0);
     pars->press_motion_min_factor = synSetFloatOption(opts, "PressureMotionMinFactor", 1.0);
     pars->press_motion_max_factor = synSetFloatOption(opts, "PressureMotionMaxFactor", 1.0);
+    pars->horiz_speed = synSetFloatOption(opts, "HorizSpeed", 1.0);
+    pars->vert_speed = synSetFloatOption(opts, "VertSpeed", 1.0);
     pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE);
 
     /* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
@@ -1555,8 +1557,10 @@
 		dx = dx * dtime * para->trackstick_speed;
 		dy = dy * dtime * para->trackstick_speed;
 	    } else if (moving_state == MS_TOUCHPAD_RELATIVE) {
-		dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x);
-		dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y);
+		dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x)
+		   * para->horiz_speed;
+		dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y)
+		   * para->vert_speed;
 
 		HandleOrientation_double(para->orientation, &dx, &dy);
 
diff -r 7a734f5e122b tools/synclient.c
--- a/tools/synclient.c	Sun Nov 23 12:04:14 2008 +0100
+++ b/tools/synclient.c	Sun Nov 23 12:21:26 2008 +0100
@@ -125,6 +125,8 @@
     DEFINE_PAR("GrabEventDevice",      grab_event_device,       PT_BOOL,   0, 1),
     DEFINE_PAR("Orientation",          orientation,             PT_INT,    0, 3),
     DEFINE_PAR("DontReportSize",       dont_report_size,        PT_BOOL,   0, 1),
+    DEFINE_PAR("HorizSpeed",           horiz_speed,             PT_DOUBLE, 0, 10),
+    DEFINE_PAR("VertSpeed",            vert_speed,              PT_DOUBLE, 0, 10),
     { NULL, 0, 0, 0, 0 }
 };
 
diff -r 6d5c4d51b745 src/synaptics.c
--- a/src/synaptics.c	Sun Nov 23 12:21:26 2008 +0100
+++ b/src/synaptics.c	Sun Nov 23 12:23:41 2008 +0100
@@ -1578,7 +1578,7 @@
 		    } else {
 			edge_speed = minSpd + (hw->z - minZ) * (maxSpd - minSpd) / (maxZ - minZ);
 		    }
-		    if (!priv->synpara->circular_pad) {
+		    if (!para->circular_pad) {
 			/* on rectangular pad */
 			if (edge & RIGHT_EDGE) {
 			    x_edge_speed = edge_speed;
diff -r f75333dc7260 src/synaptics.c
--- a/src/synaptics.c	Sun Nov 23 12:23:41 2008 +0100
+++ b/src/synaptics.c	Sun Nov 23 12:25:11 2008 +0100
@@ -2047,13 +2047,13 @@
 	hw->right |= hw->guest_right;
     }
 
-    /* 3rd button emulation */
-    hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
-
     /* Fingers emulate other buttons */
     if(hw->left && hw->numFingers >= 1){
         HandleClickWithFingers(para, hw);
     }
+
+    /* 3rd button emulation */
+    hw->middle |= HandleMidButtonEmulation(priv, hw, &delay);
 
     /* Two finger emulation */
     if (hw->z >= para->emulate_twofinger_z && hw->numFingers == 1) {
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to