[Bug]: element clicks on a second display take about 9 s each, even with the agent cursor disabled
Primary area
Cua Driver
Summary
Every element click on a Calculator window on a second display takes about 9 seconds, including consecutive clicks on neighbouring buttons, and turning the agent cursor off with set_agent_cursor_enabled does not change that. Setting glide_duration_ms to 150 brings each click down to about 1.4 s.
Reproduction
- Put Calculator's window on a second display. Here it is a
CGVirtualDisplayplaced left of and below the main display. - Start
cua-driver mcp, callget_window_statefor Calculator, thenclickthe element tokens for Add, Equals and Add again, timing each call. - In a new connection, call
set_agent_cursor_enabled {"enabled": false}, confirm it withget_agent_cursor_state, and repeat step 2.
It happens on every click.
Expected behavior
With the cursor disabled, a click does not wait for a cursor animation (animate_cursor_to says a disabled cursor never animates), and an element click on this window finishes in well under a second.
Actual behavior
| Connection | Add | Equals | Add |
|---|---|---|---|
| default cursor | 9.18 s | 9.45 s | 9.02 s |
set_agent_cursor_enabled {"enabled": false} first |
9.25 s | 9.13 s | 9.09 s |
get_agent_cursor_state in the second connection reports "enabled": false and "glide_duration_ms": 0.0. With set_agent_cursor_motion {"glide_duration_ms": 150} instead, the same clicks take about 1.4 s. The buttons are pressed every time, and an AXPress sent to the same button directly takes about 0.01 s. I don't know where the wait comes from while the cursor is disabled.
Environment
Cua Driver 0.30.1, MCP over stdio against the LaunchAgent daemon in unrestricted mode. macOS 27.0 (26A428), Apple silicon, Stage Manager on. Calculator. main at 1fadc40 has the same click path.
Evidence
animate_cursor_to returns early for a disabled cursor:
https://github.com/trycua/cua/blob/1fadc40b3e40e042590c9f63cf8ef837a6263258/libs/cua-driver/rust/crates/platform-macos/src/cursor/overlay.rs#L346-L387
The element click path awaits it before pressing: https://github.com/trycua/cua/blob/1fadc40b3e40e042590c9f63cf8ef837a6263258/libs/cua-driver/rust/crates/platform-macos/src/tools/click.rs#L598-L604
Workaround and additional context
set_agent_cursor_motion {"glide_duration_ms": 150} on each session: about 1.4 s a click.
Submission checks
- [x] I searched for duplicate issues and active pull requests.
- [x] This issue describes a single problem.
- [x] I removed credentials, private data, sensitive screenshots, and vulnerability details from this public report.
Hello, I’d like to take this up. Could you please assign this issue to me?
Approach:
- Update
seed_start_in_mapandanimate_cursor_toacross the platform overlay modules (platform-macos,platform-windows,platform-linux) to check runtime cursor visibility (rs.core.visible/set_agent_cursor_enabled), not just the launch-timers.core.cfg.enabledflag, so disabled cursors return immediately without seeding or waiting on a glide animation. - Replace the
pos.0 < -50.0/pos.0 < -100.0coordinate threshold checks incursor-overlay(RenderStateCore) and the platform overlays with explicit placement tracking so valid negative coordinates on a secondary display (placed left of or above the primary display) are not mistaken for the initial unplaced(-200, -200)sentinel and re-clamped to the main screen on every click.
Validation / Testing:
- Unit tests: Add tests in
cursor-overlayand the platform overlay modules covering runtime-disabled cursor short-circuiting (set_agent_cursor_enabled {"enabled": false}) and consecutive clicks/glides at negative display coordinates (x < -50.0,y < -50.0) without re-seeding to the primary screen. - Multi-monitor desktop testing: Test locally on Windows connected to an external second monitor positioned at negative coordinates (left of the primary display) by running consecutive element clicks with the agent cursor both enabled and disabled (
set_agent_cursor_enabled {"enabled": false}) to verify click latency and cursor state, alongside the macOS/Linux CI checks.
PR #4695 addresses the disabled-cursor delay reported here. We reproduced it on Cua Driver 0.34.0: after disabling the cursor and setting a five-second animation, an exact button click still took 5.557 seconds. The button received the click.
The fix checks whether the cursor is currently visible before waiting for its animation. The public MCP regression fails on the release and passes on the PR's final commit. With the cursor disabled, the measured native form took 23% less time and the embedded-browser form took 18% less time.
This PR covers the disabled-cursor wait only. It does not resolve the separate negative-coordinate placement problem described in the proposed scope above. Windows desktop confirmation and the full canonical matrix are pending.