Repository navigation
feat: relative coordinates for background click and scroll - #506
Merged
Merged
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 1b5e8a08-9d93-406c-b017-03578e5e3f08) |
There was a problem hiding this comment.
This is an auto review done by revuto.
Revuto completed the review and found no evidence-backed concerns.
Background click and scroll now take relative=true: x and y from the target window's screenshot crop are mapped through the window's bounds and the capture scale, then checked like any background point. Follow-up to #480.
avifenesh
force-pushed
the
feat/background-relative
branch
from
November 24, 2026 14:02
71d5b7b to
12dfe85
Compare
There was a problem hiding this comment.
This is an auto review done by revuto.
Revuto completed the review and found no evidence-backed concerns.
This was referenced Nov 24, 2026
Merged
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.
Follow-up to #480.
A client that works in window coordinates had to convert them to screen capture pixels before it could send a background click. The codex-desktop-linux bridge, whose
app.click()sends window-relative points withrelative: true, was patched for that on #480. The server already knows the target window's bounds and the capture scale, so it now does the conversion.What changed:
clickandscrollwithdelivery: "background"takerelative: true.xandyare measured from the window screenshot's crop origin, as in a focused relative click, and are mapped with the same window coordinate map (window_coordinate_map, split out offocused_window_coordinate_map) to capture pixels.element_index, a semantic selector) andcoordinate_space: "atspi"still have no background route. A plain left click on an element already goes through its AT-SPI action without the pointer, and mapping element bounds to the pen adds a second path with its own scale rules. Drag stays without relative coordinates.window_relative_point. Scroll now uses checked addition, as click did.Docs: click and scroll tool descriptions, the
deliveryfield docs, README (Background keyboard delivery, pointer part), SKILL.md copies, CHANGELOG [Unreleased], and the regenerated Pi tool catalog.Tests: five unit tests in
src/server.rscover the request shape the bridge sends (relative, window target, background), the refusal without a target, elements and AT-SPI points, mapping equal to a focused relative click, and points outside the crop. Before this change a relative background point was refused.Gates run on Linux (dev box): cargo fmt --check, cargo check, clippy -D warnings, cargo test --locked --no-fail-fast, cargo doc -D warnings, mcp_safety_check.py, check_plugins.sh, agnix (0 errors), zod-check, Pi build:check, typecheck and tests, generate_pi_tool_catalog.py --check. Not checked on a live GNOME or KWin desktop.
Note
Medium Risk
Touches live desktop input routing (background pointer/pen) and coordinate mapping; behavior is gated by delivery/relative flags with new refusal paths and tests, but wrong mapping could mis-click unfocused windows.
Overview
Adds
relative: truefor backgroundclickandscroll(delivery: "background"):x/ycan be window screenshot crop coordinates, which the server maps to capture pixels viawindow_coordinate_map(same path as focused relative clicks), then runs the usual background checks (agent seat, GNOME/KWin pen/touch).Behavior: Relative background calls require a window target; missing target or out-of-crop points fail with nothing sent (no focus fallback). Element targets and
coordinate_space: "atspi"still have no background route; drag stays capture-only.Implementation: Shared helpers
background_point,window_relative_point, andPenRequest::relative_to_capture; refactoredbackground_pointer/background_penplumbing and five unit tests inserver.rs.Docs/catalog: CHANGELOG [Unreleased], README, SKILL copies, MCP tool descriptions, regenerated Pi
generated-tools.tshashes.Reviewed by Cursor Bugbot for commit 12dfe85. Configure here.