Skip to content

fix(input): smooth magic-mouse pointer on native screens - #2363

Merged
midwan merged 4 commits into
masterfrom
fix/magic-mouse-native-cursor-jitter
Sep 26, 2026
Merged

midwan merged 4 commits into
masterfrom
fix/magic-mouse-native-cursor-jitter

Conversation

@midwan

@midwan midwan commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2279.

Changes proposed in this pull request:

  • In magic-mouse mode on native (chipset) screens, the guest pointer now tracks the host mouse smoothly instead of stepping in visible multi-pixel jumps.
  • Cause: relative mouse input is swallowed while the virtual mouse driver is active, so only the absolute IECLASS_POINTERPOS events move the pointer — and the guest services those at a low rate (frame-by-frame analysis of the issue's slow-motion recording shows pointer updates only every ~100 ms, in 4–11 px steps, while normal mouse mode is smooth). Normal mouse input moves through the hardware mouse counters, which are serviced every vsync.
  • The delta between two consecutively delivered absolute mousehack coordinates is now also fed into the relative mouse pipeline, so the pointer follows every counter update while the absolute events keep anchoring the exact position. Both describe the same displacement, so there is no double movement.
  • Gated to TABLET_MOUSEHACK + driver alive + native screen + both positions valid; RTG and tablet modes are untouched, and the delta bypasses the input_mouse_speed scaling because it is already exact Amiga-space.

Validated by a full Linux build (Debian trixie, SDL3) that compiles clean and runs, and by tracing the delivery path (inputdevice.cpp and filesys.asm) against upstream WinUAE, which is identical here. Guest-side visual confirmation needs a Kickstart ROM and an interactive Workbench session, so a retest on the reporter's setup would be welcome.

@midwan

Absolute IECLASS_POINTERPOS events from the virtual mouse driver are
serviced by the guest at a low rate, so the native-screen pointer moved
in visible multi-pixel steps while the host delivered smooth positions.
Feed the delta between consecutively delivered absolute positions into
the relative mouse pipeline (serviced every vsync like normal mouse
input); the absolute events still anchor the exact position, so there
is no double movement.

Fixes #2279
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T20:57:58.458676Z fe8dc66 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da193433ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputdevice.cpp Outdated
Multi-mouse setups map each host mouse to its own device index; the
native-screen delta injection always dispatched through mice[0]. Record
the device that delivered the position and select its mapping for the
relative events, so the injected movement follows the same port
bindings as the originating device.

Wrap all added code in ifdef AMIBERRY guards and keep shared lines
byte-identical to upstream WinUAE so future core merges do not
clobber the additions.
@midwan

midwan commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1520619c40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputdevice.cpp
The disabled-device branch of setmousestate() still delivers absolute
positions through mousehack_helper(), but the synthesized relative
events must not bypass the user's disabled-device setting. Gate the
native-screen delta injection on the originating device being enabled.
@midwan

midwan commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfd09b72ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputdevice.cpp Outdated
Per-axis ID_FLAG_INVERT would reverse only the synthesized relative
delta while the absolute IECLASS_POINTERPOS anchor stays un-inverted,
moving the pointer opposite to the host between guest driver updates.
The delta is already exact in the absolute coordinate space, so drop
the inversion from the native-screen injection.
@midwan

midwan commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: fe8dc66be8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@midwan
midwan merged commit 209103d into master Sep 26, 2026
28 checks passed
@midwan
midwan deleted the fix/magic-mouse-native-cursor-jitter branch September 26, 2026 20:58
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.

MagicMouse produce jerky native-cursor on native-screens

1 participant