[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#628959: marked as done (Include patch for rotate axes of touchpad)



Your message dated Sun, 24 Jan 2016 14:33:38 +0100
with message-id <20160124133338.GA25980@betterave.cristau.org>
and subject line Re: Bug#586251: xserver-xorg-input-synaptics: cannot swap axes
has caused the Debian Bug report #586251,
regarding Include patch for rotate axes of touchpad
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
586251: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586251
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: xserver-xorg-input-synaptics
Version: 1.2.2-2



When the screen is rotated with "xrandr" the axes of the touchdpad must be
rotated also to allow natural control of the mouse pointer.

For most pointer devices this can be done with the "xinput" tool, but for
the synaptic touchpad this is not possible.

There is a patch to this drivers that allow this. The homepage of the patch
is the following: http://cc.oulu.fi/~rantalai/synaptics/

I have ported it to the package xserver-xorg-input-synaptics (1.2.2-2) of
Debian Squeeze and I have extensively tested it, so I can say it works
perfectly.

I am attaching the patch for xserver-xorg-input-synaptics=1.2.2-2

Simply copy the patch to debian/patches and include it on the series file.

It should work smoothly.

The patch adds a new option to the command line tool "synclient" that allow
swapping the axes of the touchpad.

Typical use would be:

xrandr --orientation normal   && synclient Orientation=0
xrandr --orientation left     && synclient Orientation=1
xrandr --orientation inverted && synclient Orientation=2
xrandr --orientation right    && synclient Orientation=3
>From c29444b0fe810cbc1810cf22c64a7ca1e899997a Mon Sep 17 00:00:00 2001
From: Carlos Alberto Lopez Perez <clopez@igalia.com>
Date: Wed, 1 Jun 2011 17:13:16 +0200
Subject: [PATCH] Enable orientation rotation for Debian xserver-xorg-input-synaptics (1.2.2-2)

  * Use as debian/patches/04-enable-rotation.patch
  * Based on: http://cc.oulu.fi/~rantalai/synaptics/
---
 include/synaptics-properties.h |    3 +++
 src/eventcomm.c                |   22 ++++++++++++++++++++--
 src/properties.c               |   11 ++++++++++-
 src/synaptics.c                |    1 +
 src/synapticsstr.h             |    1 +
 tools/synclient.c              |    1 +
 6 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/include/synaptics-properties.h b/include/synaptics-properties.h
index cf330d8..0b2a1ea 100644
--- a/include/synaptics-properties.h
+++ b/include/synaptics-properties.h
@@ -142,6 +142,9 @@
 /* 8 bit (BOOL) */
 #define SYNAPTICS_PROP_GRAB "Synaptics Grab Event Device"
 
+/* 32 bit */
+#define SYNAPTICS_ORIENTATION "Synaptics Orientation"
+
 /* 8 bit (BOOL), 1 value, tap-and-drag */
 #define SYNAPTICS_PROP_GESTURES "Synaptics Gestures"
 
diff --git a/src/eventcomm.c b/src/eventcomm.c
index d8138d4..df9b2c6 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -379,10 +379,28 @@ EventReadHwState(LocalDevicePtr local,
 	case EV_ABS:
 	    switch (ev.code) {
 	    case ABS_X:
-		hw->x = ev.value;
+		if (para->orientation==0)
+			hw->x = ev.value;
+		else if (para->orientation==2)
+			hw->x = priv->maxx + priv->minx - ev.value;
+		else if (para->orientation==3)
+			hw->y = (priv->maxx - ev.value) * (priv->maxy - priv->miny) / (priv->maxx - priv->minx) + priv->miny;
+		else if (para->orientation==1)
+			hw->y = (ev.value - priv->minx) * (priv->maxy - priv->miny) / (priv->maxx - priv->minx) + priv->miny;
+		else
+			hw->x = ev.value;
 		break;
 	    case ABS_Y:
-		hw->y = ev.value;
+		if (para->orientation==0)
+			hw->y = ev.value;
+		else if (para->orientation==2)
+			hw->y = priv->maxy + priv->miny - ev.value;
+		else if (para->orientation==3)
+			hw->x = (ev.value - priv->miny) * (priv->maxx - priv->minx) / (priv->maxy - priv->miny) + priv->minx;
+		else if (para->orientation==1)
+			hw->x = (priv->maxy - ev.value) * (priv->maxx - priv->minx) / (priv->maxy - priv->miny) + priv->minx;
+		else
+			hw->y = ev.value;
 		break;
 	    case ABS_PRESSURE:
 		hw->z = ev.value;
diff --git a/src/properties.c b/src/properties.c
index 4366034..ffa866a 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -47,6 +47,7 @@ static Atom float_type;
 
 Atom prop_edges                 = 0;
 Atom prop_finger                = 0;
+Atom prop_orientation           = 0;
 Atom prop_tap_time              = 0;
 Atom prop_tap_move              = 0;
 Atom prop_tap_durations         = 0;
@@ -251,6 +252,8 @@ InitDeviceProperties(LocalDevicePtr local)
     fvalues[0] = para->press_motion_min_factor;
     fvalues[1] = para->press_motion_max_factor;
 
+    prop_orientation = InitAtom(local->dev, SYNAPTICS_ORIENTATION, 32, 1, &para->orientation);
+
     prop_pressuremotion_factor = InitFloatAtom(local->dev, SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 2, fvalues);
 
     prop_grab = InitAtom(local->dev, SYNAPTICS_PROP_GRAB, 8, 1, &para->grab_event_device);
@@ -293,7 +296,13 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
         para = &tmp;
     }
 
-    if (property == prop_edges)
+    if (property == prop_orientation)
+    {
+        if (prop->size != 1 || prop->format != 32 || prop->type != XA_INTEGER)
+            return BadMatch;
+        para->orientation = *(INT32*)prop->data;
+    }
+    else if (property == prop_edges)
     {
         INT32 *edges;
         if (prop->size != 4 || prop->format != 32 || prop->type != XA_INTEGER)
diff --git a/src/synaptics.c b/src/synaptics.c
index 9f9c1ec..f33e7c9 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -462,6 +462,7 @@ static void set_default_parameters(LocalDevicePtr local)
     }
 
     /* set the parameters */
+    pars->orientation = xf86SetIntOption(opts, "Orientation", 0);
     pars->left_edge = xf86SetIntOption(opts, "LeftEdge", l);
     pars->right_edge = xf86SetIntOption(opts, "RightEdge", r);
     pars->top_edge = xf86SetIntOption(opts, "TopEdge", t);
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 2986173..a6e0ab6 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -89,6 +89,7 @@ enum TouchpadModel {
 typedef struct _SynapticsParameters
 {
     /* Parameter data */
+    int orientation;
     int left_edge, right_edge, top_edge, bottom_edge; /* edge coordinates absolute */
     int finger_low, finger_high, finger_press;	      /* finger detection values in Z-values */
     int tap_time;
diff --git a/tools/synclient.c b/tools/synclient.c
index 032b129..af81f38 100644
--- a/tools/synclient.c
+++ b/tools/synclient.c
@@ -75,6 +75,7 @@ struct Parameter {
 
 static struct Parameter params[] = {
     {"LeftEdge",              PT_INT,    0, 10000, SYNAPTICS_PROP_EDGES,	32,	0},
+    {"Orientation",           PT_INT,    0, 3,     SYNAPTICS_ORIENTATION,	32,	0},
     {"RightEdge",             PT_INT,    0, 10000, SYNAPTICS_PROP_EDGES,	32,	1},
     {"TopEdge",               PT_INT,    0, 10000, SYNAPTICS_PROP_EDGES,	32,	2},
     {"BottomEdge",            PT_INT,    0, 10000, SYNAPTICS_PROP_EDGES,	32,	3},
-- 
1.7.1


--- End Message ---
--- Begin Message ---
On Thu, Jun 17, 2010 at 18:56:14 +0200, Hramrach wrote:

> Package: xserver-xorg-input-synaptics
> Version: 1.2.2-2
> Severity: normal
> 
> 
> I don't see a way to swap axes.
> 
As I understand it this was fixed years ago.

Cheers,
Julien

--- End Message ---

Reply to: