Skip to content

Commit

Permalink
Disable close, move, resize, maximize, minimize for disabled X11Window
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudakov Egor committed Oct 26, 2023
1 parent 8da8100 commit 982315a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Avalonia.X11/X11Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,15 @@ private void UpdateMotifHints()
|| _systemDecorations == SystemDecorations.None)
decorations = 0;

if (!_canResize)
if (!_canResize || !IsEnabled)
{
functions &= ~(MotifFunctions.Resize | MotifFunctions.Maximize);
decorations &= ~(MotifDecorations.Maximize | MotifDecorations.ResizeH);
}
if (!IsEnabled)
{
functions &= ~(MotifFunctions.Resize | MotifFunctions.Minimize);
}

var hints = new MotifWmHints
{
Expand Down Expand Up @@ -565,7 +569,7 @@ private void OnEvent(ref XEvent ev)
{
if (ev.ClientMessageEvent.ptr1 == _x11.Atoms.WM_DELETE_WINDOW)
{
if (Closing?.Invoke(WindowCloseReason.WindowClosing) != true)
if (IsEnabled && Closing?.Invoke(WindowCloseReason.WindowClosing) != true)
Dispose();
}
else if (ev.ClientMessageEvent.ptr1 == _x11.Atoms._NET_WM_SYNC_REQUEST)
Expand Down Expand Up @@ -1261,6 +1265,7 @@ public void SetEnabled(bool enable)
_disabled = !enable;

UpdateWMHints();
UpdateMotifHints();
}

private void UpdateWMHints()
Expand Down

0 comments on commit 982315a

Please sign in to comment.