Skip to content

feat(windowing): Custom title bars on macOS and caption button colors on Win32 - #25203

Merged
MartinZikmund merged 26 commits into
masterfrom
dev/mazi/titlebar-macos
Oct 14, 2026
Merged

MartinZikmund merged 26 commits into
masterfrom
dev/mazi/titlebar-macos

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #25247, closes #24065; related #15789, #24864, #19392, #22420, #21714

PR Type:

✨ Feature

What changed? 🚀

On Skia macOS, custom title bars did nothing:

  • ExtendsContentIntoTitleBar only logged "customization is not supported": AppWindowTitleBar.IsCustomizationSupported() was Windows-only.
  • SetTitleBar and InputNonClientPointerSource regions were ignored, because the host had no INativeInputNonClientPointerSource.
  • LeftInset stayed 0.
  • Window.Activated never reported Deactivated or re-activation.

The WinUI TitleBar control made working on Skia by #25190 therefore could not act as a real title bar on macOS. This PR adds that, following WinUI semantics and keeping the native traffic lights.

It also makes the AppWindowTitleBar button colors work on Skia Win32, where Uno draws the caption buttons in XAML (see Caption button colors on Win32).

Before / after on macOS

Feature Before Now: implementation Validated how
ExtendsContentIntoTitleBar Warning, no effect NSWindowStyleMaskFullSizeContentView, transparent titlebar, hidden title. WindowChrome skips its XAML min/max/close buttons via the new NativeWindowWrapperBase.HasNativeCaptionButtons Runtime test (no XAML caption regions); CI native build; on-device pending
Traffic lights n/a Kept native. Vertically centered in AppWindowTitleBar.Height (Standard 32 / Tall 48), using Electron's trafficLightPosition technique. Re-applied after AppKit relayouts: resize, key change, full-screen exit, title and style changes On-device only
PreferredHeightOption.Collapsed n/a Hides the traffic lights, insets become 0 (as WindowChrome does for its XAML buttons) Runtime test
LeftInset / RightInset 0 / 0 LeftInset = traffic-light width plus matching trailing spacing, in physical px like WinUI. RTL system layouts put it in RightInset. 0 in full screen Unit tests (math), runtime test (LeftInset > 0, RightInset == 0, reset on un-extend)
SetTitleBar / InputNonClientPointerSource Ignored MacOSWindowWrapper implements INativeInputNonClientPointerSource on the shared NonClientRegionSet, which has the same Passthrough-first precedence as the #25190 Win32 fix Unit tests, runtime tests through the native hit-test entry point
Window drag n/a Left press resolving to Caption/Icon calls performWindowDragWithEvent: Runtime test (managed side); drag itself on-device only
Double-click on caption n/a Follows Desktop & Dock > Double-click a window's title bar (AppleActionOnDoubleClick: Maximize/Fill → zoom:, Minimize, None; legacy AppleMiniaturizeOnDoubleClick) On-device only
Default drag region (no SetTitleBar) n/a Full-width strip of AppWindowTitleBar.Height, matching WinUI's default and Win32's GetDefaultCaptionRegionRect Runtime test
Clicks on XAML in the top ~28pt n/a AppKit's transparent titlebar view would otherwise start its own drag or zoom on top of XAML buttons, so presses that hit it go to the content only. Presses on the traffic lights go to AppKit only On-device only
Activation Activated fired once windowDidBecomeKey/windowDidResignKey → ActivationState (PointerActivated when a mouse-down made the window key). This feeds Window.Activated, InputActivationListener and TitleBar's inactive visuals Runtime test (managed handler); real key switching on-device
ContentIslandEnvironment — Already platform-agnostic from #25190 Existing tests
AppWindow.Size / ClientSize / Position 0 until the first resize/move; stale after a scale change The wrapper set RasterizationScale after converting the initial size/position. It now sets it first and recomputes both on scale change Runtime test Given_AppWindow.When_Activated_ClientSize_Is_Physical_Content_Size (found when CI showed the default drag strip as 0 px wide)
IsMinimizable / IsMaximizable / IsResizable = false Minimize/zoom buttons changed inconsistently (zoom explicitly, minimize only via the style mask) The buttons are disabled (greyed), not hidden, like other macOS apps. Their enabled state is set explicitly and re-applied when AppKit recreates them (title bar toggled). Zoom needs both resizable and maximizable Runtime test reads the native button state
SetBorderAndTitleBar(true, false) Dropped NSWindowStyleMaskTitled: no rounded corners, no native frame Keeps the native frame (shadow, corners, resize) and hides the title bar and all three traffic lights, with content under them and LeftInset 0, so apps draw their own caption buttons like on Windows. (false, false) still makes the window untitled. Toggling at runtime re-applies and re-reports the insets, so TitleBar re-pads Runtime tests: buttons hidden, LeftInset 0 and back, content grows under the hidden bar, an app Caption region drags
XAML content size after extending / hiding the title bar Content kept its pre-change size: the style change raises no windowDidResize, and the paused Metal view does not report its new drawable size The new content size is reported explicitly after every title bar style change Runtime test: content grows when the title bar is hidden (caught by CI)
Presenter commands for custom XAML caption buttons Minimize()/Maximize() used performMiniaturize:/performZoom: and Close() used performClose:. Those need a visible button and only beep without one; performZoom: also un-zoomed an already zoomed window miniaturize:, zoom: (only when not already zoomed), and for Close() with no usable close button the delegate is asked and then close is called Runtime test: Maximize/Restore/Minimize/Restore and Close with the title bar hidden
AppWindowTitleBar.Button*Color, BackgroundColor, ForegroundColor, Inactive*Color, IconShowOptions Getters threw NotImplementedException on every Skia target, Win32 included, so shared title bar code crashed Stored values on all Uno targets. Not applied on macOS: there is no API to recolor the traffic lights. On Win32 the Button*Color properties are applied (next section) Runtime test (all platforms)

