Skip to content

fix: collect all mouse movement data#664

Open
AndreVto wants to merge 1 commit intoutkarshdalal:masterfrom
AndreVto:fix-mouse-movement
Open

fix: collect all mouse movement data#664
AndreVto wants to merge 1 commit intoutkarshdalal:masterfrom
AndreVto:fix-mouse-movement

Conversation

@AndreVto
Copy link

@AndreVto AndreVto commented Feb 27, 2026

Collect all mouse movement instead of just the last delta
This is a fix required for wireless USB mouse to work correctly inside the container


Summary by cubic

Collects all mouse movement during ACTION_MOVE (history + current) to prevent lost deltas. Fixes choppy or unresponsive movement for wireless USB mice inside the container.

  • Bug Fixes
    • Sum MotionEvent historical X/Y with the current sample and inject the full delta.
    • Replace hardcoded source (8194) with InputDevice.SOURCE_MOUSE.

Written for commit 4c82ecc. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved touchpad pointer movement handling with better delta accumulation for smoother and more accurate cursor tracking.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 761d93b and 4c82ecc.

📒 Files selected for processing (1)
  • app/src/main/java/com/winlator/widget/TouchpadView.java

📝 Walkthrough

Walkthrough

The onCapturedPointer method in TouchpadView now accumulates historical pointer motion deltas across event history before injection, replaces a hard-coded source bitmask with InputDevice.SOURCE_MOUSE, and delegates non-MOVE actions to onExternalMouseEvent.

Changes

Cohort / File(s) Summary
Pointer Movement Event Handling
app/src/main/java/com/winlator/widget/TouchpadView.java
Modified onCapturedPointer to accumulate historical X/Y deltas for ACTION_MOVE events, changed action source from hard-coded bitmask to InputDevice.SOURCE_MOUSE, and preserved delegation for non-MOVE events.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A touchpad's path, now smoother still,
With history's gentle, rolling hill,
Old bitmasks fade, constants take their place,
Pointers dance with newfound grace! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: collect all mouse movement data' directly summarizes the main change: modifying mouse input handling to collect all mouse movement deltas instead of using only the last one, which aligns with the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/com/winlator/widget/TouchpadView.java">

<violation number="1" location="app/src/main/java/com/winlator/widget/TouchpadView.java:714">
P1: User sensitivity and cursor acceleration logic was mistakenly removed from captured pointer movement</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

dy += event.getHistoricalY(i);
}

dx += event.getX();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 27, 2026

Choose a reason for hiding this comment

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

P1: User sensitivity and cursor acceleration logic was mistakenly removed from captured pointer movement

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/com/winlator/widget/TouchpadView.java, line 714:

<comment>User sensitivity and cursor acceleration logic was mistakenly removed from captured pointer movement</comment>

<file context>
@@ -701,19 +701,22 @@ public float[] computeDeltaPoint(float lastX, float lastY, float x, float y) {
+                dy += event.getHistoricalY(i);
             }
+
+            dx += event.getX();
+            dy += event.getY();
             this.xServer.injectPointerMoveDelta(Mathf.roundPoint(dx), Mathf.roundPoint(dy));
</file context>
Fix with Cubic

Copy link
Author

Choose a reason for hiding this comment

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

custom sensitivity is not actually used in the app and always returns 1, the acceleration logic was probably trying to fix this exact same issue but failing to cover all cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant