Browse Source

x11-force window size hints when window disabled (#14859)

pull/14871/head
Emmanuel Hansen 3 years ago
committed by GitHub
parent
commit
5ba70158df
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      src/Avalonia.X11/X11Window.cs

17
src/Avalonia.X11/X11Window.cs

@ -297,6 +297,12 @@ namespace Avalonia.X11
if (!IsEnabled) if (!IsEnabled)
{ {
functions &= ~(MotifFunctions.Resize | MotifFunctions.Minimize); functions &= ~(MotifFunctions.Resize | MotifFunctions.Minimize);
UpdateSizeHints(null, true);
}
else
{
UpdateSizeHints(null);
} }
var hints = new MotifWmHints var hints = new MotifWmHints
@ -311,14 +317,14 @@ namespace Avalonia.X11
PropertyMode.Replace, ref hints, 5); PropertyMode.Replace, ref hints, 5);
} }
private void UpdateSizeHints(PixelSize? preResize) private void UpdateSizeHints(PixelSize? preResize, bool forceDisableResize = false)
{ {
if (_overrideRedirect) if (_overrideRedirect)
return; return;
var min = _minMaxSize.minSize; var min = _minMaxSize.minSize;
var max = _minMaxSize.maxSize; var max = _minMaxSize.maxSize;
if (!_canResize) if (!_canResize || forceDisableResize)
{ {
if (preResize.HasValue) if (preResize.HasValue)
{ {
@ -1293,6 +1299,13 @@ namespace Avalonia.X11
UpdateWMHints(); UpdateWMHints();
UpdateMotifHints(); 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() private void UpdateWMHints()

Loading…
Cancel
Save