[PTRun] Fix always show after executing context menu result (#21291)

* fix always show

* add tests

* remove workaround
This commit is contained in:
Henrik Lau Eriksson
2022-10-25 23:27:18 +02:00
committed by GitHub
parent a3042b8435
commit 460f242967
10 changed files with 111 additions and 32 deletions

View File

@@ -42,9 +42,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
return false;
}
// As a workaround to close PT Run after executing the context menu command, we switch to the window before closing it (Issue #16601).
// We use the setting OpenAfterKillAndClose to detect if we have to switch.
windowData.CloseThisWindow(!WindowWalkerSettings.Instance.OpenAfterKillAndClose);
windowData.CloseThisWindow();
return !WindowWalkerSettings.Instance.OpenAfterKillAndClose;
},
@@ -102,12 +100,6 @@ namespace Microsoft.Plugin.WindowWalker.Components
}
}
// As a workaround to close PT Run before executing the command, we switch to the window before killing it's process
if (!WindowWalkerSettings.Instance.OpenAfterKillAndClose)
{
window.SwitchToWindow();
}
// Kill process
window.Process.KillThisProcess(WindowWalkerSettings.Instance.KillProcessTree);
return !WindowWalkerSettings.Instance.OpenAfterKillAndClose;

View File

@@ -237,13 +237,8 @@ namespace Microsoft.Plugin.WindowWalker.Components
/// <summary>
/// Closes the window
/// </summary>
internal void CloseThisWindow(bool switchBeforeClose)
internal void CloseThisWindow()
{
if (switchBeforeClose)
{
SwitchToWindow();
}
_ = NativeMethods.SendMessage(Hwnd, Win32Constants.WM_SYSCOMMAND, Win32Constants.SC_CLOSE);
}