diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index 2609a86a2c..cf1f8c5790 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -297,6 +297,12 @@ namespace Avalonia.X11 if (!IsEnabled) { functions &= ~(MotifFunctions.Resize | MotifFunctions.Minimize); + + UpdateSizeHints(null, true); + } + else + { + UpdateSizeHints(null); } var hints = new MotifWmHints @@ -311,14 +317,14 @@ namespace Avalonia.X11 PropertyMode.Replace, ref hints, 5); } - private void UpdateSizeHints(PixelSize? preResize) + private void UpdateSizeHints(PixelSize? preResize, bool forceDisableResize = false) { if (_overrideRedirect) return; var min = _minMaxSize.minSize; var max = _minMaxSize.maxSize; - if (!_canResize) + if (!_canResize || forceDisableResize) { if (preResize.HasValue) { @@ -1293,6 +1299,13 @@ namespace Avalonia.X11 UpdateWMHints(); UpdateMotifHints(); + + if (enable) + { + // Some window managers ignore Motif hints when switching from disabled to enabled on the first update + // so setting it again forces the update + UpdateMotifHints(); + } } private void UpdateWMHints()