rpms/xorg-x11-drv-synaptics/devel xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch, NONE, 1.1 xorg-x11-drv-synaptics.spec, 1.3, 1.4

Peter Hutterer whot at fedoraproject.org
Tue Sep 2 10:59:42 UTC 2008


Author: whot

Update of /cvs/pkgs/rpms/xorg-x11-drv-synaptics/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20442

Modified Files:
	xorg-x11-drv-synaptics.spec 
Added Files:
	xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch 
Log Message:
* Tue Sep 2 2008 Peter Hutterer <peter.hutterer at redhat.com> 0.15.0-4
- xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch: force a click if
  middle button emulation times out during ReadInput cycle. RH #233717.




xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch:

--- NEW FILE xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch ---
>From 8869d14f6169a8e3d94d43c5a0407e8621d9e431 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at redhat.com>
Date: Tue, 2 Sep 2008 19:55:19 +0930
Subject: [PATCH] Don't lose button up event if timeout is cancelled in the same ReadInput cycle

On a left/right button press, middle button emulation springs into action and
changes the reported hw state. It then returns a delay that is supposed to set
a timer. No button event is posted to the server, the timer ensures that it'll
be posted later.

If however - in the same cycle - the button up is reported, but with a
hardware time > middle emulation timeout, the middle button emulation is
canceled. The hw state is reset to button down, and processing continues,
reporting the button down event.
Since this is in the same cycle, the new delay overrides the previous one and
the timer is never set.

Introduce a new state into MB emulation that forces the click event if the
above situation occurs.

Red Hat Bug 233717 <http://bugzilla.redhat.com/show_bug.cgi?id=233717>
---
 src/synaptics.c |   28 ++++++++++++++++++++++++++--
 src/synaptics.h |    4 +++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 50ebec6..d4b6e4e 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -865,6 +865,8 @@ HandleMidButtonEmulation(SynapticsPrivate *priv, struct SynapticsHwState *hw, in
 
     while (!done) {
 	switch (priv->mid_emu_state) {
+	case MBE_LEFT_CLICK:
+	case MBE_RIGHT_CLICK:
 	case MBE_OFF:
 	    priv->button_delay_millis = hw->millis;
 	    if (hw->left) {
@@ -880,7 +882,12 @@ HandleMidButtonEmulation(SynapticsPrivate *priv, struct SynapticsHwState *hw, in
 				 hw->millis);
 	    if (timeleft > 0)
 		*delay = MIN(*delay, timeleft);
-	    if (!hw->left || (timeleft <= 0)) {
+
+            /* timeout, but within the same ReadInput cycle! */
+            if ((timeleft <= 0) && !hw->left) {
+		priv->mid_emu_state = MBE_LEFT_CLICK;
+		done = TRUE;
+            } else if ((!hw->left) || (timeleft <= 0)) {
 		hw->left = TRUE;
 		priv->mid_emu_state = MBE_TIMEOUT;
 		done = TRUE;
@@ -896,7 +903,12 @@ HandleMidButtonEmulation(SynapticsPrivate *priv, struct SynapticsHwState *hw, in
 				 hw->millis);
 	    if (timeleft > 0)
 		*delay = MIN(*delay, timeleft);
-	    if (!hw->right || (timeleft <= 0)) {
+
+	     /* timeout, but within the same ReadInput cycle! */
+            if ((timeleft <= 0) && !hw->right) {
+		priv->mid_emu_state = MBE_RIGHT_CLICK;
+		done = TRUE;
+            } else if (!hw->right || (timeleft <= 0)) {
 		hw->right = TRUE;
 		priv->mid_emu_state = MBE_TIMEOUT;
 		done = TRUE;
@@ -1889,6 +1901,18 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw)
     if (dx || dy)
 	xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy);
 
+    if (priv->mid_emu_state == MBE_LEFT_CLICK)
+    {
+	xf86PostButtonEvent(local->dev, FALSE, 1, 1, 0, 0);
+	xf86PostButtonEvent(local->dev, FALSE, 1, 0, 0, 0);
+	priv->mid_emu_state = MBE_OFF;
+    } else if (priv->mid_emu_state == MBE_RIGHT_CLICK)
+    {
+	xf86PostButtonEvent(local->dev, FALSE, 3, 1, 0, 0);
+	xf86PostButtonEvent(local->dev, FALSE, 3, 0, 0, 0);
+	priv->mid_emu_state = MBE_OFF;
+    }
+
     change = buttons ^ priv->lastButtons;
     while (change) {
 	id = ffs(change); /* number of first set bit 1..32 is returned */
diff --git a/src/synaptics.h b/src/synaptics.h
index a24f8b6..afd093a 100644
--- a/src/synaptics.h
+++ b/src/synaptics.h
@@ -187,7 +187,9 @@ enum MidButtonEmulation {
     MBE_RIGHT,			/* Right button pressed, waiting for left button or timeout */
     MBE_MID,			/* Left and right buttons pressed, waiting for both buttons
 				   to be released */
-    MBE_TIMEOUT			/* Waiting for both buttons to be released. */
+    MBE_TIMEOUT,		/* Waiting for both buttons to be released. */
+    MBE_LEFT_CLICK,		/* Emulate left button click. */
+    MBE_RIGHT_CLICK,		/* Emulate right button click. */
 };
 
 /* See docs/tapndrag.dia for a state machine diagram */
-- 
1.5.6.4



Index: xorg-x11-drv-synaptics.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-synaptics/devel/xorg-x11-drv-synaptics.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- xorg-x11-drv-synaptics.spec	28 Aug 2008 13:26:26 -0000	1.3
+++ xorg-x11-drv-synaptics.spec	2 Sep 2008 10:59:10 -0000	1.4
@@ -5,7 +5,7 @@
 Name:           xorg-x11-drv-synaptics
 Summary:        Xorg X11 synaptics input driver
 Version:        0.15.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 URL:            http://www.x.org
 License:        MIT
 Group:          User Interface/X Hardware Support
@@ -15,6 +15,7 @@
 Source1:        10-synaptics.fdi
 Patch1:		 xf86-input-synaptics-0.15.0-tap.patch
 Patch2:		 xf86-input-synaptics-0.15.0-edges.patch
+Patch3:		 xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch
 ExcludeArch:    s390 s390x
 
 BuildRequires:  libtool pkgconfig
@@ -61,6 +62,7 @@
 %setup -q -n %{tarball}-%{version}
 %patch1 -p1 -b .tap
 %patch2 -p1 -b .edges
+%patch3 -p1 -b .dont-lose-buttonup
 
 %build
 autoreconf -v --install --force || exit 1
@@ -94,6 +96,10 @@
 %doc COPYING README
 
 %changelog
+* Tue Sep 2 2008 Peter Hutterer <peter.hutterer at redhat.com> 0.15.0-4
+- xf86-input-synaptics-0.15.0-dont-lose-buttonup.patch: force a click if
+  middle button emulation times out during ReadInput cycle. RH #233717.
+
 * Thu Aug 28 2008 Peter Hutterer <peter.hutterer at redhat.com> 0.15.0-3
 - xf86-input-synaptics-0.15.0-edges.patch: reserve 5% on each side for edge
   detection.




More information about the fedora-extras-commits mailing list