Skip to content

gui_plan re-ground on miss, GTK 4 and Windows frame bounds, macOS daemon killed before bind - #537

Merged
CMGS merged 11 commits into
mainfrom
batch/1201b
Dec 1, 2026
Merged

CMGS merged 11 commits into
mainfrom
batch/1201b

Conversation

@CMGS

@CMGS CMGS commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups after #535, cut fresh on main (replaces #536, whose base was #535's branch).

  • gui_plan: a grounded point whose hit check fails reads the window list and grounds once more when its window moved; a stale list stops the step.
  • Linux: a GTK 4 window takes its bounds from its X client geometry, grown by _NET_FRAME_EXTENTS and shrunk by _GTK_FRAME_EXTENTS, matched one to one by pid and title.
  • Windows: window bounds are the DWM extended frame bounds, which cua-driver lists and captures; a background click with a button or count goes into its window by that frame. A click with modifiers or the middle button needs the foreground (cua-driver sends a background middle click as UI Automation Invoke).
  • A background click with a button or count reads its window's bounds just before it.
  • Auto input takes a WinUI 3 window's refusal of a background double click to the foreground, and cua-driver's refusal of a background click it would inject at a covered point: cua-driver refuses both before it sends anything.
  • macOS: a daemon that a signal ends before it listens fails the call at once instead of after the 10 s start wait.

Review: two independent reads (correctness, platform contract), a third review to convergence, and the four cleanup lenses. Gates green on macOS and in a Linux arm64 container.

Hardware

The old arm is the previous build with the same cua-driver 0.69.1 (for the covered-point rows, this PR before its last two commits). Each cell ran both arms in interleaved blocks (old, new, new, old).

platform cell new old
Linux X11 re-ground after the window moves 600 px during grounding 2/2 clicks the moved centre stops, no click
Linux X11 GTK 4 window bounds, including a client-side-decorated window, at two positions equal to the pixel to the X client geometry plus frame minus shadow no bounds
Linux X11 desk wait on a GTK 4 window move changed: true after about 1 s times out at 3 s
Linux X11 grounded click into a GTK 4 window refused on both arms (GTK 4 gives no screen position) same
Linux X11 parity set 28/28 equal
macOS daemon killed before it listens fails in 8.6-12.2 ms, 3/3 waits out the 10 s start wait
macOS stale window list (four cells) stops with the stale text; nothing clicked same, except after a grounded miss (no match)
macOS parity and background double click into a covered window equal on every valid slot
Windows 11 desk windows bounds, four windows at 96 DPI equal to the DWM frame and to cua-driver's list GetWindowRect, off by (-7, 0, +14, +7)
Windows 11 background gui_plan right click, plain and after a window move lands in the covered window, at the moved centre after a move stops, nothing sent
Windows 11 background gui_plan click with shift or the middle button stops, nothing sent same
Windows 11 background gui_plan double click on a Win32 button lands with the full double-click sequence; the foreground window does not change stops, nothing sent
Windows 11 auto input: right, double and middle click, WinUI 3 window right lands in the background; WinUI 3 refusal then one foreground click; middle in the foreground every click fronts the window
Windows 11 auto input: double and right click from gui_plan and a desk click double click, at a covered point in a WPF window and in a window of Chromium's class cua-driver refuses before any input, then one foreground click lands, 24/24 stops with that refusal
Windows 11 the same clicks under background input stop with that refusal, nothing sent same

Known issues, unchanged by this PR:

  • On Windows, a posted left press on a Win32 button activates the button's own window inside its thread (WM_ACTIVATE and WM_SETFOCUS within 1 ms). The foreground window does not change. A background desk click double click did this before this PR. A background gui_plan double click, new here, does it too.
  • On Windows, a background desk click with the middle button reaches a Win32 button as UI Automation Invoke, its left-click action.

Not covered on hardware: on macOS a window move within one gui_plan step; on Windows a move inside the click step, record and replay, 150% DPI, and a real Chromium or Electron renderer, Tk or GTK window at a covered point.

CMGS added 8 commits December 1, 2026 08:47
…nds again when its window moved

The move check ran only after the point passed its hit test, so a window that moved past the point during grounding failed that test and the step stopped with "no element matches" without trying the window where it is now. A miss now takes the same read within the existing one re-ground; a window that moves again or closes still stops with the move text.
…tents

GTK 4 answers every AT-SPI screen point and extent with the origin, so its
windows had no bounds and gui_plan's move check before a click at a point
found in a shot skipped them. The window list now gives such a window the
rectangle of the one managed X client of its process and title, grown by
_NET_FRAME_EXTENTS as GTK 3 computes its AT-SPI extents, and none when two
frames or two clients share the process and title.
… its window by the frame cua-driver captures

On Windows the plan's background click with a button or count stopped, or under auto fronted the window, because desk windows gave GetWindowRect bounds, whose invisible resize border put the window-pixel point off the driver's capture. desk windows now gives the DWM extended frame bounds, which cua-driver lists and captures, so the macOS window-pixel path serves Windows too. A click with modifiers keeps the old stop or fronting: cua-driver refuses background modifier clicks on Windows. Linux is unchanged: background gui_plan is refused there, and the driver's background route for such clicks needs /dev/uinput and drops modifiers on GTK.
…call at once

Shuttle.app starts the daemon through LaunchServices, so the client is not its parent and could not see a SIGKILL before bind; each call waited out the 10 s start wait. The daemon writes its pid beside its endpoint as it starts, the client removes that file before open and checks the pid it reads with kill(pid, 0) on each poll.
…s bounds just before it, and a Windows middle click needs the foreground
…ble click to the foreground, since cua-driver sends nothing before it
CMGS added 3 commits December 1, 2026 08:49
… not gui_plan, whose hit test still refuses the window
…a covered point to the foreground, since it sends nothing before it
…r no longer lists says so, and one that cannot reach its window off Windows names no platform it does not reach
@CMGS
CMGS marked this pull request as ready for review December 1, 2026 06:23
@CMGS
CMGS merged commit 4e7d0f6 into main Dec 1, 2026
10 checks passed
@CMGS
CMGS deleted the batch/1201b branch December 1, 2026 12:54
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.

1 participant