Skip to content

refactor: extract StartupInputConfigurator from App.xaml.cs - #606

Merged
ranjeshj merged 1 commit into
openclaw:masterfrom
AlexAlves87:refactor/extract-startup-input
Jun 2, 2026
Merged

ranjeshj merged 1 commit into
openclaw:masterfrom
AlexAlves87:refactor/extract-startup-input

Conversation

@AlexAlves87

@AlexAlves87 AlexAlves87 commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

App.xaml.cs configured mouse-in-pointer input inline in its constructor:
a P/Invoke pair, an env-var opt-out, and the enable logic that turns on
precision touchpad scrolling before WinUI starts. This moves that concern
into a dedicated StartupInputConfigurator.

What changed

  • New Services/StartupInputConfigurator.cs — holds the mouse-in-pointer
    startup configuration: the EnableMouseInPointer / IsMouseInPointerEnabled
    P/Invokes, the OPENCLAW_DISABLE_MOUSE_IN_POINTER opt-out, the truthy-env
    parsing, and the enable-and-verify logic.
  • App.xaml.cs — the constructor now calls StartupInputConfigurator.Configure()
    in the same spot, before InitializeComponent(); the original private methods
    and P/Invoke declarations are removed.

Pure extraction. The class is static with no App state: the moved code read
no instance fields, so nothing is passed in. Logging strings, guard order,
captured values, and caught exceptions (DllNotFoundException,
EntryPointNotFoundException, SEHException) are identical to the original.

Testing

  • dotnet build src/OpenClaw.Tray.WinUI/OpenClaw.Tray.WinUI.csproj -r win-x64
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj

No new tests: this is a behavior-preserving move of process-wide input setup
that was not unit-tested before and is not behavior-changed here.

Proof

Manual run after the extraction. The configurator fires through the new type
on startup, before WinUI initialization, identical to the pre-refactor path:

Captura de pantalla 2026-05-31 001546

[2026-05-31 00:14:32.053] [INFO] [Input] Enabled mouse-in-pointer before WinUI initialization for precision touchpad scrolling.

Notes

No behavior change is intended. The seam (Configure() before
InitializeComponent()) and the enable-and-verify logic are preserved exactly.

Addresses part of #554.

Co-Authored-By: Claude Opus 4.8 [email protected]

Move the mouse-in-pointer startup configuration out of the App
constructor into a dedicated StartupInputConfigurator helper. The
P/Invoke declarations, the OPENCLAW_DISABLE_MOUSE_IN_POINTER guard,
the env-var parsing and the configuration logic all move together; the
constructor now calls StartupInputConfigurator.Configure() in the same
spot, before InitializeComponent(), preserving startup ordering.

Pure extraction, no behavior change. Logging strings, guard order,
captured values and caught exceptions are identical to the original.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@clawsweeper

clawsweeper Bot commented May 30, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 6:30 PM ET / 22:30 UTC.

Summary
This PR moves the mouse-in-pointer startup configuration from App.xaml.cs into a new StartupInputConfigurator service while keeping the startup call before InitializeComponent().

Reproducibility: not applicable. this is a refactor PR rather than a reported bug. Source inspection and the provided startup log are the relevant checks.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Add the AGENTS-required full validation results to the PR body if CI does not already cover them.

Risk before merge

  • [P1] The PR body does not report the full AGENTS.md validation set: ./build.ps1, shared tests, and tray tests.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow extraction after CI or maintainer validation confirms the full repo build and shared/tray tests pass.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair lane is needed; there is no actionable code defect, and the remaining work is ordinary validation and maintainer review.

Security
Cleared: The diff only moves existing startup P/Invoke and env-var handling into a new internal class and adds no dependency, credential, permission, or supply-chain surface.

Review details

Best possible solution:

Land the narrow extraction after CI or maintainer validation confirms the full repo build and shared/tray tests pass.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this is a refactor PR rather than a reported bug. Source inspection and the provided startup log are the relevant checks.

Is this the best way to solve the issue?

Yes; moving this self-contained startup input concern into a service while preserving the pre-InitializeComponent() call is a narrow maintainable solution.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against eb06fba21c44.

Label changes

Label changes:

  • add P3: This is a low-risk cleanup/refactor with no intended user-facing behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-change manual startup run with a log line showing the input configurator fired before WinUI initialization.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes an after-change manual startup run with a log line showing the input configurator fired before WinUI initialization.

Label justifications:

  • P3: This is a low-risk cleanup/refactor with no intended user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body includes an after-change manual startup run with a log line showing the input configurator fired before WinUI initialization.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-change manual startup run with a log line showing the input configurator fired before WinUI initialization.
Evidence reviewed

What I checked:

Likely related people:

  • Scott Hanselman: Recent App.xaml.cs hardening touched the same large startup surface, and history shows a prior App cleanup PR merged by Scott. (role: recent area contributor and merger; confidence: medium; commits: 0d4fcbd50ad5, 014e459ba540; files: src/OpenClaw.Tray.WinUI/App.xaml.cs, src/OpenClaw.Tray.WinUI/Services)
  • AlexAlves87: Independent of authoring this PR, prior merged history shows Alex extracting App.xaml.cs concerns into services. (role: prior App refactor contributor; confidence: medium; commits: 565fba8feffa, 014e459ba540; files: src/OpenClaw.Tray.WinUI/App.xaml.cs, src/OpenClaw.Tray.WinUI/Services/TrayMenuStateBuilder.cs)
  • Ranjesh Jaganathan: Recent history includes App/services maintenance and warning-clean build work near the same tray application surface. (role: adjacent App and services contributor; confidence: low; commits: a727197dd709, f35328e12be1; files: src/OpenClaw.Tray.WinUI/App.xaml.cs, src/OpenClaw.Tray.WinUI/Services)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels May 30, 2026
@ranjeshj
ranjeshj merged commit bfeb3b5 into openclaw:master Jun 2, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants