Bug 19285 - Getting motion history for a wacom tablet through XGetDeviceMotionEvents returns wrong coords
Summary: Getting motion history for a wacom tablet through XGetDeviceMotionEvents retu...
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/other (show other bugs)
Version: 7.4 (2008.09)
Hardware: Other All
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
Depends on:
Blocks: xserver-1.6
  Show dependency treegraph
Reported: 2008-12-25 10:44 UTC by Alexia Death
Modified: 2009-01-12 10:49 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

0001-Xi-call-CheckMotion-for-floating-SDs-too.patch (900 bytes, patch)
2009-01-07 22:47 UTC, Peter Hutterer
no flags Details | Splinter Review
0001-dix-drop-x-y-back-into-last.valuators-before-updati.patch (1.59 KB, patch)
2009-01-08 20:16 UTC, Peter Hutterer
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alexia Death 2008-12-25 10:44:18 UTC
Output sample from the part of GIMP that deals with input events:

Coords: t (630.547256, 528.089939) 
Coords: (41.946138, -32.116870)    
Coords: t (630.482724, 528.412602) 
Coords: (41.946138, -32.116870)    
Coords: t (629.966463, 528.993394) 
Coords: (41.946138, -32.116870)    
Coords: t (628.804878, 530.284045) 
Coords: (41.881606, -32.052337)    
Coords: t (627.127033, 532.090955) 
Coords: (41.817073, -31.987805)    
Coords: t (625.126524, 534.349593) 
Coords: (41.688008, -31.858740)    
Coords: t (625.126524, 534.349593) 

The events without letter "t" are from history buffer, events with it are straight from device state. The history buffer coords make no sense at all.

Gimp gets them through GTK+ but the code in GTK looked fine and worked perfectly with previous X, so I consider it justified to file a bug with you guys :).

Personal speculation as to cause - the same as the other bug I filed today, they are evaluated against master devices parameters that are incorrect for the  events from the actual tablet device.
Comment 1 Peter Hutterer 2009-01-07 22:47:55 UTC
Created attachment 21789 [details] [review]

From my initial testing so far there's two issues (valid for floating slave devices):

1) the event coordinates remain the same.
2) the history buffer is scaled to screen coordinates

This patch fixes 1) by calling CheckMotion for floating slave devices to ensure the DIX sprite is updated. Need to look further into 2).
Comment 2 Peter Hutterer 2009-01-08 20:16:06 UTC
Created attachment 21824 [details] [review]

Something like this should do

dix: drop x/y back into last.valuators before updating the history (#19285)

positionSprite needs to scale to screen coordinates and in the process of
doing so alters dev->last.valuators[0:1]. Drop the real coordinates back after
finishing and before updating the motion history. This way, we don't push the
screen coordinates into the motion history.
Comment 3 Alexia Death 2009-01-10 06:48:55 UTC
With these two patches the issue is corrected for me. Thanks :D.
Comment 4 Alexia Death 2009-01-10 06:49:45 UTC
ps: tested by applying to Jaunty's xsever-xorg source package.
Comment 5 Peter Hutterer 2009-01-11 17:48:14 UTC
Pushed as 9bf77569cc8f9b0cc25c99487672d375d7c32f99 and
 56efbc0986e782da45addb05ece9f456d41d7a90. Thanks for testing.
Comment 6 Keith Packard 2009-01-12 10:49:12 UTC
Fixed in 6be355b8e8cabeb5832ce9970a83782ea46fd4d1

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.