[Bug 60550] New: winex11 wintab: XSelectExtensionEvent called per device overwrites previous selections; stylus/eraser events lost (no pen pressure, eraser acts as tip) on Xwayland
http://bugs.winehq.org/show_bug.cgi?id=60550 Bug ID: 60550 Summary: winex11 wintab: XSelectExtensionEvent called per device overwrites previous selections; stylus/eraser events lost (no pen pressure, eraser acts as tip) on Xwayland Product: Wine Version: 11.19 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wintab32 Assignee: wine-bugs@list.winehq.org Reporter: redcowski@gmail.com Target Milestone: --- Distribution: --- Created attachment 82414 --> http://bugs.winehq.org/attachment.cgi?id=82414 Video proof of pressure sensitivity working in Clip Studio Paint 5.1.5 I managed to get pressure sensitivity working on Clip Studio Paint current latest version under Wine (many artists I know struggle with this and I was specifically helping my sister get her tablet working on her new Linux Framework laptop). I threw my Claude Max at it and we got it to work. Here is the root cause and what got it working: On a Wayland desktop (GNOME/mutter, Xwayland 24.1, Fedora 44), Wintab apps under Wine get the pen with no pressure, and the eraser end behaves like the tip. Seen with Clip Studio Paint 5.1.5 in Wintab mode, Wacom Intuos5 touch M over the wireless kit. Pressure works in native apps. A plain XInput 1 client on the same desktop receives the stylus with full pressure (0–65535) and button events. Xwayland exposes the tablet as three XI1 devices: xwayland-tablet stylus:NN, xwayland-tablet eraser:NN and xwayland-tablet cursor:NN. Wine detects all three (tablet_attach_queue Opening cursor 0 id 12 / 1 id 10 / 2 id 11). Cause: in dlls/winex11.drv/wintab.c, tablet_attach_queue() loops over the cursors and, for each device, builds event_list with only that device's classes. It then calls pXSelectExtensionEvent(data->display, win, event_list, event_number) inside the loop. XSelectExtensionEvent replaces the client's previous XInput 1 selection on that window, so after the loop only the last device is selected. Querying the window with XGetSelectedExtensionEvents shows only the last device (here id 12, the puck). The stylus (10) and eraser (11) are not selected, so Wine receives no stylus motion/button events. A few stale hover events with pressure 0 get through, and the app falls back to mouse input. Proof: a separate XI1 client that selects stylus events on the same Wine window receives 824 motion events with pressure up to 65535 in one test, while Wine (WINEDEBUG=+wintab32) logs 5 motion_events, all with pkNormalPressure: 0. Fix: collect the event classes of all devices into one list and call XSelectExtensionEvent once after the loop (patch attached: the event list grows to CURSORMAX * 7 and the call moves out of the loop). Workaround (until fixed): an LD_PRELOAD shim that merges and re-applies the selections: https://github.com/codicusmaximus/CrapStudioPaint/blob/07392ab23f9aafc51cca0... Steps to reproduce: Wayland session (GNOME), Wacom tablet working in native apps. Run a Wintab app (e.g. Clip Studio Paint set to Wintab, or Wacom's wtcapt.exe) with WINEDEBUG=+wintab32. Draw with the pen: the log shows almost no motion_events and pressure stays 0; the eraser end draws like the tip. XGetSelectedExtensionEvents on the app window lists only one tablet device, e.g. with https://github.com/codicusmaximus/CrapStudioPaint/blob/436c23e5d3139cfc94e67... I have reviewed the fix and it seems reasonable to me, this would help a lot of people struggling with pressure sensitivity and it makes moving to a Linux-based OS a non-starter for a lost of artist folk. Thanks for considering it. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla