Skip to content

fix(macos): Flip AppWindow position to top-left - #25651

Merged
ramezgerges merged 2 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/macos-window-position
Oct 26, 2026
Merged

ramezgerges merged 2 commits into
unoplatform:masterfrom
ramezgerges:dev/rara/macos-window-position

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25650

PR Type:

🐞 Bugfix

What changed? 🚀

On the macOS desktop host, AppWindow.Position and AppWindow.Move used AppKit's frame origin as-is: the window's bottom-left corner, with Y growing upward. A larger Y therefore moved the window up, unlike WinUI.

This was found while investigating the macOS failures of #25492. On the small display of the macOS 27 CI agents, the window already touches the top of the screen. When_Move's "move down 10" then became "move up 10", which AppKit refuses, so the position never changed. On a larger display the window moves the wrong way and the test still passes, because it reads back the same unflipped value it set.

Changes in UNOWindow.m:

  • Move, uno_window_get_position and windowDidMove now use the window's top-left corner with Y growing down, flipped against the primary screen's top edge. uno_window_convert_local_to_screen already did this.
  • Resize keeps the top-left corner in place, as WinUI does. Before, it kept the bottom-left corner, which now would move Position.
  • windowDidResize also reports the position, since resizing from the top edge moves the top-left corner without raising windowDidMove.
  • Activation restores the pre-activation top-left corner instead of the bottom-left one.

New runtime tests compare against where the platform puts the window content on screen (ConvertLocalToScreen), not against the value Move stored:

  • When_Move_Down_Then_Window_Moves_Down_On_Screen
  • When_Resize_Then_Top_Left_Stays

Validation

All of it ran on macOS 27.0.1 with Xcode 27.1, on the SamplesApp desktop head:

  • Without the native fix, both new tests fail. Move(Y + 20) moved the window content from screen Y 222 to 202, i.e. up instead of down.
  • With the fix, all 20 Given_AppWindow tests pass (5 skipped as Win32-only or by existing conditions).

PR Checklist ✅

Behavior change: on macOS, AppWindow.Position values now follow WinUI (top-left, Y down). An app that compensated for the inverted Y on macOS will need to drop that workaround.

🤖 Generated with Claude Code

AppWindow.Position and Move used AppKit's bottom-left frame origin, so a
larger Y moved the window up. Position is now the top-left corner with Y
growing down, flipped against the primary screen like ConvertLocalToScreen,
and Resize keeps that corner in place.

Fixes unoplatform#25650

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform label Oct 22, 2026
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 240894 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) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Examples.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DropDownButtonPage.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 2458 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AppBarButtonTest.png-dark
    • AppBarToggleButtonTest.png
    • Application_DispatcherShutdownMode.png-dark
    • AppWindowPresenters.png
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Demo.png
    • AutoBorderStretchwithrightmargin.png-dark
    • AutomationProperties_Name.png
    • AutomationProperties_Relations.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • BackGesture.png
    • BadgeNotificationTests.png-dark
    • Basics.png-dark
    • Basics.png
    • BezierSegment.png-dark
    • BezierSegment.png
    • BitmapIcon_Sizing.png-dark
    • BitmapIcon_Sizing.png

@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 241084 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) 🚨🚨
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageIconPage.png-dark
  • skia-windows-screenshots: 2458 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AnimatedVisualsTestbedPage.png
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowPositionAndSize.png-dark
    • AppXamlDefinedResources.png-dark
    • Arrange_Performance01.png-dark
    • Attributed_text_Simple.png-dark
    • AuthenticationBroker_Demo.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutomationProperties_AutomationId.png
    • AutomationProperties_Landmark.png-dark
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_Reason.png-dark
    • AutoSuggestBox_Reason.png
    • Basics Pivot Test.png-dark
    • Basics Pivot Test.png
    • Battery.png-dark
    • Battery.png

@unodevops

Copy link
Copy Markdown
Contributor

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

@ramezgerges
ramezgerges merged commit c57dab5 into unoplatform:master Oct 26, 2026
47 checks passed
@ramezgerges
ramezgerges deleted the dev/rara/macos-window-position branch October 26, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[macOS] AppWindow.Position and Move use a bottom-left origin, so Y is inverted

5 participants