Repository navigation
fix(titlebar): Make the WinUI TitleBar control work on Skia desktop - #25190
Conversation
Region rects were hit-tested in Dictionary order, so a Caption rect registered before an overlapping Passthrough rect (as SetTitleBar + TitleBar do) won and title bar buttons started a window drag. Hit-test in a fixed order with Passthrough first, as WinUI does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
TitleBar resolves its window through XamlRoot.ContentIslandEnvironment, which threw NotImplementedException on Skia, aborting OnApplyTemplate (only the background rendered) and crashing window show when Content was set. Implement the APIs it depends on: - XamlRoot.ContentIslandEnvironment / ContentIslandEnvironment.AppWindowId, derived from the host window - InputActivationListener (GetForWindowId, State, InputActivationChanged), fed from window activation - AppWindowTitleBar.LeftInset/RightInset, reported by WindowChrome from its caption buttons; TitleBar refreshes its padding when they change (WinUI's TODO 50724421), as they are only known after chrome layout Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…ivationListener on Skia Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
WinAppSDK sync generator drift detected on
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Creating and closing a secondary Window fail-fasts the WinAppSDK runtime test app; match the existing Given_AppWindow secondary-window tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
|
Claude finished @MartinZikmund's task in 26s —— View job Review of #25190: TitleBar on Skia desktopVerdict: ship. I found nothing blocking. I read the diff by inspection only. I did not build the code or run the tests. Issues by severity: 0 blocking, 0 major, 2 minor/nit. I posted no inline comments. What I checked
Minor / nits (optional)
Cross-cutting notes
|
UpdatePadding moves the TitleBar's interactive parts without resizing it, and resizing is what refreshes the Passthrough and Icon regions. After an inset or FlowDirection change the regions stayed where the parts used to be, so clicks on the back button or headers could start a window drag. Refresh them after the next layout pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…anges Co-Authored-By: Claude Opus 5.5 <[email protected]>
GetScreenRect transformed only the element's origin, which under RightToLeft is its right edge, so the SetTitleBar Caption rect (and the caption button rects) landed past the element, even outside the window. Use TransformBounds instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…RightToLeft Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Claude finished @MartinZikmund's task in 27s —— View job Review of #25190: TitleBar on Skia desktopVerdict: ship. I read the diff by inspection only. I did not build the code or run the tests. Issues by severity: 0 blocking, 0 major, 2 minor/nit. Both are posted as inline comments. Cross-cutting notes
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25190/wasm-skia-net9/index.html |
|
The build 238919 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: closes #21714, related #19392, #24878
PR Type:
🐞 Bugfix
What changed? 🚀
The ported WinUI
TitleBarcontrol did not work on Skia desktop. On Win32, custom title bar buttons also could not be clicked.Root causes
TitleBarcrashed onXamlRoot.ContentIslandEnvironment.TitleBar.GetAppWindowId()readsXamlRoot.ContentIslandEnvironment.AppWindowId, which was[NotImplemented]on Skia and threw. Effects:OnApplyTemplateaborted before anyGoToState, so every lazy template part stayed anElementStuband only the background rendered.Contentwas set,OnContentLayoutUpdatedthrew insideWin32WindowWrapper.ShowCore, so the window never appeared.InputActivationListener.GetForWindowId(used onLoaded)AppWindowTitleBar.LeftInset/RightInset(used byUpdatePadding)Win32WindowWrapper.NonClientAreaHitTestreturned the first region inDictionaryorder.SetTitleBarregisters the whole title bar as a Caption region beforeTitleBaradds its Passthrough holes, so Caption won and clicks on title bar buttons started a window drag. WinUI's design depends on Passthrough taking precedence:CWindowChrome::SetDragRegionregisters the full element as Caption, andTitleBar::UpdateDragRegionadds Passthrough rects on top of it.Fixes
XamlRoot.ContentIslandEnvironmentnow returns aContentIslandEnvironmentwhoseAppWindowIdis the host window'sAppWindow.Id, or null when there is no host window. This mirrorsXamlRoot::get_ContentIslandEnvironmentImpl, which returns the content root's environment.ContentIsland, so the environment is derived from the host window.DisplayId,DisplayScaleand the events remain[NotImplemented].InputActivationListener:GetForWindowId,StateandInputActivationChangedare implemented and fed from window activation. The listener is cleared on ALC window close, alongside the other per-WindowIdregistries.AppWindowTitleBar.LeftInset/RightInsetare now real.WindowChromereports the caption-button container width in physical pixels;LeftInsetstays 0 because Uno draws the caption buttons on the right.TitleBarsubscribes to an internal inset-changed event, which implements WinUI's ownTODO 50724421: Bind to appTitleBar Left and Right inset changed event.WinUI parity note
WinUI's
TitleBar::UpdatePaddingpasses the physical-pixelRightInsetdirectly toGridLengthHelper::FromPixels. The right padding column is thereforeRightInsetDIPs wide, which is wider than the caption buttons at scales above 100%.A WinUI 2.5.1 app at 250% reports
RightInset = 345, and its RightHeader ends 393 DIP from the right edge. Uno now reports the sameRightInset = 345and lays out the same way, so this port keeps WinUI's behaviour instead of "fixing" it.Validation
Given_TitleBar: template parts realized; back and pane toggle raise their events; interactive content is registered as Passthrough; RightHeader avoids the caption buttons.Given_InputNonClientPointerSource: a realWM_NCHITTESTsent to the HWND returnsHTCLIENTinside a Passthrough hole andHTCAPTIONoutside it.Given_InputActivationListener, andGiven_XamlRoot.When_Loaded_ContentIslandEnvironment_Matches_AppWindow.NotImplementedException, orHTCAPTIONreturned whereHTCLIENTwas expected. The inset test was added afterwards.Microsoft_UI_Windowing,Microsoft_UI_Input,Given_Window,Given_XamlRootandGiven_TitleBarclasses: 32 passed. 3Given_Windowtheme tests fail, and they fail identically on unmodified master on the same machine (the OS is in dark mode).Window.ExtendsContentIntoTitleBarandSetTitleBar(titleBar), with aTitleBarcontaining IconSource, Title, Subtitle, back and pane toggle buttons, anAutoSuggestBoxas Content and a button plusPersonPictureRightHeader. Everything was driven with real mouse input through UIA tooling:PaneToggleRequestedfires.BackRequestedfires.AutoSuggestBoxtakes typing and shows suggestions.Not covered
ExtendsContentIntoTitleBarremoves decorations, but there is no nativeINativeInputNonClientPointerSource, so title bars are not draggable there. The TitleBar control itself no longer throws on X11 (the fixes are platform-agnostic), but this was not runtime-verified on Linux.LeftInset) is not modelled.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7