Caption buttons on macOS: native, not XAML

On Win32, Uno draws min/max/close itself in XAML (WindowChrome), because Windows stops drawing them once the content extends into the title bar. macOS keeps drawing the native traffic lights over a full-size, transparent-titlebar content view, so this PR keeps them. Drawing them in XAML would lose the group hover glyphs, the zoom long-press tiling menu, option-click, full screen, accessibility and appearance changes.

  • WindowChrome is shared, so its template still contains the XAML caption buttons. On macOS (HasNativeCaptionButtons) they stay Collapsed and are never registered as non-client regions or insets; a runtime test asserts both.
  • The native traffic lights are never subject to region hit-testing: presses on them go to AppKit only.
  • To fully customize the buttons with the same code as on Windows, call SetBorderAndTitleBar(true, false), draw XAML buttons and call Minimize()/Maximize()/Restore()/Close(). Or keep the native buttons and use IsMinimizable/IsMaximizable/IsResizable to disable them.

Caption button colors on Win32

On Skia Win32, WindowChrome draws min/max/close in XAML while the content extends into the title bar. Those buttons now follow the AppWindowTitleBar button colors, matching how WinAppSDK's system caption buttons handle them:

Behavior WinUI / WinAppSDK source Uno
ButtonForegroundColor / ButtonBackgroundColor while active AppWindowTitleBar docs Applied
ButtonInactiveForegroundColor / ButtonInactiveBackgroundColor while deactivated AppWindowTitleBar docs Applied from Window.Activated
ButtonHover* / ButtonPressed* AppWindowTitleBar docs Applied from the button's PointerOver / Pressed states
Close button hover/pressed keep system colors "Title bar customization" docs Close keeps CloseButton* theme brushes
null = default "Title bar customization" docs Falls back to the WindowCaption* theme resources and follows theme changes
Alpha only honored for background colors "Title bar customization" docs Foreground alpha forced to 255
Changes apply live — AppWindowTitleBar raises an internal change event
First Window.ExtendsContentIntoTitleBar = true sets ButtonBackgroundColor and ButtonInactiveBackgroundColor to Transparent, once per window CWindowChrome::ConfigureWindowChrome Same, on all platforms

The WindowCaptionButton template no longer sets colors from its visual states. Those setters targeted a Path element that doesn't exist in Uno's FontIcon-based template, so hover/pressed glyph colors (white glyph on the red Close hover) were never applied. WindowChrome now sets Background/Foreground per state in code.

Not applied yet on Win32: BackgroundColor, ForegroundColor, InactiveBackgroundColor, InactiveForegroundColor (the title bar itself is app content when extended) and IconShowOptions.

Not applicable on macOS (documented, no-op)

  • AppWindowTitleBar.Button*Color, BackgroundColor/ForegroundColor, IconShowOptions: settable and readable, but not applied. The traffic lights and the system title bar are drawn by AppKit, with no recoloring API.
  • NonClientRegionKind.Close/Minimize/Maximize and the border kinds: no macOS equivalent over the content, so they stay client. Icon drags like Caption, because macOS has no system menu.

