Skip to content

Commit

Permalink
Fixes #170, #80 and #159 by not reacting to WM_STYLECHANGED but WM_SI…
Browse files Browse the repository at this point in the history
…ZE instead
  • Loading branch information
batzen committed Sep 17, 2015
1 parent e1ec8da commit 1d0b6ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Fluent/Internal/WindowSizing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Fluent/Metro/Native/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 1d0b6ba

Please sign in to comment.