|
|
|
@ -481,6 +481,11 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets whether this window was opened as a dialog
|
|
|
|
/// </summary>
|
|
|
|
public bool IsDialog => _showingAsDialog; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Starts moving a window with left button being held. Should be called from left mouse button press event handler
|
|
|
|
/// </summary>
|
|
|
|
@ -761,12 +766,12 @@ namespace Avalonia.Controls |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
_showingAsDialog = modal; |
|
|
|
RaiseEvent(new RoutedEventArgs(WindowOpenedEvent)); |
|
|
|
|
|
|
|
EnsureInitialized(); |
|
|
|
ApplyStyling(); |
|
|
|
_shown = true; |
|
|
|
_showingAsDialog = modal; |
|
|
|
IsVisible = true; |
|
|
|
|
|
|
|
// If window position was not set before then platform may provide incorrect scaling at this time,
|
|
|
|
@ -984,7 +989,7 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var location = GetEffectiveWindowStartupLocation(owner); |
|
|
|
|
|
|
|
switch (location) |
|
|
|
@ -1017,7 +1022,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
return startupLocation; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void SetWindowStartupLocation(Window? owner = null) |
|
|
|
{ |
|
|
|
if (_wasShownBefore) |
|
|
|
@ -1052,7 +1057,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
screen ??= Screens.ScreenFromPoint(Position); |
|
|
|
screen ??= Screens.Primary; |
|
|
|
|
|
|
|
|
|
|
|
if (screen is not null) |
|
|
|
{ |
|
|
|
var childRect = screen.WorkingArea.CenterRect(rect); |
|
|
|
@ -1072,7 +1077,7 @@ namespace Avalonia.Controls |
|
|
|
var childRect = ownerRect.CenterRect(rect); |
|
|
|
|
|
|
|
var screen = Screens.ScreenFromWindow(owner); |
|
|
|
|
|
|
|
|
|
|
|
childRect = ApplyScreenConstraint(screen, childRect); |
|
|
|
|
|
|
|
Position = childRect.Position; |
|
|
|
@ -1080,7 +1085,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (!_positionWasSet && DesktopScaling != PlatformImpl?.DesktopScaling) // Platform returns incorrect scaling, forcing setting position may fix it
|
|
|
|
PlatformImpl?.Move(Position); |
|
|
|
|
|
|
|
|
|
|
|
PixelRect ApplyScreenConstraint(Screen? screen, PixelRect childRect) |
|
|
|
{ |
|
|
|
if (screen?.WorkingArea is { } constraint) |
|
|
|
|