https://bugs.winehq.org/show_bug.cgi?id=53642
Bug ID: 53642 Summary: 'wintab.c:is_tablet_cursor' fails with xwayland devices Product: Wine Version: 7.16 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wintab32 Assignee: wine-bugs@winehq.org Reporter: bugg.void@tutanota.com Distribution: ---
Created attachment 73043 --> https://bugs.winehq.org/attachment.cgi?id=73043 wintab32 debug output, is_tablet_cursor test
I can't get pen pressure to work with xwayland. Running with WINEDEBUG=+wintab32 shows that wintab fails because it 'Did not find a valid stylus, unable to determine system context parameters. Wintab is disabled.' ( see attachment ). It seems to me that the 'is_tablet_cursor' function fails with xwayland device names. Below is my best attempt at explaining why it happens.
Looking at one of the devices ( see attachment for more )
Device 9: [id 10|name xwayland-tablet stylus:10|type "xwayland-pointer"|num_classes 2|use 4] Is XExtension: Device, Keyboard, or Pointer Skipping device 9 [name xwayland-tablet stylus:10|type "xwayland-pointer"]; not apparently a tablet cursor type device
we get: name: xwayland-tablet stylus:10 type: xwayland-pointer
This will result in: is_tablet_cursor( "xwayland-tablet stylus:10", "xwayland-pointer" ) which will fail, because 'match_token' gets confused by extra ':10' in the name
I used source at https://source.winehq.org/git/wine.git/blob/a4930f003f45ab82c4c05746cbd29cbd... to analyze this case. I can't build wine currently so I wasn't able to test any fixes. The best I was able to do is extracting 'is_tablet_cursor' and testing it in isolation ( https://www.ideone.com/Gc69l0 ).
Let me know if you need any more info.
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #1 from bugg.void@tutanota.com --- Created attachment 73044 --> https://bugs.winehq.org/attachment.cgi?id=73044 qucik and dirty test code
Used test code in case link goes dead
https://bugs.winehq.org/show_bug.cgi?id=53642
David Kahurani k.kahurani@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |k.kahurani@gmail.com
--- Comment #2 from David Kahurani k.kahurani@gmail.com --- It looks like the token matching expects the tokens to be separated by spaces while the first two tokens in your strings are separated by hyphens.
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) break;
for (q = needle; *q && *p && tolower(*p) == tolower(*q); q++) p++; if (! *q && (isspace(*p) || !*p)) return TRUE;
while (*p && ! isspace(*p)) p++; } return FALSE; }
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #3 from bugg.void@tutanota.com --- Yeah, it needs either null or space at the end of a matched token. In this case it has `:`. One way to fix it would be to allow other characters at the end but I'm not sure what other side effects would this introduce.
I'm also not sure why those devices are named likes this, I tested with Wacom Intuos Pro and XP-PEN Deco 03 but they both get generic 'xwayland-tablet' names. Another way to go around this problem would be to change device names somehow but I don't know if it's even possible.
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #4 from bugg.void@tutanota.com --- I think I found the source of those names. It's https://cgit.freedesktop.org/xorg/xserver/tree/hw/xwayland/xwayland-input.c line 1544. `add_device` appends seat id to the name. It seems that the best way forward would be to update wine's detection mechanism to allow for `:`.
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #5 from bugg.void@tutanota.com --- Created attachment 73092 --> https://bugs.winehq.org/attachment.cgi?id=73092 Patch for 'match_token' function
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #6 from bugg.void@tutanota.com --- Created attachment 73093 --> https://bugs.winehq.org/attachment.cgi?id=73093 wintab debug after the patch
https://bugs.winehq.org/show_bug.cgi?id=53642
--- Comment #7 from bugg.void@tutanota.com --- I managed to apply a simple patch to 'match_token'. It allowed wintab to progress but I still can't get pressure to work. I've attached wintab debug log with the patch applied, maybe it will help solve this. At this point I have no more ideas.