Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix close from taskbar for floating window #288

Merged
merged 1 commit into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock

Copyright (C) 2007-2013 Xceed Software Inc.
Expand All @@ -16,6 +16,7 @@ This program is provided to you under the terms of the Microsoft Public
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
Original file line number Diff line number Diff line change
@@ -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