Browse Source

Don't change z-order of window exiting fullscreen.

When a window exits fullscreen, its child windows need to be ordered, but we shouldn't touch the z-order of the window itself as this sometimes seemed to result in the parent window being shown over the child windows. Fixes flaky integration tests (hopefully).
pull/10265/head
Steven Kirk 3 years ago
parent
commit
784c380c60
  1. 1
      native/Avalonia.Native/src/OSX/WindowImpl.h
  2. 21
      native/Avalonia.Native/src/OSX/WindowImpl.mm
  3. 4
      tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

1
native/Avalonia.Native/src/OSX/WindowImpl.h

@ -102,6 +102,7 @@ protected:
void UpdateStyle () override;
private:
void ZOrderChildWindows();
void OnInitialiseNSWindow();
NSString *_lastTitle;
};

21
native/Avalonia.Native/src/OSX/WindowImpl.mm

@ -119,14 +119,19 @@ void WindowImpl::BringToFront()
}
[Window invalidateShadow];
ZOrderChildWindows();
}
}
void WindowImpl::ZOrderChildWindows()
{
for(auto iterator = _children.begin(); iterator != _children.end(); iterator++)
{
auto window = (*iterator)->Window;
for(auto iterator = _children.begin(); iterator != _children.end(); iterator++)
{
auto window = (*iterator)->Window;
// #9565: Only bring window to front if it's on the currently active space
if ([window isOnActiveSpace])
(*iterator)->BringToFront();
// #9565: Only bring window to front if it's on the currently active space
if ([window isOnActiveSpace]) {
(*iterator)->BringToFront();
}
}
}
@ -154,7 +159,7 @@ void WindowImpl::EndStateTransition() {
UpdateStyle();
// Ensure correct order of child windows after fullscreen transition.
BringToFront();
ZOrderChildWindows();
}
SystemDecorations WindowImpl::Decorations() {

4
tests/Avalonia.IntegrationTests.Appium/WindowTests_MacOS.cs

@ -56,7 +56,7 @@ namespace Avalonia.IntegrationTests.Appium
}
}
[PlatformFact(TestPlatforms.MacOS, Skip = "Flaky test, skip for now")]
[PlatformFact(TestPlatforms.MacOS)]
public void WindowOrder_Modal_Dialog_Stays_InFront_Of_Parent_When_Clicking_Resize_Grip()
{
var mainWindow = GetWindow("MainWindow");
@ -151,7 +151,7 @@ namespace Avalonia.IntegrationTests.Appium
Assert.Equal("Normal", windowState.Text);
}
[PlatformFact(TestPlatforms.MacOS, Skip = "Flaky test, skip for now")]
[PlatformFact(TestPlatforms.MacOS)]
public void Does_Not_Switch_Space_From_FullScreen_To_Main_Desktop_When_FullScreen_Window_Clicked()
{
// Issue #9565

Loading…
Cancel
Save