http://bugs.winehq.org/show_bug.cgi?id=21660
Summary: Wacom bounding rectangle top coordinates ignored Product: Wine Version: 1.1.38 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: wintab32 AssignedTo: wine-bugs@winehq.org ReportedBy: azathothgr@gmail.com
Created an attachment (id=26156) --> (http://bugs.winehq.org/attachment.cgi?id=26156) DUMPCONTEXT for TopX/Y = 10000 and BottomX/Y defaults
When setting TopX/Y and BottomX/Y with xsetwacom the resulting bounding box gets ignored. This makes the cursor draw in a different location than where it is displayed.
Looking at the tablet context I see that TopXY and BottomXY get mapped directly to InOrgX/Y and InExtX/Y, while OutOrgX/Y is always 0 and OutExtX = InExtX , OutExtY = -InExtY . I tested this with artrage studio pro, and Gimp for windows, with an intuos3. I couldn't get gimp to use the tablet properly, but the context was exactly the same as in artrage.
The function ScaleForContext in dlls/wintab32/context.c seems to use InExt and OutExt as extents (right - left coordinate) while they're being set as absolute coordinates. Also the OutExt for the Y axis is always negative, but negative Y values do not work at all.
Replacing ScaleForContext with a simple linear mapping from [InOrg , InExt] to [OutOrg, OutExt], returning an absolute value of the result to cope with the negative Y axis, and removing Y axis flipping later on the same file, seems to fix the issue: ScaleForContext : replace with : LONG Out; Out = (LONG)(OutOrg + ( ( In - InOrg) * (float)(OutExt - OutOrg)) / (InExt - InOrg)); return abs(Out)
AddPacketToContextQueue: remove : /* flip the Y axis */ if (ptr->context.lcOutExtY > 0) packet->pkY = ptr->context.lcOutExtY - packet->pkY; else if (ptr->context.lcOutExtY < 0) packet->pkY = abs(ptr->context.lcOutExtY + packet->pkY);
This even works correctly for negative TopX/Y values and out of bounds BottomXY values, which can map the entire tablet area to a portion of the screen.
I have a few questions however. Where do OutOrg and OutExt get set, and why is OutExtY always negative ? And most importantly, are the above changes correct?