1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Issue 2393 – When restored after operation completed while minimized the window is disabled

https://winscp.net/tracker/2393

Source commit: 4a7927649c3234d1b162cd2f3ad740f8745ba1af
This commit is contained in:
Martin Prikryl
2025-07-26 10:40:20 +00:00
parent 0712b574e1
commit 01ac603abc
2 changed files with 24 additions and 1 deletions

View File

@@ -10384,6 +10384,7 @@ void __fastcall TCustomScpExplorerForm::LockWindow(bool Force)
// Shouldn't we use IsApplicationMinimized() here?
if ((FLockSuspendLevel == 0) && !IsIconic(Application->Handle) && (Force || (Screen->ActiveForm == this)))
{
AppLog(L"Disabling window");
Enabled = false;
}
@@ -10398,6 +10399,7 @@ void __fastcall TCustomScpExplorerForm::UnlockWindow()
if (FLockLevel == 0)
{
DebugAssert(FLockSuspendLevel == 0);
AppLog(L"Re-enabling window");
Enabled = true;
// VCL_COPY (TCustomForm.SetWindowFocus)
if (Active && (ActiveControl != NULL))

View File

@@ -1315,7 +1315,28 @@ static void __fastcall DoApplicationMinimizeRestore(bool Minimize)
{
if (Minimize)
{
Application->Minimize();
// WORKAROUND:
// VCL enables minimized windows (why?) and restores the previous disabled state on restore.
// But if we meanwhile re-enable the window (like when transfer finishes while minimized),
// the VCL will re-disable the window on restore.
// (This does not help in scenario, then the main window is minimized with its own title's minimize window,
// but then it should not be disabled in the first place)
bool WasDisabled = !MainForm->Enabled;
if (WasDisabled)
{
MainForm->Enabled = true;
}
try
{
Application->Minimize();
}
__finally
{
if (WasDisabled)
{
MainForm->Enabled = false;
}
}
MinimizedToTray = WinConfiguration->MinimizeToTray;
}
else