Skip to content

Commit

Permalink
Merge pull request #288 from mpondo/mr8-TaskBarClose
Browse files Browse the repository at this point in the history
Fix close from taskbar for floating window
  • Loading branch information
Dirkster99 committed Aug 9, 2021
2 parents 6e5eb69 + f4366de commit 457498e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock
Copyright (C) 2007-2013 Xceed Software Inc.
Expand All @@ -16,6 +16,7 @@
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;

namespace AvalonDock.Controls
{
Expand Down Expand Up @@ -142,6 +143,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int
WindowChrome.GetWindowChrome(this).ShowSystemMenu = false;
}
break;

case Win32Helper.WM_CLOSE:
if (CloseInitiatedByUser)
{
// We want to force the window to go through our standard logic for closing.
// So, if the window close is initiated outside of our code (such as from the taskbar),
// we cancel that close and trigger our close logic instead.
this.CloseWindowCommand.Execute(null);
handled = true;
}
break;
}
return base.FilterMessage(hwnd, msg, wParam, lParam, ref handled);
}
Expand Down
3 changes: 2 additions & 1 deletion source/Components/AvalonDock/Win32Helper.cs
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock
Copyright (C) 2007-2013 Xceed Software Inc.
Expand Down Expand Up @@ -153,6 +153,7 @@ internal class WINDOWPOS
internal const int WM_INITMENUPOPUP = 0x0117;
internal const int WM_KEYDOWN = 0x0100;
internal const int WM_KEYUP = 0x0101;
internal const int WM_CLOSE = 0x10;

internal const int WA_INACTIVE = 0x0000;

Expand Down

0 comments on commit 457498e

Please sign in to comment.