Bug 338675

Summary: Not recognizing tablet pressure
Product: [Applications] krita Reporter: Ryan Mendivil <contact>
Component: Tablets (tablet issues are only very rarely bugs in Krita!)Assignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: dimula73, manuel.gdot, prakseda16
Priority: NOR    
Version First Reported In: 2.8.5   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ryan Mendivil 2014-08-30 10:19:44 UTC
I have a UC-LOGIC TWA60 tablet which Krita recognizes on startup.  However, it refuses to detect any sort of pressure regardless of what value the tablet is actually sending: http://i.imgur.com/Jh6jsK4.gif.

Reproducible: Always

Steps to Reproduce:
1. Start Krita with UC-LOGIC TWA60 tablet plugged in
2. Enable pressure sensitivity
3. Attempt to draw a line using the tablet

Actual Results:  
The line stays the same thickness/weight regardless of the pressure applied.

Expected Results:  
The line should vary in thickness/weight depending on pressure applied.

So after a long debugging session, I managed to track down where this is happening.  In ui/input/wintab/kis_tablet_support_x11.cpp on line 608 there is a test to make sure that the tablet is returning "sane data".  If this checks out false, it returns early and ignores any pressure or other input from the tablet.  The check calls to ui/input/wintab/kis_tablet_support.h on line 149 which returns the result of "firstAxis <= m_lastSaneAxis".  When debugging, "firstAxis" appears to be an normal value but "m_lastSaneAxis" appears to be a random negative number.  Running a search in the code for "m_lastSaneAxis" turns up that it's only two uses are a declaration on line 162 and it's use on line 157.  That means it's uninitialized and the comparison will fail if the memory at that point happens to be a negative integer.  Initializing it to a positive integer seems to fix this problem.
Comment 1 Dmitry Kazakov 2014-08-30 13:30:26 UTC
Hi, Ryan! Did you check with the latest build in Krita Lime?

http://dimula73.blogspot.ru/2013/05/krita-lime-ppa-always-fresh-versions.html
Comment 2 Ryan Mendivil 2014-08-30 19:52:08 UTC
I'm building from source rather than using the PPAs.  Will test off of master and report back.
Comment 3 Ryan Mendivil 2014-08-30 20:22:36 UTC
Yep, this is fixed in master.