Browse Source

Merge pull request #3740 from AvaloniaUI/x11-non-mapped-configure-events

[X11] Emulate synchronous resize/move events until window is mapped for the first time
pull/3747/head
Steven Kirk 6 years ago
committed by GitHub
parent
commit
faba21ef30
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/Avalonia.X11/X11Window.cs

9
src/Avalonia.X11/X11Window.cs

@ -41,6 +41,7 @@ namespace Avalonia.X11
private IntPtr _xic;
private IntPtr _renderHandle;
private bool _mapped;
private bool _wasMappedAtLeastOnce = false;
private HashSet<X11Window> _transientChildren = new HashSet<X11Window>();
private X11Window _transientParent;
private double? _scalingOverride;
@ -777,6 +778,7 @@ namespace Avalonia.X11
void ShowCore()
{
_wasMappedAtLeastOnce = true;
XMapWindow(_x11.Display, _handle);
XFlush(_x11.Display);
}
@ -824,7 +826,7 @@ namespace Avalonia.X11
XConfigureResizeWindow(_x11.Display, _renderHandle, pixelSize);
XFlush(_x11.Display);
if (force || (_popup && needImmediatePopupResize))
if (force || !_wasMappedAtLeastOnce || (_popup && needImmediatePopupResize))
{
_realSize = pixelSize;
Resized?.Invoke(ClientSize);
@ -865,6 +867,11 @@ namespace Avalonia.X11
XConfigureWindow(_x11.Display, _handle, ChangeWindowFlags.CWX | ChangeWindowFlags.CWY,
ref changes);
XFlush(_x11.Display);
if (!_wasMappedAtLeastOnce)
{
_position = value;
PositionChanged?.Invoke(value);
}
}
}

Loading…
Cancel
Save