private void HandleWindowPosChanged(IntPtr hwnd, IntPtr lParam)
{
var windowpos = (WINDOWPOS)Marshal.PtrToStructure(lParam, typeof(WINDOWPOS));
//Debug.WriteLine("Chrome {0} windowpos flags {1}.", _borderWindow.Id, ClearUndefined(windowpos.flags));
if ((windowpos.flags & SetWindowPosOptions.SWP_NOSIZE) != SetWindowPosOptions.SWP_NOSIZE)
{
SetRegion(hwnd, windowpos.cx, windowpos.cy, false);
}
if (_borderWindow != null)
{
// The override is for a window with owner and the owner window minimizes.
// In this case the window is hidden with SWP_HIDEWINDOW but not actually minimized
// so the code detects the show/hide flags here as the override
if ((windowpos.flags & SetWindowPosOptions.SWP_HIDEWINDOW) == SetWindowPosOptions.SWP_HIDEWINDOW)
{
_hideOverride = true;
}
if ((windowpos.flags & SetWindowPosOptions.SWP_SHOWWINDOW) == SetWindowPosOptions.SWP_SHOWWINDOW)
{
_hideOverride = false;
}
if (_contentShown)
{
_borderWindow.RepositionToContent(hwnd, _hideOverride);
}
}
}