[RAPPS] Hide the main window during active download/install if the user closes it (#7014)

This commit is contained in:
Whindmar Saksit 2024-09-26 18:58:30 +02:00 committed by GitHub
parent 2f83e6a65d
commit 053939e27c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 55 additions and 2 deletions

View file

@ -39,6 +39,31 @@ CopyTextToClipboard(LPCWSTR lpszText)
CloseClipboard();
}
static INT_PTR CALLBACK
NothingDlgProc(HWND hDlg, UINT uMsg, WPARAM, LPARAM)
{
return uMsg == WM_CLOSE ? DestroyWindow(hDlg) : FALSE;
}
VOID
EmulateDialogReposition(HWND hwnd)
{
static const DWORD DlgTmpl[] = { WS_POPUP | WS_CAPTION | WS_SYSMENU, 0, 0, 0, 0, 0 };
HWND hDlg = CreateDialogIndirectW(NULL, (LPDLGTEMPLATE)DlgTmpl, NULL, NothingDlgProc);
if (hDlg)
{
RECT r;
GetWindowRect(hwnd, &r);
if (SetWindowPos(hDlg, hDlg, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE))
{
SendMessage(hDlg, DM_REPOSITION, 0, 0);
if (GetWindowRect(hDlg, &r))
SetWindowPos(hwnd, hwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
}
SendMessage(hDlg, WM_CLOSE, 0, 0);
}
}
VOID
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point)
{