Change information
Commit message:
ozone/wayland: Persist tablet tool axis state across frames
zwp_tablet_tool_v2 sends an axis event (pressure, distance, tilt,
rotation, slider) only when the value changes. WaylandTabletTool
buffers axis values into frame_data_.pointer_details and dispatches on
frame, but ResetFrameData() rebuilt a fresh FrameData afterwards,
zeroing force, tilt, twist and tangential pressure. Any frame in which
the compositor did not re-send pressure therefore dispatched
force=0.0, producing intermittent pressure:0 samples on a pen held in
continuous contact with the surface.
pointer_type is already persisted across frames for exactly this
reason (crrev.com/c/6907510). This CL completes that pattern for the
analog axes by carrying the whole PointerDetails across the frame
reset instead of rebuilding it. The fields this class never writes
(radius_x, radius_y, id, offset) keep their defaults regardless, so
this is equivalent to persisting the axes individually, without
needing a cache member per axis that a future axis could forget to
update.
Persisting state across frames requires bounding its lifetime, so it
is cleared in two places:
- On proximity-in, since a tool entering proximity begins a new
interaction that must not inherit the previous one's axis values.
proximity_in is the first event in its frame, so a pressure event
arriving in that same frame still takes effect.
- On up, since the tip is no longer in contact and force is zero by
definition. Without this, a persisted force would survive into the
release event on compositors that omit a pressure event from the
frame carrying up.
continuous strokes on a canvas logging PointerEvent.pressure.
Mid-stroke zero-pressure samples: ~38 per stroke before, 0 after.
Bug: 497284918
Test: Manual, ELAN9008:00 04F3:4359 stylus under Sway, drawing
Change-Id: Ie7e5c58bccdddded997f1a45d9cc94e6f367d348
Cr-Commit-Position: refs/heads/main@{#1674519}
Files:
- M AUTHORS
- M ui/ozone/platform/wayland/host/wayland_tablet_tool.cc
Change size: S
Delta: 2 files changed, 16 insertions(+), 1 deletion(-)
Branch: refs/heads/main
Submit Requirements:
Code-Review: +1 by Thomas Anderson, +1 by Kramer Ge