Skip to content

refactor(window)!: Retype WindowActivationState to WinUI (BC13) - #23745

Merged
Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc13-windowactivationstate-retype
Jul 16, 2026
Merged

Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc13-windowactivationstate-retype

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: #8339

PR Type:

💬 Other... Breaking change (API alignment with WinUI)

What changed? 🚀

Microsoft.UI.Xaml.WindowActivatedEventArgs.WindowActivationState was typed as the Uno-only Windows.UI.Core.CoreWindowActivationState. WinUI types it as Microsoft.UI.Xaml.WindowActivationState. This PR (BC13 of the Phase 5 breaking-changes wave) retypes the property (and the internal constructor) to the WinUI enum.

The two enums are value-identical (CodeActivated=0, Deactivated=1, PointerActivated=2), so no runtime behaviour changes — only the public type.

Details:

  • New hand-written enum Microsoft.UI.Xaml.WindowActivationState (src/Uno.UI/UI/Xaml/Window/WindowActivationState.cs), available on all platforms. The previous definition was a generated stub gated to __SKIA__ || __NETSTD_REFERENCE__ only, so it couldn't back a cross-platform property. Following the "move out of Generated/" convention, the enum is now hand-written; the generated stub is set to the disabled #if false form the sync generator emits for hand-written enums (mirrors ElementTheme/FocusState).
  • WindowActivatedEventArgs — property + internal ctor retyped.
  • Producers (BaseWindowImplementation, Window.alc.cs) — the internal/native plumbing stays on CoreWindowActivationState; the value is cast to WindowActivationState at the public-args boundary (value-preserving).
  • Consumers — WindowChrome, DatePicker (Uno-specific activation hook), MacOSWindowHost, the Given_AlcContentHost ALC tests, and the WindowActivationTests sample updated to the new type / value-preserving cast.
  • Parity shim removed — the SymbolMatchingHelpers special-case that forced the WinUI-parity check to pass for this property (// TODO: Match API with WinUI) is deleted; the check now validates the real (matching) shape.

Validation:

  • Compile: SamplesApp.Skia.Generic (net10.0 Skia) builds clean, transitively compiling Uno.UI, Uno.UI.RuntimeTests, samples, and the Skia runtimes (incl. Uno.UI.Runtime.Skia.MacOS). Reference build validated separately (the API-contract compilation). Native heads are safe by construction — the enum is now defined unconditionally, so no native head loses the type. (Native Android/iOS not built locally; stated, not implied.)
  • Runtime (Skia Desktop): Given_AlcContentHost activation tests pass — they raise Window.Activated, read args.WindowActivationState, and assert CodeActivated, exercising the producer cast end-to-end. Value-identical retype ⇒ pass-after regression guards.
  • The Uno.WinAppSDKSyncGenerator project targets .NET 11 (SDK not available locally); the shim removal is a mechanical block deletion — CI's parity gate validates it.

PackageDiffIgnore.xml (6.5 baseline) gets one entry for the retyped getter (get_WindowActivationState() return type changed ⇒ old signature reads as removed).

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample — N/A: not a behaviour change; existing Given_AlcContentHost activation tests exercise the path and were run as regression guards.
  • 📚 Docs have been added/updated — N/A (migration note below).
  • 🖼️ Validated PR Screenshots Compare Test Run results — N/A (no visual change).
  • ❗ Contains NO breaking changes — intentionally left unchecked; this is a breaking change (see below).
  • 👀 Reviewed 2 other open pull requests

Breaking change — impact & migration path

  • Impact (source-breaking): WindowActivatedEventArgs.WindowActivationState now returns Microsoft.UI.Xaml.WindowActivationState instead of Windows.UI.Core.CoreWindowActivationState. Code that assigned it to a CoreWindowActivationState variable or compared against CoreWindowActivationState.* members no longer compiles.
  • Migration: Use Microsoft.UI.Xaml.WindowActivationState and its CodeActivated/Deactivated/PointerActivated members. The enum values are unchanged, so a value-preserving cast ((CoreWindowActivationState)args.WindowActivationState) bridges any code that must stay on the legacy type. This matches WinUI.

@github-actions github-actions Bot added platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform area/build Categorizes an issue or PR as relevant to build infrastructure area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Jul 13, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222106 found UI Test snapshots differences: skia-linux-screenshots: 73, skia-windows-screenshots: 86

Details
  • skia-linux-screenshots: 73 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DataTransferManager.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DoubleImageBrushInList.png-dark
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Gamepad_Enumeration.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ColorPickerSample.png
    • CompositionPath.png
    • Basics Pivot Test.png
    • Buttons.png-dark
    • EllipsemaskingEllipseGrid.png
    • Buttons.png
    • Gamepad_CurrentReading.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
  • skia-windows-screenshots: 86 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Gamepad_Enumeration.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual.png-dark
    • Gamepad_CurrentReading.png-dark
    • Image_UseTargetSize.png-dark
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • ImageBrushInList.png-dark

@MartinZikmund

Copy link
Copy Markdown
Member

@Xiaoy312 CI has some issue, but otherwise good to go

@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc13-windowactivationstate-retype branch from 014a9a0 to c673643 Compare July 16, 2026 15:02
@Xiaoy312
Xiaoy312 enabled auto-merge July 16, 2026 15:02
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222661 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 98

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ElementLevelTheme.png-dark
    • Gamepad_CurrentReading.png-dark
    • DataTransferManager.png
    • ButtonClippingTestsControl.png-dark
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DoubleImageBrushInList.png
    • Image_Margin_Large.png-dark
    • EllipsemaskingEllipseGrid.png
    • DisplayInformation.png-dark
    • DynamicFont.png
    • Examples.png-dark
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Image_AnimatedWebP.png
    • ImageBrush_Stretch.png-dark
  • skia-windows-screenshots: 98 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ApplicationViewMode.png-dark
    • ColorPickerSample.png-dark
    • CalendarView_Theming.png-dark
    • ColorPickerSample.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png

WindowActivatedEventArgs.WindowActivationState was typed as the Uno-only
Windows.UI.Core.CoreWindowActivationState. WinUI types it as
Microsoft.UI.Xaml.WindowActivationState. Retype the property and internal
ctor to the WinUI enum (values are identical: CodeActivated/Deactivated/
PointerActivated = 0/1/2).

- Hand-write Microsoft.UI.Xaml.WindowActivationState cross-platform (was a
  Skia/Reference-only generated stub, which cannot back a cross-platform
  property); disable the generated stub like ElementTheme/FocusState.
- Internal/native plumbing stays on CoreWindowActivationState; cast to the
  public enum at the args boundary.
- Update consumers (WindowChrome, DatePicker, MacOSWindowHost, ALC tests,
  sample) and drop the SymbolMatchingHelpers parity shim so the WinUI-parity
  check now validates the real shape.
- PackageDiffIgnore (6.5) entry for the retyped getter.

BC13 of the 7.0 breaking-changes rollup (#8339).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc13-windowactivationstate-retype branch from c673643 to 7d803ee Compare July 16, 2026 19:52
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222733 found UI Test snapshots differences: skia-linux-screenshots: 67, skia-windows-screenshots: 100

Details
  • skia-linux-screenshots: 67 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • EllipsemaskingEllipseGrid.png
    • Gamepad_Enumeration.png-dark
    • Examples.png-dark
    • Examples.png
    • DisplayInformation.png-dark
    • Image_AnimatedWebP.png
    • BitmapIcon_Foreground.png
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DynamicFont.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Image_Margin_Large.png-dark
    • ElementLevelTheme.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrush_Stretch.png-dark
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
  • skia-windows-screenshots: 100 changed over 2392

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • DisplayInformation.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • Examples.png
    • Gamepad_CurrentReading.png-dark
    • ExpanderColorValidationPage.png-dark
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • Image_UseTargetSize.png-dark
    • ColorPickerSample.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • HierarchicalNavigationViewMarkup.png-dark

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 222733 has failed on Uno.UI - CI.

@Xiaoy312
Xiaoy312 merged commit bced91b into feature/breakingchanges Jul 16, 2026
68 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260713/bc13-windowactivationstate-retype branch July 16, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants