wintab: Incorrectly classifying cursor as stylus instead of eraser (try 2)
Eriks Dobelis
eriks.dobelis at biti.lv
Mon Mar 24 02:59:11 CDT 2014
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 | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
-------------- next part --------------
>From a2f298966d10d5236ffcb29f885a7e14f2cf6a35 Mon Sep 17 00:00:00 2001
From: Eriks Dobelis <eriks.dobelis at biti.lv>
Date: Mon, 24 Mar 2014 09:50:14 +0200
Subject: [PATCH 5/5] Fixing incorrect eraser classification
---
dlls/winex11.drv/wintab.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index a45f9ff..39b5858 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,31 @@ 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;
}
+ if (type && match_token(type, "eraser"))
+ 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 FALSE;
+ return CSR_TYPE_OTHER;
+}
+
+static BOOL is_stylus(const char *name, const char *type)
+{
+ return get_cursor_type(name, type) == CSR_TYPE_PEN;
}
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 get_cursor_type(name, type) == CSR_TYPE_ERASER;
}
/* cursors are placed in gSysCursor rows depending on their type
@@ -657,13 +664,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