Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/ManagedShell.AppBar/AppBarWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ public bool AllowAutoHide
protected double AutoHideAnimationMs = 300;
protected double AutoHideShowAnimationMs = 150;

private bool _deferWorkArea;
private bool _previouslyDeferredWorkArea;
public bool DeferWorkArea
{
get => _deferWorkArea;
set
{
bool oldValue = _deferWorkArea;
_deferWorkArea = value;
if (oldValue && oldValue != value)
{
_previouslyDeferredWorkArea = true;
UpdatePosition();
}
}
}

private bool _isDragWithin;
private bool _isMouseWithin;
private bool _isContextMenuOpen;
Expand Down Expand Up @@ -522,6 +539,13 @@ protected virtual IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lPa

// Determine if our window rect has changed and update the cached values
bool changed = false;
if (_previouslyDeferredWorkArea)
{
// We will get another WM_WINDOWPOSCHANGED when DeferWorkArea is disabled again,
// and we always want to process it
changed = true;
_previouslyDeferredWorkArea = false;
}
if ((wndPos.flags & NativeMethods.SetWindowPosFlags.SWP_NOMOVE) == 0 &&
(wndPos.y != WindowRect.Top || wndPos.x != WindowRect.Left))
{
Expand Down Expand Up @@ -716,12 +740,11 @@ protected internal NativeMethods.Rect GetDesiredRect()
return rect;
}

public bool DeferWorkArea { get; set; }

protected internal bool SetWindowPosition(NativeMethods.Rect newRect)
{
var currentRect = WindowRect;
if (newRect.Top == currentRect.Top &&
if (!_previouslyDeferredWorkArea &&
newRect.Top == currentRect.Top &&
newRect.Left == currentRect.Left &&
newRect.Bottom == currentRect.Bottom &&
newRect.Right == currentRect.Right)
Expand Down