diff --git a/Fluent/Internal/WindowSizing.cs b/Fluent/Internal/WindowSizing.cs index 362bf9a60..757246fa2 100644 --- a/Fluent/Internal/WindowSizing.cs +++ b/Fluent/Internal/WindowSizing.cs @@ -75,8 +75,13 @@ private IntPtr HwndHook(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam, switch (message) { - case Constants.WM_STYLECHANGED: - this.FixWindowChromeBugForFreezedMaximizedWindow(); + case Constants.WM_SIZE: + // When window is maximized and was not responding, windows issues another WM_SIZE when window is responding again so we need to shift the window position back and forth + // Fixes #80, #159 and #170 + if (this.GetWindowPlacement().showCmd == 3) + { + this.FixWindowChromeBugForMaximizedWindow(); + } break; case Constants.WM_GETMINMAXINFO: @@ -96,14 +101,6 @@ private WINDOWPLACEMENT GetWindowPlacement() #region Fixes - private void FixWindowChromeBugForFreezedMaximizedWindow() - { - if (this.GetWindowPlacement().showCmd == 3) - { - this.FixWindowChromeBugForMaximizedWindow(); - } - } - private void FixMinMaxInfo(IntPtr hWnd, IntPtr lParam, out bool handled) { if (this.GetWindowPlacement().showCmd == 3) diff --git a/Fluent/Metro/Native/Constants.cs b/Fluent/Metro/Native/Constants.cs index 5f34a6069..69f90b2f8 100644 --- a/Fluent/Metro/Native/Constants.cs +++ b/Fluent/Metro/Native/Constants.cs @@ -13,6 +13,7 @@ internal static class Constants public const int WM_STYLECHANGED = 0x7d; public const int WM_CREATE = 0x0001; public const int WM_NCHITTEST = 0x84; + public const int WM_SIZE = 0x0005; public const long WS_MAXIMIZE = 0x01000000;