[PATCH:xf86-input-mouse 4/4] For wsmouse, keep 3-button emulation status.

Thomas Klausner wiz at NetBSD.org
Sun Mar 30 06:00:57 PDT 2014


Hi Alan!

Thanks for the review.

On Tue, Mar 25, 2014 at 05:32:17PM -0700, Alan Coopersmith wrote:
> On 08/19/13 02:14 AM, Thomas Klausner wrote:
> >With a multiplexed device like wsmouse it does not make sense to
> >kill emulate3buttons on the first button-3-pressed event. The
> >button-3 pressed may belong to a mouse long gone and leave the
> >internal (two button only) mousepad useless.
> >
> > From Martin Husemann <martin at NetBSD.org>
> >Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
> >---
> >  src/mouse.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> >diff --git a/src/mouse.c b/src/mouse.c
> >index 4797160..89cccdd 100644
> >--- a/src/mouse.c
> >+++ b/src/mouse.c
> >@@ -2057,6 +2057,17 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
> >      if (!pMse->emulate3ButtonsSoft)
> >          return TRUE;
> >
> >+#if defined(__NetBSD__) && defined(WSCONS_SUPPORT)
> >+   /*
> >+    * On NetBSD a wsmouse is a multiplexed device. Imagine a notebook
> >+    * with two-button mousepad, and an external USB mouse plugged in
> >+    * temporarily. After using button 3 on the external mouse and
> >+    * unplugging it again, the mousepad will still need to emulate
> >+    * 3 buttons.
> >+    */
> >+   return TRUE;
> >+#endif
> >+
> >      LogMessageVerbSigSafe(X_INFO, 4, "mouse: 3rd Button detected: disabling emulate3Button\n");
> >
> >      Emulate3ButtonsSetEnabled(pInfo, FALSE);
> >
> 
> Won't that cause compiler warnings about unreachable code?   Perhaps the rest
> of the function should be wrapped in #else ... #endif.

I've done that.
I don't see a warning for that. I'm not exactly sure why.

> (In fact you could probably put the whole function body in the #else...#endif
>  clause, but then you'd have to add an attribute to tell the compiler it's
>  expected that the pInfo argument is unused.)

If you prefer that, please let me know what magic I need to use to do that :)

Attached patch ok?

Thanks,
 Thomas
-------------- next part --------------
>From ab96d0f914b5c76bad7db92b7b9110a0802dae48 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Mon, 19 Aug 2013 11:14:33 +0200
Subject: [PATCH:xf86-input-mouse 4/4] For wsmouse, keep 3-button emulation
 status.

With a multiplexed device like wsmouse it does not make sense to
kill emulate3buttons on the first button-3-pressed event. The
button-3 pressed may belong to a mouse long gone and leave the
internal (two button only) mousepad useless.

>From Martin Husemann <martin at NetBSD.org>
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 src/mouse.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mouse.c b/src/mouse.c
index 0c7fc63..139e1cd 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -2082,12 +2082,23 @@ Emulate3ButtonsSoft(InputInfoPtr pInfo)
     if (!pMse->emulate3ButtonsSoft)
         return TRUE;
 
+#if defined(__NetBSD__) && defined(WSCONS_SUPPORT)
+    /*
+     * On NetBSD a wsmouse is a multiplexed device. Imagine a notebook
+     * with two-button mousepad, and an external USB mouse plugged in
+     * temporarily. After using button 3 on the external mouse and
+     * unplugging it again, the mousepad will still need to emulate
+     * 3 buttons.
+     */
+    return TRUE;
+#else
     LogMessageVerbSigSafe(X_INFO, 4,
         "mouse: 3rd Button detected: disabling emulate3Button\n");
 
     Emulate3ButtonsSetEnabled(pInfo, FALSE);
 
     return FALSE;
+#endif
 }
 
 static void MouseBlockHandler(pointer data,
-- 
1.9.0



More information about the xorg-devel mailing list