mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 00:34:41 +00:00
[RAPPS] Hide the main window during active download/install if the user closes it (#7014)
This commit is contained in:
parent
2f83e6a65d
commit
053939e27c
7 changed files with 55 additions and 2 deletions
|
@ -318,13 +318,13 @@ CMainWindow::ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lPa
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
if (!InitControls())
|
if (!InitControls())
|
||||||
::PostMessageW(hwnd, WM_CLOSE, 0, 0);
|
::PostMessageW(hwnd, WM_CLOSE, 0, 0);
|
||||||
|
::PostMessageW(hwnd, DM_REPOSITION, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
ShowWindow(SW_HIDE);
|
hMainWnd = NULL;
|
||||||
SaveSettings(hwnd, &SettingsInfo);
|
SaveSettings(hwnd, &SettingsInfo);
|
||||||
|
|
||||||
FreeLogs();
|
FreeLogs();
|
||||||
|
|
||||||
delete m_ClientPanel;
|
delete m_ClientPanel;
|
||||||
|
@ -333,6 +333,19 @@ CMainWindow::ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lPa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
ShowWindow(SW_HIDE);
|
||||||
|
return g_Busy;
|
||||||
|
|
||||||
|
case WM_NOTIFY_OPERATIONCOMPLETED:
|
||||||
|
if (!g_Busy && !IsWindowVisible())
|
||||||
|
SendMessage(WM_CLOSE, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DM_REPOSITION:
|
||||||
|
EmulateDialogReposition(hwnd); // We are not a real dialog, we need help from a real one
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
OnCommand(wParam, lParam);
|
OnCommand(wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,6 +30,8 @@ VOID
|
||||||
CopyTextToClipboard(LPCWSTR lpszText);
|
CopyTextToClipboard(LPCWSTR lpszText);
|
||||||
VOID
|
VOID
|
||||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point = NULL);
|
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point = NULL);
|
||||||
|
VOID
|
||||||
|
EmulateDialogReposition(HWND hwnd);
|
||||||
BOOL
|
BOOL
|
||||||
StartProcess(const CStringW &Path, BOOL Wait);
|
StartProcess(const CStringW &Path, BOOL Wait);
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -13,4 +13,8 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "configparser.h"
|
#include "configparser.h"
|
||||||
|
|
||||||
|
extern LONG g_Busy;
|
||||||
|
|
||||||
|
#define WM_NOTIFY_OPERATIONCOMPLETED (WM_APP + 0)
|
||||||
|
|
||||||
#endif /* _RAPPS_H */
|
#endif /* _RAPPS_H */
|
||||||
|
|
|
@ -470,6 +470,7 @@ CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
g_Busy++;
|
||||||
HICON hIconSm, hIconBg;
|
HICON hIconSm, hIconBg;
|
||||||
CStringW szTempCaption;
|
CStringW szTempCaption;
|
||||||
|
|
||||||
|
@ -557,6 +558,12 @@ CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
g_Busy--;
|
||||||
|
if (hMainWnd)
|
||||||
|
PostMessage(hMainWnd, WM_NOTIFY_OPERATIONCOMPLETED, 0, 0);
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,31 @@ CopyTextToClipboard(LPCWSTR lpszText)
|
||||||
CloseClipboard();
|
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
|
VOID
|
||||||
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point)
|
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem, POINT *Point)
|
||||||
{
|
{
|
||||||
|
|
|
@ -367,6 +367,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
|
||||||
if (hWindow)
|
if (hWindow)
|
||||||
{
|
{
|
||||||
/* Activate the window in the other instance */
|
/* Activate the window in the other instance */
|
||||||
|
ShowWindow(hWindow, SW_SHOW);
|
||||||
SwitchToThisWindow(hWindow, TRUE);
|
SwitchToThisWindow(hWindow, TRUE);
|
||||||
if (bAppwizMode)
|
if (bAppwizMode)
|
||||||
PostMessage(hWindow, WM_COMMAND, ID_ACTIVATE_APPWIZ, 0);
|
PostMessage(hWindow, WM_COMMAND, ID_ACTIVATE_APPWIZ, 0);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <conutils.h>
|
#include <conutils.h>
|
||||||
|
|
||||||
LPCWSTR szWindowClass = L"ROSAPPMGR2";
|
LPCWSTR szWindowClass = L"ROSAPPMGR2";
|
||||||
|
LONG g_Busy = 0;
|
||||||
|
|
||||||
HWND hMainWnd;
|
HWND hMainWnd;
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue