[CPL][APPWIZ] Make gecko download cancellable by keyboard (#3726)

We shouldn't disable nor hide the control with focus. CORE-17550, CORE-5737
This commit is contained in:
Katayama Hirofumi MZ 2021-06-05 18:21:25 +09:00 committed by GitHub
parent ae574e16f8
commit 2106bc4a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -388,9 +388,17 @@ static DWORD WINAPI download_proc(PVOID arg)
static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hwndProgress, hwndInstallButton;
switch(msg) {
case WM_INITDIALOG:
ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_HIDE);
hwndProgress = GetDlgItem(hwnd, ID_DWL_PROGRESS);
if (hwndProgress == GetFocus()) /* Avoid CORE-5737 */
{
SendMessageW(hwnd, WM_NEXTDLGCTL, 0, FALSE);
}
ShowWindow(hwndProgress, SW_HIDE);
install_dialog = hwnd;
return TRUE;
@ -410,7 +418,15 @@ static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
case ID_DWL_INSTALL:
ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
/* CORE-17550: Never leave focus on a disabled control (Old/New/Thing p.228) */
hwndInstallButton = GetDlgItem(hwnd, ID_DWL_INSTALL);
if (hwndInstallButton == GetFocus())
{
SendMessageW(hwnd, WM_NEXTDLGCTL, 0, FALSE);
}
EnableWindow(hwndInstallButton, FALSE);
CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL));
return FALSE;
}