[PATCH:xf86-input-mouse 2/4] Add support for absolute positioning (tablets).

Thomas Klausner wiz at NetBSD.org
Mon Aug 19 10:30:37 PDT 2013


On Mon, Aug 19, 2013 at 05:17:32PM +0100, Daniel Stone wrote:
> Hi,
> 
> On 19 August 2013 10:14, Thomas Klausner <wiz at netbsd.org> wrote:
> > +       case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
> > +           miPointerGetPosition (pInfo->dev, &x, &y);
> > +           x = event->value;
> > +           miPointerSetPosition (pInfo->dev, Absolute, (double *)&x, (double *)&y);
> > +           xf86PostMotionEvent(pInfo->dev, TRUE, 0, 2, x, y);
> > +           ++event;
> > +           continue;
> 
> Please eliminate the mipointer calls, and replace them with:
> xf86PostMotionEvent(pInfo->dev, TRUE, 0, 1, x);
> 
> > +       case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
> > +           miPointerGetPosition (pInfo->dev, &x, &y);
> > +           y = event->value;
> > +           miPointerSetPosition (pInfo->dev, Absolute, (double *)&x, (double *)&y);
> > +           xf86PostMotionEvent(pInfo->dev, TRUE, 0, 2, x, y);
> > +           ++event;
> > +           continue;
> 
> And similarly this with:
> xf86PostMotionEvent(pInfo->dev, TRUE, 1, 1, y);

Thanks for the review! New version attached, please check if I
understood correctly.
 Thomas
-------------- next part --------------
>From 8132691ab2a1149a29ab6d03e532840dbb9cab90 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Mon, 19 Aug 2013 10:46:36 +0200
Subject: [PATCH:xf86-input-mouse 2/4] Add support for absolute positioning
 (tablets).

>From Pierre Pronchery <khorben at NetBSD.org>
and review comments by Daniel Stone <daniel at fooishbar.org>.
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 src/bsd_mouse.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/bsd_mouse.c b/src/bsd_mouse.c
index 98e5ff3..a2c8ec7 100644
--- a/src/bsd_mouse.c
+++ b/src/bsd_mouse.c
@@ -407,7 +407,7 @@ wsconsReadInput(InputInfoPtr pInfo)
     n /= sizeof(struct wscons_event);
     while( n-- ) {
         int buttons = pMse->lastButtons;
-        int dx = 0, dy = 0, dz = 0, dw = 0;
+        int dx = 0, dy = 0, dz = 0, dw = 0, x, y;
         switch (event->type) {
         case WSCONS_EVENT_MOUSE_UP:
 #define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value))
@@ -432,6 +432,26 @@ wsconsReadInput(InputInfoPtr pInfo)
             dw = event->value;
             break;
 #endif
+	case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
+	    x = event->value;
+	    xf86PostMotionEvent(pInfo->dev, TRUE, 0, 1, x);
+	    ++event;
+	    continue;
+	case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
+	    y = event->value;
+	    xf86PostMotionEvent(pInfo->dev, TRUE, 1, 1, y);
+	    ++event;
+	    continue;
+#ifdef WSCONS_EVENT_MOUSE_ABSOLUTE_Z
+	case WSCONS_EVENT_MOUSE_ABSOLUTE_Z:
+	    ++event;
+	    continue;
+#endif
+#ifdef WSCONS_EVENT_MOUSE_ABSOLUTE_W
+	case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
+	    ++event;
+	    continue;
+#endif
         default:
             LogMessageVerbSigSafe(X_WARNING, -1,
                                   "%s: bad wsmouse event type=%d\n", pInfo->name,
-- 
1.8.3.3



More information about the xorg-devel mailing list