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

Thomas Klausner wiz at NetBSD.org
Mon Aug 19 02:14:31 PDT 2013


>From Pierre Pronchery <khorben at NetBSD.org>
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 src/bsd_mouse.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/bsd_mouse.c b/src/bsd_mouse.c
index 98e5ff3..ae8dac6 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,30 @@ wsconsReadInput(InputInfoPtr pInfo)
             dw = event->value;
             break;
 #endif
+	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;
+	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;
+#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