Docs

doc/articles/features/windows-ui-xaml-window.md: support notes now include macOS, plus "macOS specifics" and "Caption button colors on Windows" sections.

Shared code

  • refactor(input): Win32's region dictionary and precedence loop moved into Uno.UI.UI.Input.Internal.NonClientRegionSet, used by both hosts.
  • MacOSTitleBarMath holds the inset and region→action math as a pure helper, linked into Uno.UI.UnitTests like the Win32/X11 pointer math.

WinUI parity note

As found in #25190, WinUI reports insets in physical pixels and TitleBar.UpdatePadding uses them as DIPs. On a 2x Retina screen the TitleBar's left padding column is therefore about twice the traffic-light width (~132 DIP). This is kept for parity, the same way Win32 at 250% is.

Validation

  • Unit tests (Windows): Given_NonClientRegionSet and Given_MacOSTitleBarMath, 19/19 pass.
  • Win32 regression run (real SamplesApp net10.0-desktop): Given_InputNonClientPointerSource (including the real WM_NCHITTEST test on the refactored path), Given_InputActivationListener, Given_TitleBar, Given_AppWindow, Given_AppWindowTitleBar. 14 passed; the macOS-only tests skip.
  • New Win32 caption color runtime tests (Given_AppWindowTitleBar, Skia Win32, all pass locally on net11.0-desktop): colors set/changed/reset to null (alpha handling), hover and pressed colors with Close keeping system colors, inactive colors after another window activates. When_Window_Extends_Caption_Button_Backgrounds_Default_To_Transparent runs on Win32, macOS and native WinUI. The existing Given_TitleBar tests still pass on Win32.
  • New macOS runtime tests (SkiaMacOS only):
    • Given_AppWindowTitleBar: insets, Collapsed, default drag strip, no XAML caption regions (and the XAML caption container is Collapsed), presenter options disabling the native buttons, hidden title bar (buttons hidden, LeftInset 0, content under it, app Caption drags), presenter commands (Maximize/Restore/Minimize) and Close with the title bar hidden. Restoring from the Dock is manual-only, because CI VMs block the main thread for seconds on the minimize animation.
    • Given_AppWindowTitleBar.When_Colors_Set_They_Are_Kept runs on all platforms.
    • Given_InputNonClientPointerSource.When_Passthrough_Overlaps_Caption_On_MacOS_Passthrough_Is_Client.
    • Given_InputActivationListener.When_Key_Window_Changes_Activation_Follows.
    • Given_AppWindow.When_Activated_ClientSize_Is_Physical_Content_Size (Win32 + macOS; passes on Win32 locally).
    • Given_TitleBar.When_Extended_Into_TitleBar_On_MacOS_Content_Avoids_Traffic_Lights_And_Drags.
    • Given_TitleBar.When_Content_Set_Interactive_Elements_Are_Passthrough now also runs on macOS.
  • The Objective-C changes were written on Windows. They are compiled by CI (Build - Native Binaries macOS) and exercised by Tests - Desktop macOS Skia Runtime Tests.

