Hi, I made this patch, maybe it will be useful to other users with this
problem. It will enable you to use the pointing stick for scrolling by
holding down the emulated middle button on 2-button hardware, similar to
old Thinkpads which do have a real middle button.

I found a little bit similar issue mentioned on the blog [1] but the
workaround proposed therein is not very good. I have now seen several
laptops with pointing sticks and only two buttons, which make it very
frustrating to use for scrolling and middle-button pasting due to this
evdev design issue.

This modification is not quite as horrible as the change now in
widespread use to get the newer Thinkpads without buttons back into
usable shape [2]

Take care,
Nei


[1] 
http://leho.kraav.com/blog/2012/11/17/combine-xf86-input-evdev-middle-button-wheel-emulation-kensington-orbit-trackball/
[2] 
https://bitbucket.org/esrevinu/xf86-input-evdev-trackpoint/commits/ef99896f5eb0e40fb95ad661c8bb4910394bf379

>From b53a2d1cafe6e5b6b0661b27f9c0fa6f28645047 Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ai...@linux.site>
Date: Tue, 3 Mar 2015 10:57:37 +0100
Subject: [PATCH 2/2] Pipe the mouse button emulation into the wheel emu

The mouse emulation of middle mouse button is handed off to the wheel
emulation module. This makes the wheel emulation usable on some pointing
stick hardware with only two physical buttons, without breaking
left/right mouse drag functionality and the middle button mouse
emulation.
---
 src/emuMB.c | 6 ++++++
 src/evdev.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/emuMB.c b/src/emuMB.c
index b25eac8..7009206 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -191,6 +191,8 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
 
     pEvdev->emulateMB.pending = FALSE;
     if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
+	if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0)))
+	{} else
         EvdevPostButtonEvent(pInfo, abs(id),
                              (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
         pEvdev->emulateMB.state =
@@ -237,11 +239,15 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
 
     if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
     {
+	if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0)))
+	{} else
         EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
         ret = TRUE;
     }
     if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
     {
+	if (EvdevWheelEmuFilterButton(pInfo, abs(id), (id >= 0)))
+	{} else
         EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
         ret = TRUE;
     }
diff --git a/src/evdev.c b/src/evdev.c
index 9c1a4d3..02963f3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -585,10 +585,10 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev)
     if (EvdevDragLockFilterEvent(pInfo, button, value))
         return;
 
-    if (EvdevWheelEmuFilterButton(pInfo, button, value))
+    if (EvdevMBEmuFilterEvent(pInfo, button, value))
         return;
 
-    if (EvdevMBEmuFilterEvent(pInfo, button, value))
+    if (EvdevWheelEmuFilterButton(pInfo, button, value))
         return;
 
     if (button)
-- 
2.1.4

>From 48b316bd40a48e4c605232c45892fb4cedfd0736 Mon Sep 17 00:00:00 2001
From: Ailin Nemui <ai...@linux.site>
Date: Tue, 3 Mar 2015 10:56:48 +0100
Subject: [PATCH 1/2] pass through the button click and cancel the wheel on
 stick motion

---
 src/emuWheel.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/emuWheel.c b/src/emuWheel.c
index f1d1990..5d76e18 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -66,6 +66,9 @@ EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
 
     /* Check for EmulateWheelButton */
     if (pEvdev->emulateWheel.button == button) {
+       if (pEvdev->emulateWheel.button_state == value)
+           return FALSE;
+
 	pEvdev->emulateWheel.button_state = value;
 
         if (value)
@@ -110,8 +113,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
         if (pEvdev->emulateWheel.button)
         {
             int ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
-            if (ms > 0)
-                return TRUE;
+            if (ms > 0) {
+		EvdevPostButtonEvent(pInfo, pEvdev->emulateWheel.button, BUTTON_PRESS);
+		pEvdev->emulateWheel.button_state = 0;
+		return FALSE;
+	    }
         }
 
 	if(pEv->type == EV_ABS) {
-- 
2.1.4

_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Reply via email to