diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index d078ceb9f8d..7edf1fd025b 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -297,19 +297,30 @@ private void UpdateMotifHints() private void UpdateSizeHints(PixelSize? preResize) { - if(_overrideRedirect) + if (_overrideRedirect) return; var min = _minMaxSize.minSize; var max = _minMaxSize.maxSize; if (!_canResize) - max = min = _realSize; - - if (preResize.HasValue) { - var desired = preResize.Value; - max = new PixelSize(Math.Max(desired.Width, max.Width), Math.Max(desired.Height, max.Height)); - min = new PixelSize(Math.Min(desired.Width, min.Width), Math.Min(desired.Height, min.Height)); + if (preResize.HasValue) + { + max = min = preResize.Value; + } + else + { + max = min = _realSize; + } + } + else + { + if (preResize.HasValue) + { + var desired = preResize.Value; + max = new PixelSize(Math.Max(desired.Width, max.Width), Math.Max(desired.Height, max.Height)); + min = new PixelSize(Math.Min(desired.Width, min.Width), Math.Min(desired.Height, min.Height)); + } } var hints = new XSizeHints @@ -1001,8 +1012,10 @@ private void MoveResize(PixelPoint position, Size size, double scaling) private void Resize(Size clientSize, bool force, WindowResizeReason reason) { - if (!force && clientSize == ClientSize) + if (!force && (clientSize == ClientSize)) + { return; + } var needImmediatePopupResize = clientSize != ClientSize;