private void WmWindowPosChanged (ref Message m)
{
// When a form is minimized/restored:
// * Win32: X and Y are set to negative values/restored,
// size remains the same.
// * X11: Location and Size remain the same.
//
// In both cases we have to fire Resize explicitly here,
// because of the unmodified Size due to which Control
// doesn't fire it.
//
if (window_state != FormWindowState.Minimized && WindowState != FormWindowState.Minimized)
base.WndProc (ref m);
else { // minimized or restored
if (!is_minimizing) {
// Avoid recursive calls here as code in OnSizeChanged might
// cause a WM_WINDOWPOSCHANGED to be sent.
is_minimizing = true;
OnSizeChanged (EventArgs.Empty);
is_minimizing = false;
}
}
if (WindowState == FormWindowState.Normal)
restore_bounds = Bounds;
}