Skip to content

Unify App process scope and foreground-window semantics - #436

Merged
crowecawcaw merged 4 commits into
mainfrom
codex/implement-fix-for-issue-426
Sep 18, 2026
Merged

crowecawcaw merged 4 commits into
mainfrom
codex/implement-fix-for-issue-426

Conversation

@crowecawcaw

Copy link
Copy Markdown
Contributor

Motivation

  • Make App a consistent process-scoped abstraction across platforms so callers see one logical application per process while still exposing every native registration where it matters.
  • Fix foreground-window tagging to use the provider's true foreground identity and avoid misclassifying macOS key panels or Linux multi-registration cases.

Description

  • Collapse same-PID native registrations into a single public App view by deduplicating list_apps() results (process-scoped enumeration) and adding fn app_roots(&self, app: &ElementData) -> Result<Vec<ElementData>> to Provider so backends can expose every native root for a process.
  • Make App::windows_with / App::children / App::tree traverse all native roots for a process, merge windows by stable identity, and avoid duplicate listings; add dedup_processes and update tag_focused to use the provider's focused_app() identity rather than a pid-only heuristic.
  • Extend Locator with process-scoped resolution (new_for_app) and support for searching across multiple native roots with stable-identity deduplication to preserve doc-order and :nth semantics.
  • Linux (AT-SPI): add find_apps_by_pid and app_roots implementations and update subscribe_for_pid to install D-Bus match rules for every AT-SPI registration owned by the process and to preserve the originating sender bus when materializing events; EventContext now accepts multiple sender_buses and dispatches only signals from those senders.
  • macOS (AX): change active mapping from AXMain to the frontmost application's focused (key) window by reading AXFocusedApplication/AXFocusedWindow to correctly mark window active when key differs from main.
  • Documentation: update the Linux accessibility quirks page to describe the migration from registration-scoped to process-scoped App and how callers should select windows/registrations now.

Testing

  • Ran cargo test -p xa11y-core --lib, which passed all unit tests in xa11y-core (283 tests, all OK).
  • Ran RUSTFLAGS=-Dwarnings cargo check -p xa11y-core -p xa11y-linux -p xa11y-macos, which succeeded (no warnings-as-errors).
  • Ran cargo xtask check-macos-ffi, which passed the macOS FFI exception-safety check.
  • Ran cargo xtask fmt --check, which passed formatting checks.
  • Ran cargo xtask check (workspace pre-PR checks); the tooling completed its linting, bindings-parity, format and many checks successfully, but full workspace test/linking failed where the environment lacks system dependencies: the build/link stage for xa11y-linux/fuzz targets failed due to missing libxkbcommon (linker error), and cargo xtask test-integ could not run because the runner lacks Xvfb/AT-SPI daemons and other system fixtures; these are environmental, not functional, failures in CI-like harnesses.
  • cargo xtask lint-docs could not complete because vale is not installed in the environment; prose linting should be verified in CI or locally with vale available.

If you want, I can open follow-ups to (1) add CI notes about the new Provider::app_roots contract for downstream providers, and (2) prepare a changelog/migration note for bindings/docs that call out the behavioral change from registration-scoped to process-scoped App objects.


Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant