Skip to content

Commit

Permalink
ensure owner topmost flag is set if its topmost when showing a owned …
Browse files Browse the repository at this point in the history
…window
  • Loading branch information
emmauss committed Jun 24, 2024
1 parent 143399f commit a627fe8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Windows/Avalonia.Win32/WindowImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,8 @@ public void SetParent(IWindowImpl? parent)
_hiddenWindowIsParent = parentHwnd == OffscreenParentWindow.Handle;

SetWindowLongPtr(_hwnd, (int)WindowLongParam.GWL_HWNDPARENT, parentHwnd);

(parent as WindowImpl)?.EnsureTopmost();
}

public void SetEnabled(bool enable) => EnableWindow(_hwnd, enable);
Expand Down Expand Up @@ -860,6 +862,17 @@ public void SetTopmost(bool value)
_topmost = value;
}

private void EnsureTopmost()
{
if(_topmost)
{
SetWindowPos(_hwnd,
WindowPosZOrder.HWND_TOPMOST,
0, 0, 0, 0,
SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
}
}

public unsafe void SetFrameThemeVariant(PlatformThemeVariant themeVariant)
{
_currentThemeVariant = themeVariant;
Expand Down

0 comments on commit a627fe8

Please sign in to comment.