Skip to content

fix(linux/input): emulate relative mouse movement from absolute coordinates - #5529

Open
danalec wants to merge 1 commit into
LizardByte:masterfrom
danalec:pr/abs-mouse-relative
Open

fix(linux/input): emulate relative mouse movement from absolute coordinates#5529
danalec wants to merge 1 commit into
LizardByte:masterfrom
danalec:pr/abs-mouse-relative

Conversation

@danalec

@danalec danalec commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Moonlight TV clients (and other absolute-motion sources) send absolute mouse
positions (MOUSE_MOVE_ABS_MAGIC). The Linux backend forwards them as absolute
uinput events, which compositors treat as absolute pointer motion.

COSMIC's magnifier does not track the cursor on absolute motion:
PointerMotionAbsolute moves the cursor but never calls update_focal_point
(pop-os/cosmic-comp#2760; same symptom class as #1418/VirtualBox). Relative
motion (PointerMotion) updates the zoom on every event, so converting absolute
input to relative deltas makes the magnifier follow the cursor.

How it works

  • The first absolute event still places the cursor absolutely, anchoring the
    baseline (abs_mouse).
  • Subsequent events are converted to relative deltas (move_mouse) based on the
    tracked last position, so the cursor arrives at the compositor as relative
    pointer motion.

Testing

Verified on a KVM guest (CachyOS/COSMIC 1.5) streaming to a Moonlight TV client:
with the patch the magnifier follows the cursor; without it, the zoomed view
stays fixed.

Related

@danalec danalec changed the title linux: emulate relative mouse movement from absolute coordinates fix(linux/input): emulate relative mouse movement from absolute coordinates Aug 19, 2026
@ReenigneArcher

Copy link
Copy Markdown
Member

It won't pass until I approve the workflows.

Anyway... Thank you for the PR submission, but it looks like you used AI to create this PR.

Please read and follow our Contributing guidelines and specifically our AI Usage policy.

Additionally, please update the PR to use the correct template. You can find it at https://github.com/LizardByte/.github/blob/master/.github/pull_request_template.md?plain=1

@ReenigneArcher ReenigneArcher added the ai PR has signs of heavy ai usage (either indicated by user or assumed) label Aug 19, 2026
Convert absolute mouse input to relative deltas, accumulating fractional
deltas so slow (sub-pixel) motion still moves the cursor on both axes.
Moonlight TV clients send absolute positions; emitting relative deltas makes
the COSMIC magnifier follow the cursor (PointerMotionAbsolute never updates
the zoom focal point — pop-os/cosmic-comp LizardByte#2760).
@danalec
danalec force-pushed the pr/abs-mouse-relative branch from 7fc91f8 to 25164e4 Compare August 21, 2026 01:10
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

ai PR has signs of heavy ai usage (either indicated by user or assumed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants