wintab: Incorrectly classifying cursor as stylus instead of eraser (try 3)

Eriks Dobelis eriks.dobelis at biti.lv
Mon Mar 31 09:06:47 CDT 2014


Removed is_stylus and is_eraser functions.

Previous description for convenience kept below.

Created new function to return cursor type, which first classifies based 
on device type and then checks name. This, also, made code in 
X11DRV_LoadTabletInfo cleaner.

For Wacom Pen & Touch Intuos tablet eraser cursor is incorrectly 
detected as stylus.
The tablet returns its eraser cursor name as:
Wacom Intuos PT S Pen eraser
and type as:
ERASER

Current code classifies this as STYLUS, because name of the cursor 
contains the word 'Pen'. It is very unlikely that a cursor with type 
ERASER is STYLUS.

With the patch eraser is correctly detected. Without the patch eraser 
works as stylus.

  dlls/winex11.drv/wintab.c | 35 +++++++++++++----------------------
  1 file changed, 13 insertions(+), 22 deletions(-)



-------------- next part --------------
>From 96a2a21ce595c1de2926b2acef54ef270c91274f Mon Sep 17 00:00:00 2001
From: Eriks Dobelis <eriks.dobelis at biti.lv>
Date: Mon, 31 Mar 2014 16:54:10 +0300
Subject: [PATCH 6/6] wintab: Fixing incorrect eraser classification

---
 dlls/winex11.drv/wintab.c | 35 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index a45f9ff..687fa7b 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -435,8 +435,7 @@ static BOOL is_tablet_cursor(const char *name, const char *type)
     return FALSE;
 }
 
-static BOOL is_stylus(const char *name, const char *type)
-{
+static UINT get_cursor_type(const char *name, const char *type) {
     int i;
     static const char* tablet_stylus_whitelist[] = {
         "stylus",
@@ -446,23 +445,21 @@ static BOOL is_stylus(const char *name, const char *type)
         NULL
     };
 
+    /* First check device type to avoid cases where name is "Pen and Eraser" and type is "ERASER" */
     for (i=0; tablet_stylus_whitelist[i] != NULL; i++) {
-        if (name && match_token(name, tablet_stylus_whitelist[i]))
-            return TRUE;
         if (type && match_token(type, tablet_stylus_whitelist[i]))
-            return TRUE;
+            return CSR_TYPE_PEN;
     }
-
-    return FALSE;
-}
-
-static BOOL is_eraser(const char *name, const char *type)
-{
-    if (name && match_token(name, "eraser"))
-        return TRUE;
     if (type && match_token(type, "eraser"))
-        return TRUE;
-    return FALSE;
+        return CSR_TYPE_ERASER;
+    for (i=0; tablet_stylus_whitelist[i] != NULL; i++) {
+        if (name && match_token(name, tablet_stylus_whitelist[i]))
+            return CSR_TYPE_PEN;
+    }
+    if (name && match_token(name, "eraser"))
+        return CSR_TYPE_ERASER;
+
+    return CSR_TYPE_OTHER;
 }
 
 /* cursors are placed in gSysCursor rows depending on their type
@@ -657,13 +654,7 @@ BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
             cursor.NPBTNMARKS[1] = 1 ;
             cursor.CAPABILITIES = CRC_MULTIMODE;
 
-            /* prefer finding TYPE_PEN(most capable) */
-            if (is_stylus(target->name, device_type))
-                cursor.TYPE = CSR_TYPE_PEN;
-            else if (is_eraser(target->name, device_type))
-                cursor.TYPE = CSR_TYPE_ERASER;
-            else
-                cursor.TYPE = CSR_TYPE_OTHER;
+            cursor.TYPE = get_cursor_type(target->name, device_type);
 
             any = target->inputclassinfo;
 
-- 
1.8.3.2



More information about the wine-patches mailing list