Skip to content

Proposal: smooth launch, don't show a Xaml Window until the first frame is rendered #11677

Description

Title

Smooth launch: synchronize showing a Xaml Window with its first rendered frame.

Summary

A WinUI 3 Window becomes visible before Xaml has rendered anything into it, so the frame animates in empty and the content pops in after. Xaml should hold the window back until the first frame is ready, the way UWP Xaml used to.

Rationale

  • Every WinUI 3 app flickers on launch today, and it is the very first thing users see.
  • UWP Xaml did not have this problem, so this is a regression for anyone moving to WinUI 3. Some of the plumbing is still in the tree (JupiterWindowActivationState, CJupiterWindow::NotifyFirstFramePending and NotifyFirstFrameDrawn), but NotifyFirstFrameDrawn early returns when there is no CoreWindow, so only UWP ever got the deferred activation.
  • It is needed to unblock the GDI redirection surface optimization from Proposal: let WinUI 3 windows skip the GDI redirection surface #11523 (PR Add XamlChangeId.SkipWindowRedirectionSurface to skip the window's GDI redirection surface #11587). Skipping the redirection surface also removes the themed WM_ERASEBKGND fill that was partly covering the gap, so the flicker becomes more obvious. The flicker is there either way, that change just stops hiding it.

Scope

Capability Priority
A Xaml Window only becomes visible after its first frame has been rendered Must
Apps get this without having to change any code Must
There is a fallback so a window still shows if the first frame never arrives Must
Windows shown after launch, not just the first one, behave the same way Should
Apps can opt out if they depend on the current timing Could
Providing a splash screen or any launch UI of its own Won't

Important Notes

Videos are from #11587 (comment).

With the GDI redirection surface (today's default), the themed WM_ERASEBKGND fill partly covers the gap:

launch-with-redir-2

Without it, the empty window frame animating in is plainly visible:

launch-no-redir-2

Related: #11523, #11587, #7892.

Open Questions

  • Should this be on by default, or start behind a XamlChangeId opt-in?
  • Sould there be some fallback be if the first frame takes too long?
  • Is hooking Window.Activate enough, or does this also need to cover the Microsoft.UI.Windowing AppWindow.Show paths?

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions