Skip to content

Conversation

@Kuuuube
Copy link
Member

@Kuuuube Kuuuube commented Oct 6, 2025

Libinput gets angry sometimes when the pen tool is unset and the eraser tool is set in the same sync leading to some wonky behavior.

@Kuuuube Kuuuube added this to the v0.6.6.1 milestone Oct 6, 2025
@github-actions github-actions bot added the desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. label Oct 6, 2025
@gonX gonX self-requested a review October 6, 2025 01:02
@Kuuuube Kuuuube added linux/gtk Affects the Linux platform bug Something isn't working labels Oct 6, 2025
@Kuuuube Kuuuube force-pushed the fix-libinput-stuck-pen-tool branch from 46bd24a to 152a055 Compare October 6, 2025 01:24
@Kuuuube Kuuuube changed the title Never unset the libinput pen tool Fix libinput eraser not setting sometimes Oct 6, 2025
@github-actions github-actions bot added the plugins Plugin or Plugin API related label Oct 6, 2025
@Kuuuube Kuuuube force-pushed the fix-libinput-stuck-pen-tool branch from 152a055 to f186463 Compare October 6, 2025 01:46
@Kuuuube Kuuuube changed the title Fix libinput eraser not setting sometimes Fix libinput eraser not setting sometimes due to not flushing and sending two conflicting tool reports Oct 6, 2025
Copy link
Member

@gonX gonX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but may cause some issues if distance handling ends up being implemented due to the ordering in the output modes, since this PR flushes after any distance related stuff has been emitted:

protected override void OnOutput(IDeviceReport report)
{
// this should be ordered from least to most chance of having a
// dependency to another pointer property.
if (report is IProximityReport proximityReport && Pointer is IHoverDistanceHandler hoverDistanceHandler)
hoverDistanceHandler.SetHoverDistance(proximityReport.HoverDistance);
if (report is IEraserReport eraserReport && Pointer is IEraserHandler eraserHandler)
eraserHandler.SetEraser(eraserReport.Eraser);

We may want to consider refactoring EvdevVirtualTablet entirely in the future, so that we don't actually write anything out before calling Flush(), instead using a queue per flush (which the flush then clears).

This should allow us to know to unset the tools (e.g. nullable private instance field _lastTool set in last invocation of flush) we know we've sent as being present and then flush unneeded tools as necessary, before continuing on with the pipeline.

IIRC, historically, the code used to flush on SetPosition, so the current design is mostly a relic of the past.

TL;DR: Accepting with a reminder to self to refactor this code to "assemble" the packet in Flush() instead.

@Kuuuube Kuuuube merged commit 61c2318 into OpenTabletDriver:0.6.x Oct 6, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working desktop OpenTabletDriver.Desktop library, UX and Daemon use this as the core implementation. linux/gtk Affects the Linux platform plugins Plugin or Plugin API related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants