fix(linux): track cursor via X11 query to work around electron#42519 - #9
Open
Memphis1983 wants to merge 2 commits into
Open
fix(linux): track cursor via X11 query to work around electron#42519#9Memphis1983 wants to merge 2 commits into
Memphis1983 wants to merge 2 commits into
Conversation
screen.getCursorScreenPoint() has returned a stale point forever on Linux X11 since Electron 29 (electron/electron#42519), which pinned the companion cursor in place during push-to-talk. Poll the pointer directly from the X server with the pure-JS x11 client (root-window QueryPointer, converted to DIPs), falling back to the Electron API on macOS, Windows, and Wayland.
|
@Memphis1983 is attempting to deploy a commit to the jvaught01's projects Team on Vercel. A member of the Team first needs to authorize it. |
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 Linux companion cursor being pinned in place (issue #5). Root cause is upstream:
screen.getCursorScreenPoint()has returned one stale point forever on Linux X11 since Electron v29 (electron/electron#42519, also #41496). Flicky's click-through overlay is an exact repro.Approach
On Linux X11 the pointer is now read directly from the X server using the pure-JS
x11package (QueryPointeron the root window, no native compile, no subprocess), converted to DIPs withscreen.screenToDipPoint. macOS, Windows, and Wayland keep using the Electron API.src/main/services/cursor-source.tsis a small poller: it lazily opens the X connection on first poll, issues an asyncQueryPointereach tick, and returns the last-known position (one-tick latency, invisible at 60fps). On any connection/query error it falls back to returning the last good point and never throws.Verification (Linux Mint 22.3, X11/Cinnamon, AMD)
typecheck+buildclean560,480 → 840,555 → 1120,630 → 1400,705) whilexdotoolmoves the mouse; previously frozenFiles
src/main/services/cursor-source.ts(new)src/main/index.ts(platform-gated polling)package.json,bun.lock(addsx11^3.9.1)Closes #5