Needs manual verification on a Mac

  1. ExtendsContentIntoTitleBar = true: content draws under the title bar, no title text, traffic lights visible and clickable (close/minimize/zoom, hover glyphs, option-click zoom).
  2. Traffic lights are vertically centered in a 32pt (Standard) and 48pt (Tall) bar. They stay centered after a live resize, losing/regaining focus, entering/leaving full screen and changing AppWindow.Title. Toggling extend off restores the stock titlebar.
  3. Empty title bar area drags the window. Double-click zooms, minimizes or does nothing per System Settings > Desktop & Dock.
  4. With a TitleBar + SetTitleBar: back, pane toggle, Content (e.g. AutoSuggestBox, including typing) and RightHeader buttons get clicks in the top 28pt band without moving or zooming the window. Dragging the title text area moves the window.
  5. The TitleBar's left padding clears the traffic lights (expected ~2× wide on Retina, see the parity note).
  6. Switching apps/windows dims the TitleBar (inactive visuals) and restores it on return. Window.Activated reports Deactivated / PointerActivated.
  7. PreferredHeightOption = Collapsed hides the traffic lights. OverlappedPresenter.SetBorderAndTitleBar(true, false) and back keeps a consistent state.
  8. Secondary window with a custom title bar: TextBox input works (TextBox input not working in Secondary Window with Custom TitleBar (ExtendsContentIntoTitleBar) #22420).
  9. IsMinimizable/IsMaximizable/IsResizable = false: the matching traffic light is greyed out and does nothing; the zoom long-press menu and green-button full screen respect it. Toggling back re-enables them.
  10. SetBorderAndTitleBar(true, false): all traffic lights are gone, and the window keeps its shadow, rounded corners and edge resizing. XAML custom buttons calling Minimize(), Maximize()/Restore() and Window.Close() work, including restoring from the Dock. Full screen entered from a custom button (AppWindow.SetPresenter(FullScreen)) and exited works. Toggling back to (true, true) brings the native buttons back at the right position, and a TitleBar re-pads.
  11. Setting ButtonForegroundColor etc. doesn't throw and changes nothing.

PR Checklist ✅

  • 🧪 Added Runtime tests
  • 📚 Docs have been added/updated
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests

🤖 Generated with Claude Code

https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7

@github-actions github-actions Bot added platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Oct 10, 2026
@MartinZikmund

Copy link
Copy Markdown
Member Author

Verified on Skia macOS, fixes pushed

Tested on .NET 11 RC1, net11.0-desktop, Xcode 26.5, scale 1. The Mac was locked, so a scripted page cycled through the title bar states. It drew the reported InputNonClientPointerSource regions on top of the window and the window was captured at each step. Real clicks, drags and key-window changes were not possible.

Works

  • ExtendsContentIntoTitleBar: content draws under the bar, title text hidden, full-width default drag strip, LeftInset=68.
  • Traffic lights stay centered:
    • in a Standard (32) and Tall (48) bar
    • after a native title change
    • after a resize
  • Collapsed hides them and sets the insets to 0. Turning extend off restores the stock title bar.
  • TitleBar + SetTitleBar: the back and pane buttons clear the traffic lights, and its interactive parts are Passthrough.
  • AppWindow.Size / ClientSize are correct right after activation.

Found and fixed

  1. Passthrough regions went stale when the insets or FlowDirection changed.
    • UpdatePadding() moves the TitleBar's parts but doesn't resize it, and only a resize ran UpdateDragRegion().
    • After Collapsed, the back button had moved to x=2, but its Passthrough rect stayed at x=70. A click on the button would drag the window.
    • Win32 hits the same path when Collapsed removes the XAML caption buttons.
    • Fixed in fix(titlebar): Make the WinUI TitleBar control work on Skia desktop #25190: the regions are refreshed after the next layout pass.
  2. RTL: the SetTitleBar Caption rect was outside the window ([1300,0 1300x48] in a 1300px window).
  3. macOS input and activation, aligned with Win32:
    • A press on a drag region now activates the app and window before dragging. Skipping AppKit had also skipped its click-to-focus.
    • The regions apply whether or not the content is extended.
    • The first click into an inactive app over XAML in the title bar band only activates it. Before, AppKit's transparent titlebar could start a drag or zoom there.
    • PointerActivated now also covers a click that activates the app. A window made key by code from another window's handler no longer counts as pointer-activated.
    • Entering or leaving full screen refreshes the insets.

Fixes 1 and 2 were pushed to #25190, with the fix and test in separate commits. The tests are Win32-only there; this PR enables them on macOS. Fix 3 is a single commit here and has no automated test, because it needs real input.

Runtime tests on macOS (title bar, AppWindow, InputNonClientPointerSource, InputActivationListener, XamlRoot): 24 passed, 3 failed, 5 skipped.

  • The new region tests failed before the fixes and pass after.
  • The 3 failures also fail at 33ffd1f4d2 without these commits:
    • When_Extended_On_MacOS_No_Xaml_Caption_Buttons passed at 464da320a0, so the caption-button commits likely broke it.
    • When_TitleBar_Hidden_On_MacOS_Content_Extends_Under_It times out.
    • When_Change_Window_State_Before_Activate(Minimized) likely fails because the screen was locked.

Still needs a check at the Mac:

  • drag and double-click
  • the first click into an inactive app
  • activation when switching apps
  • full screen
  • 2x Retina
Region log, before → after
Collapsed, before: Passthrough: [70,2 40x44] [114,2 40x44] [923,8 260x33] [1696,11 56x26]
Collapsed, after:  Passthrough: [2,2 40x44] [46,2 40x44] [639,8 260x33] [1196,11 56x26]
RTL, before: Caption: [0,0 1300x32] [1300,0 1300x48] | Passthrough: [70,2 40x44] [114,2 40x44] ...
RTL, after:  Caption: [0,0 1300x32] [0,0 1300x48]    | Passthrough: [1258,2 40x44] [1214,2 40x44] ...

🤖 Generated with Claude Code

@MartinZikmund

Copy link
Copy Markdown
Member Author

Verified the caption-button commits on Skia macOS (33eda0668a..33ffd1f4d2), follow-up fixes pushed

The machine (.NET 11 RC1, Xcode 26.5, scale 1) was locked during testing. A scripted page switched states and the window was captured at each step. No real clicks were possible.

Works

  • SetBorderAndTitleBar(true, false) keeps the native frame (rounded corners, shadow), hides the traffic lights, and app-drawn caption buttons work.
  • Minimize / Maximize / Close work from code.
  • Title bar colors and IconShowOptions are settable.
  • IsMinimizable / IsMaximizable grey the traffic lights out, matching Win32, where dropping WS_MINIMIZEBOX / WS_MAXIMIZEBOX greys the standard button. The Win32 XAML caption buttons for extended windows don't react to these yet (Win32-side gap).

Fixed

  1. Hiding or extending into the title bar shrank the window instead of growing the content under it (captured frame 1028 → 1000 px).
    • When NSWindowStyleMaskFullSizeContentView toggles, AppKit keeps the content size and moves the frame. Win32 keeps the outer size.
    • Reporting the new content size (f23b977) alone wasn't enough: When_TitleBar_Hidden_On_MacOS_Content_Extends_Under_It still timed out at b7c1e17.
    • 0954c00 restores the frame after the style change. The client now grows 650 → 678 while the window stays 1100×678.
  2. SetTitleBar registered its Caption rect even when the content wasn't extended.
    • WinUI only applies it while the chrome is active (CWindowChrome::OnTitleBarSizeChanged clears the drag region otherwise).
    • In Uno, the element kept dragging after ExtendsContentIntoTitleBar was turned off, on Win32 and on macOS.
    • Fixed in b9762dc, test in 254a011 (Win32 + macOS; failed before the fix, passes after).

The minimize-before-activation fix and the caption-visibility test in f23b977 / b7c1e17 overlapped with fixes made in parallel here. Those were dropped in favor of the versions already on the branch.

Runtime tests on macOS (title bar, AppWindow, InputNonClientPointerSource, InputActivationListener, XamlRoot): 28 passed, 0 failed, 5 skipped (Win32-only).

Still for a hands-on check: caption button enabled state (under the lock screen every window is inactive, so the lights look grey regardless), real drags and clicks, Retina.

🤖 Generated with Claude Code

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/titlebar-macos branch from d6993e1 to 6429f01 Compare October 11, 2026 22:12
@MartinZikmund MartinZikmund changed the title feat(macos): Custom title bars - ExtendsContentIntoTitleBar, drag regions, insets and activation feat(windowing): Custom title bars on macOS and caption button colors on Win32 Oct 12, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 22s —— View job


Review summary

Verdict: ship, pending a Mac check and the screenshot-diff review. I found nothing blocking and posted no inline comments.

Issues by severity: blocker 0, major 0, minor 0, nit 1.

This was a light pass, not a full read of the diff. I could not build or run anything here, so the points below come from reading the code, with no compile or runtime validation of my own.

What I looked at

  • NonClientRegionSet is a straight extraction of the Win32 precedence loop. It is clean, has #nullable enable, and has its own unit tests.
  • I found no async void, .Result or .GetAwaiter() in WindowChrome.cs.
  • I found no [Ignore], Inconclusive or #pragma warning disable in the new Given_AppWindowTitleBar runtime tests.
  • The new event uses EventHandler<(bool, bool)>, not event Action, as the repo rules require.
  • Platform-specific code stays in Uno.UI.Runtime.MacOS, and the shared code goes through HasNativeCaptionButtons. That fits the Skia-only layering.

On the github-code-quality "generic catch" comments in MacOSWindowHost.cs

  • I would dismiss them. The catch (Exception) blocks in WindowActivationChanged and WindowNonClientHitTest sit inside [UnmanagedCallersOnly] entry points. No managed exception may cross into native code there, and the surrounding callbacks already use the same pattern with RaiseRecoverableUnhandledException.
  • Narrowing the catch to specific exception types, as the bot suggests, would let others escape into AppKit and crash the process.

Cross-cutting notes

  • Not validated on a real Mac: the PR description lists drag, double-click, first-click activation, full screen and 2x Retina as manual-only. These are the riskiest parts, so please run that checklist before merging.
  • Screenshot diffs: the Linux (118) and Windows (2458) screenshot comparisons flag nearly every sample, which looks like a baseline or infrastructure problem and not a result of this change. Please confirm that before ticking the checklist item.
  • Nit: the macOS-only tests are skipped on other platforms. That is acceptable, but the macOS CI run is the only automated coverage for the Objective-C changes.
  • Open checklist items: "Validated PR Screenshots Compare Test Run" and "Reviewed 2 other open pull requests" are still unchecked.
    · branch dev/mazi/titlebar-macos

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 239416 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DropDownButtonPage.png-dark
    • Examples.png
    • DynamicFont.png-dark
    • DynamicFont.png
  • skia-windows-screenshots: 2458 changed over 2488

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarToggleButtonTest.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png
    • AppWindowPresenters.png
    • ArcSegment.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_Relations.png-dark
    • AutomationProperties_Relations.png
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • BasicThemeResources.png-dark
    • BasicThemeResources.png

@unodevops

Copy link
Copy Markdown
Contributor

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

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/titlebar-macos branch from 74acb64 to 823512b Compare October 14, 2026 09:18
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 15s —— View job


Review summary

Verdict: ship, pending the on-Mac checks and the screenshot-diff review. I found nothing blocking and posted no inline comments.

Issues by severity: blocker 0, major 0, minor 0, nit 0.

This was a light pass. The checkout has no merge base with origin/master, so I couldn't diff the PR. I read NonClientRegionSet.cs and the catch blocks in MacOSWindowHost.cs directly. I did not build or run anything, so this is code review only, with no compile or runtime validation.

  • NonClientRegionSet: the code is clear. It has a fixed Passthrough-first precedence, #nullable enable, and a comment explaining why the order is fixed.
  • github-code-quality "generic catch" comments: I'd dismiss them. The catch (Exception) blocks in WindowActivationChanged and WindowNonClientHitTest are in [UnmanagedCallersOnly] entry points, where no managed exception may cross into AppKit. Every other callback in the file uses the same pattern (about 15 sites), reporting through RaiseRecoverableUnhandledException. Narrowing the catch would let other exceptions escape and crash the process.

Cross-cutting concerns

  • Not validated on a real Mac: drag, double-click, first-click activation, full screen and 2x Retina are manual-only in the PR description. Run that checklist before merging.
  • Screenshot diffs: the Linux (118) and Windows (2458) comparisons flag nearly every sample, including unrelated ones. That looks like a baseline or infrastructure problem and not a result of this change. Please confirm that before ticking the checklist item.
  • CI: build 239416 shows as failed on Uno.UI - CI. I did not inspect the logs, so check that it isn't a real failure hidden behind the screenshot noise.
  • Checklist: "Validated PR Screenshots Compare Test Run" and "Reviewed 2 other open pull requests" are still unchecked.
    · branch dev/mazi/titlebar-macos

@MartinZikmund

Copy link
Copy Markdown
Member Author

🤖 Addressed PR comments up to this point

  • Rebased on master (e8fe1cea69) and fixed CI in 823512b: the new unit test classes now use [UITestClass], which master's Given_UnitTestUIThread guard requires.
  • The remaining tvOS / docs failures are NuGet audit errors on System.Security.Cryptography.Xml/Pkcs 10.0.10 that also break master; fixed separately in chore(deps): Bump System.Security.Cryptography.Xml to 10.0.13 #25432.
  • @github-code-quality "Generic catch clause" (×2, MacOSWindowHost.cs): replied inline, no change. These are [UnmanagedCallersOnly] callbacks, so the catch-all is intentional.
  • @MartinZikmund's two verification reports: status updates, no action needed.

@unoplatform unoplatform deleted a comment from unodevops Oct 14, 2026
@unoplatform unoplatform deleted a comment from nventive-devops Oct 14, 2026
@unoplatform unoplatform deleted a comment from nventive-devops Oct 14, 2026
@unoplatform unoplatform deleted a comment from nventive-devops Oct 14, 2026
@unoplatform unoplatform deleted a comment from nventive-devops Oct 14, 2026
@unoplatform unoplatform deleted a comment from nventive-devops Oct 14, 2026
@unoplatform unoplatform deleted a comment from unodevops Oct 14, 2026
@unoplatform unoplatform deleted a comment from unodevops Oct 14, 2026
MartinZikmund and others added 21 commits October 14, 2026 11:39
Unit tests for the inset and region-to-action math. macOS runtime tests
for LeftInset, the default and SetTitleBar drag regions, Passthrough
precedence through the native hit-test path, and a TitleBar smoke test.
The existing TitleBar Passthrough test now also runs on macOS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…m the start

The wrapper converted the initial host size and position to physical
pixels before setting RasterizationScale, which is still 0 at that
point. AppWindow.Size, ClientSize and Position therefore read 0 until
the window was next resized or moved. A later scale change (moving to
another screen) also left them in the old scale.

Set the scale first, and recompute both from the last logical values
when the scale changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…affic lights

- SetBorderAndTitleBar(true, false) now keeps the native frame (shadow,
  rounded corners, resizing) and hides the title bar and all three traffic
  lights, so apps can draw their own caption buttons like on Windows.
  Previously it dropped NSWindowStyleMaskTitled. LeftInset becomes 0.
  Only hasBorder: false as well makes the window untitled.
- IsMinimizable/IsMaximizable/IsResizable disable (not hide) the
  minimize/zoom buttons, re-applied when AppKit recreates the buttons.
- Minimize/Maximize/Close no longer depend on a visible native button:
  miniaturize:/zoom: replace performMiniaturize:/performZoom:, which beep
  without one (performZoom: also un-zoomed an already zoomed window), and
  Close asks the delegate itself when there is no usable close button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…ttable on Skia

Getting any of them threw NotImplementedException on every Skia target,
so title bar code shared with WinAppSDK crashed on Uno desktop. They are
now stored values. Skia desktop hosts don't apply them: macOS draws its
title bar and traffic lights itself, and Win32 doesn't use them yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Native button disabling from IsMinimizable/IsMaximizable/IsResizable,
SetBorderAndTitleBar(true, false) hiding the traffic lights (LeftInset 0,
content under the bar, app Caption region drags), presenter commands and
Close with the title bar hidden, the collapsed XAML caption container,
and settable AppWindowTitleBar colors on every platform.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
- A press on a drag region activates the app and window before dragging,
  as HTCAPTION does on Win32. Skipping AppKit had also skipped its
  click-to-focus.
- The non-client regions apply whether or not the content is extended
  into the title bar, as on Win32.
- The first click into an inactive app over XAML in the title bar band
  only activates it, instead of letting AppKit's transparent titlebar
  start a drag or zoom on top of the element.
- PointerActivated also covers a click that activates the app, where the
  current event is the app activation, and no longer covers a window made
  key by code from another window's press handler.
- Entering and leaving full screen refreshes the insets, which could miss
  the last resize of the transition.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… keep Minimize before activation

- Extending into, or hiding, the title bar resizes the content view
  without a windowDidResize, and the paused Metal view does not report
  its new drawable size. The XAML content therefore kept its old size.
  Report it explicitly for every rendering path.
- miniaturize: does nothing on a window that isn't shown yet, so record
  the Minimized state that uno_window_activate applies later (the
  replaced performMiniaturize: override used to).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
AppKit keeps the content size when the full-size content view style is
toggled, so hiding the title bar (SetBorderAndTitleBar(true, false)) or
extending into it shrank the window by the title bar height instead of
letting the content grow under it. Win32 keeps the outer size, so restore
the frame after the style change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tended

Like CWindowChrome::OnTitleBarSizeChanged in WinUI. The rect was registered
regardless, so after turning ExtendsContentIntoTitleBar off the element's
area kept dragging the window, on Win32 and now on macOS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closing a minimized secondary window trips the known macOS crash where a
closed UNOWindow is freed mid-close (releasedWhenClosed under ARC), which
segfaulted a later test. Restore it first, with a timeout that allows
for the slow Dock animation on CI VMs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…mes key

windowDidBecomeKey compared NSApp.currentEvent.window to self. The
current event can be stale and point at a secondary window that was
already closed and freed (a closed UNOWindow is released mid-close), and
-[NSEvent window] hands it back retained and autoreleased. The next pool
drain then segfaulted in objc_release: the macOS runtime tests crashed
during window and full-screen tests. Compare window numbers instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
CI VMs never complete the restore from the Dock, and the minimized window
was left behind. Given_AppWindow already covers Minimize.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
…aption buttons

The XAML caption buttons that WindowChrome draws on Skia Win32 now follow
ButtonForeground/BackgroundColor, the Hover, Pressed and Inactive variants,
the way the system caption buttons do on WinAppSDK:
- null means the theme default, and changes apply immediately.
- The inactive colors apply while the window is deactivated.
- The Close button keeps its system hover and pressed colors.
- Only the background colors keep their alpha channel.

As CWindowChrome does, the first Window.ExtendsContentIntoTitleBar opt-in
sets ButtonBackgroundColor and ButtonInactiveBackgroundColor to Transparent.

The caption button template no longer sets colors from visual states. Its
setters targeted a nonexistent "Path" element, so the hover and pressed
glyph colors (white on the red Close hover) were never applied.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Master's Given_UnitTestUIThread guard requires [UITestClass] on every unit
test class with tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/titlebar-macos branch from 823512b to ef48a0d Compare October 14, 2026 09:40
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 43s —— View job


Review summary

Verdict: ship, pending the on-Mac checks and the screenshot-diff review. I found nothing blocking and posted no inline comments.

Issues by severity: blocker 0, major 0, minor 0, nit 1.

This was a light pass, not a full read of the diff. The checkout has no merge base with origin/master, so I couldn't diff the PR. I searched the main changed files for repo-rule violations and did not build or run anything. This is code review only, with no compile or runtime validation.

  • Nit: src/Uno.WinRT/Microsoft/UI/Windowing/AppWindowTitleBar.cs:32 declares internal event Action<bool>? ExtendsContentIntoTitleBarChanged. AGENTS.md bans event Action<T> and asks for EventHandler<T>. git blame was denied, so I can't tell whether this line is new in this PR. If it is, switch it to EventHandler<bool>. If it was already on master, leave it, since changing it is outside this PR. The other new events (Changed, InsetsChanged, ButtonColorsChanged) use EventHandler.
  • Clean searches: In WindowChrome.cs, NonClientRegionSet.cs, MacOSWindowWrapper.cs, MacOSTitleBarMath.cs, AppWindowTitleBar.cs and Given_AppWindowTitleBar.cs, I found no async void, .Result, .GetAwaiter(), [Ignore] or Assert.Inconclusive.
  • github-code-quality "generic catch" comments: I agree with the author's reply and would keep them dismissed. The catch (Exception) blocks sit in [UnmanagedCallersOnly] callbacks, where no managed exception may reach AppKit.

Cross-cutting concerns

  • Not validated on a real Mac: drag, double-click, first-click activation, full screen and 2x Retina are still manual-only in the PR description. Run that checklist before merging.
  • Screenshot diffs: the Linux (118) and Windows (2458) comparisons flag nearly every sample, including unrelated ones. That looks like a baseline or infrastructure problem and not a result of this change. Please confirm that before ticking the checklist item.
  • CI: the author reports the remaining tvOS and docs failures as NuGet audit errors that also break master, with the fix in chore(deps): Bump System.Security.Cryptography.Xml to 10.0.13 #25432. I did not check the logs myself.
  • Checklist: "Validated PR Screenshots Compare Test Run" and "Reviewed 2 other open pull requests" are still unchecked.
    · branch dev/mazi/titlebar-macos

@unodevops

Copy link
Copy Markdown
Contributor

1 similar comment
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 239429 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • Buttons.png-dark
    • Buttons.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • DisplayInformation.png-dark
  • skia-windows-screenshots: 2458 changed over 2488

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png
    • ApplicationViewSizing.png
    • AppWindowPositionAndSize.png-dark
    • ArcSegment.png-dark
    • Attributed_text_Supserscript.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutomationPropertiesExtensions_Role.png
    • AutoSizedTopLeft.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • BackGesture.png-dark
    • BackGesture.png
    • BasicEnability.png-dark
    • BasicEnability.png
    • BezierSegment.png-dark
    • BezierSegment.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderLeftwithmargins.png-dark
    • BorderLeftwithmargins.png

@MartinZikmund
MartinZikmund merged commit 4393a80 into master Oct 14, 2026
58 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/titlebar-macos branch October 14, 2026 12:10
@MartinZikmund

Copy link
Copy Markdown
Member Author

/azp run

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

Labels

7.0 PRs only. For issues, use the Release field. area/automation Categorizes an issue or PR as relevant to project automation kind/documentation platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform

Projects

None yet

3 participants