[Bf-blender-cvs] [369ffbd911c] master: Fix T68073: Wacom Intuos 5S no pen pressure on Wayland

Sebastian Parborg noreply at git.blender.org
Fri Aug 2 16:42:14 CEST 2019


Commit: 369ffbd911c1957c83fa58ba2491cc578179ce2f
Author: Sebastian Parborg
Date:   Fri Aug 2 16:40:04 2019 +0200
Branches: master
https://developer.blender.org/rB369ffbd911c1957c83fa58ba2491cc578179ce2f

Fix T68073: Wacom Intuos 5S no pen pressure on Wayland

The issue is that wayland seems to impose a generic device naming scheme
when using Xwayland For example any table stylus will show up with the
following naming convention: xwayland-stylus:33

For this to work in blender, I had to modify how the identifier string
is extracted. I also renamed the two char pointers in the search
algorithm to be more logical.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5401

===================================================================

M	intern/ghost/intern/GHOST_SystemX11.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 31411c823ae..e46edeeac9a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -2194,23 +2194,28 @@ int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/)
 
 #ifdef WITH_X11_XINPUT
 
+static bool is_filler_char(char c)
+{
+  return isspace(c) || c == '_' || c == '-' || c == ';' || c == ':';
+}
+
 /* These C functions are copied from Wine 3.12's wintab.c */
 static bool match_token(const char *haystack, const char *needle)
 {
-  const char *p, *q;
-  for (p = haystack; *p;) {
-    while (*p && isspace(*p))
-      p++;
-    if (!*p)
+  const char *h, *n;
+  for (h = haystack; *h;) {
+    while (*h && is_filler_char(*h))
+      h++;
+    if (!*h)
       break;
 
-    for (q = needle; *q && *p && tolower(*p) == tolower(*q); q++)
-      p++;
-    if (!*q && (isspace(*p) || !*p))
+    for (n = needle; *n && *h && tolower(*h) == tolower(*n); n++)
+      h++;
+    if (!*n && (is_filler_char(*h) || !*h))
       return true;
 
-    while (*p && !isspace(*p))
-      p++;
+    while (*h && !is_filler_char(*h))
+      h++;
   }
   return false;
 }



More information about the Bf-blender-cvs mailing list