Fix cursor jumping when a pointing device is attached to each board (#263) - #357
Open
mglushko wants to merge 1 commit into
Open
Fix cursor jumping when a pointing device is attached to each board (#263)#357mglushko wants to merge 1 commit into
mglushko wants to merge 1 commit into
Conversation
Each board tracks the cursor position independently, but there is only one cursor. Positions were only ever propagated in one direction: the non-active board forwards full mouse reports over UART, which the active board adopts. Nothing travelled the other way, so whenever a pointing device on the active board moved the cursor, the other board kept a stale position. With a pointing device on each board (e.g. a keyboard with an integrated trackball plus a regular mouse) the cursor therefore jumped back to whatever position the other board last recorded as soon as that other device was used. Two cases are fixed: - switch_to_another_pc parks the cursor in a corner of the outgoing screen via a hidden_pointer report. When that screen belongs to the other board the report travels over UART and the receiving board stored the parking coordinates as a real cursor position, so the next movement from that board jumped in from the corner. As the parked X sits on the screen edge, the smallest movement then triggered an unwanted switch back. - Ordinary movement by the active board is now published to the other board, so alternating between pointing devices no longer snaps the cursor back to the other device_s last known position. Fixes hrvach#263
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the cursor jumping to a screen corner (and often triggering an unwanted output switch) when there is a pointing device attached to both boards — e.g. a keyboard with an integrated trackball on one and a regular mouse on the other. Hopefully this fully fixes #263.
Root cause
Each board tracks
pointer_x/pointer_yindependently, but there is only one cursor. Position was only ever propagated in one direction: the non-active board forwards full mouse reports over UART and the active board adopts them. Nothing traveled back, so a pointing device on the active board would move the cursor while the other board kept a stale position.Two visible symptoms:
Jump in from a corner after switching.
switch_to_another_pc()sends ahidden_pointerreport to park the cursor in a corner of the outgoing screen. When that screen belongs to the other board, the report goes over UART andhandle_mouse_abs_uart_msg()stores the parking coordinates as a real cursor position. The next movement from that board resumes from the corner — and since the parked X sits on the screen edge, even a tiny movement satisfies the edge check and triggers an immediate switch back.Snap to the other device's last position. Alternating between the two pointing devices moved the cursor back to wherever the other board last recorded it.
Changes
POINTER_SYNC_MSGpacket type carrying the cursor's x/y.sync_pointer_position()publishes the current position to the other board.switch_to_another_pc()(which also overwrites the parking coordinates left by the park report), and on movement when the board is the active output — the case where the report otherwise stays local.No config, webconfig, or flash-layout changes.
Testing
Verified on hardware with a pointing device on each board (mouse in the mouse port, a second mouse in the keyboard port):