Browse Source

[Avalonia.Native] Fix fullscreen transitions with ExtendClientAreaToDecorationsHint windows (#19939)

backports/19939
Tim Miller 3 months ago
committed by Timothy Miller
parent
commit
4f3a010d0b
  1. 37
      native/Avalonia.Native/src/OSX/AvnWindow.mm
  2. 4
      native/Avalonia.Native/src/OSX/WindowImpl.h

37
native/Avalonia.Native/src/OSX/AvnWindow.mm

@ -436,23 +436,28 @@
return; return;
} }
// If the window has been moved into a position where it's "zoomed" // Don't adjust window state during fullscreen transitions
// Then it should be set as Maximized. // as this can interfere with proper decoration restoration
if (window->WindowState() != Maximized && window->IsZoomed()) if(!window->IsTransitioningWindowState())
{ {
window->SetWindowState(Maximized, false); // If the window has been moved into a position where it's "zoomed"
} // Then it should be set as Maximized.
// We should only return the window state to normal if if (window->WindowState() != Maximized && window->IsZoomed())
// the internal window state is maximized, and macOS says {
// the window is no longer zoomed (I.E, the user has moved it) window->SetWindowState(Maximized, false);
// Stage Manager will "move" the window when repositioning it }
// So if the window was "maximized" before, it should stay maximized // We should only return the window state to normal if
else if(window->WindowState() == Maximized && !window->IsZoomed()) // the internal window state is maximized, and macOS says
{ // the window is no longer zoomed (I.E, the user has moved it)
// If we're moving the window while maximized, // Stage Manager will "move" the window when repositioning it
// we need to let macOS handle if it should be resized // So if the window was "maximized" before, it should stay maximized
// And not handle it ourselves. else if(window->WindowState() == Maximized && !window->IsZoomed())
window->SetWindowState(Normal, false); {
// If we're moving the window while maximized,
// we need to let macOS handle if it should be resized
// And not handle it ourselves.
window->SetWindowState(Normal, false);
}
} }
} }

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

@ -87,7 +87,9 @@ BEGIN_INTERFACE_MAP()
bool CanBecomeKeyWindow (); bool CanBecomeKeyWindow ();
bool CanZoom() override { return _isEnabled && _canMaximize; } bool CanZoom() override { return _isEnabled && _canMaximize; }
bool IsTransitioningWindowState() { return _transitioningWindowState; }
protected: protected:
virtual NSWindowStyleMask CalculateStyleMask() override; virtual NSWindowStyleMask CalculateStyleMask() override;
virtual void UpdateAppearance() override; virtual void UpdateAppearance() override;

Loading…
Cancel
Save