From 53aabf3f14e75762759bf58fbe726934db38ef76 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 5 May 2016 13:12:25 +0200 Subject: Windows: Add option and command line switch to hide waiting dialog when performing operations. --- src/Common/Dlgcode.c | 40 +++++++++++++++++++++++++++++++++------- src/Common/Dlgcode.h | 3 +++ src/Common/Language.xml | 1 + 3 files changed, 37 insertions(+), 7 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 6958afe9..97dd5247 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -104,6 +104,9 @@ wchar_t *lpszTitle = NULL; BOOL Silent = FALSE; BOOL bPreserveTimestamp = TRUE; BOOL bShowDisconnectedNetworkDrives = FALSE; +BOOL bHideWaitingDialog = FALSE; +BOOL bCmdHideWaitingDialog = FALSE; +BOOL bCmdHideWaitingDialogValid = FALSE; BOOL bStartOnLogon = FALSE; BOOL bMountDevicesOnLogon = FALSE; BOOL bMountFavoritesOnLogon = FALSE; @@ -1686,14 +1689,21 @@ SplashDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefDlgProcW (hwnd, uMsg, wParam, lParam); } +static int g_waitCursorCounter = 0; + void WaitCursor () { static HCURSOR hcWait; if (hcWait == NULL) hcWait = LoadCursor (NULL, IDC_WAIT); - SetCursor (hcWait); - hCursor = hcWait; + + if ((g_waitCursorCounter == 0) || (hCursor != hcWait)) + { + SetCursor (hcWait); + hCursor = hcWait; + } + g_waitCursorCounter++; } void @@ -1702,8 +1712,13 @@ NormalCursor () static HCURSOR hcArrow; if (hcArrow == NULL) hcArrow = LoadCursor (NULL, IDC_ARROW); - SetCursor (hcArrow); - hCursor = NULL; + if (g_waitCursorCounter > 0) + g_waitCursorCounter--; + if (g_waitCursorCounter == 0) + { + SetCursor (hcArrow); + hCursor = NULL; + } } void @@ -1712,8 +1727,12 @@ ArrowWaitCursor () static HCURSOR hcArrowWait; if (hcArrowWait == NULL) hcArrowWait = LoadCursor (NULL, IDC_APPSTARTING); - SetCursor (hcArrowWait); - hCursor = hcArrowWait; + if ((g_waitCursorCounter == 0) || (hCursor != hcArrowWait)) + { + SetCursor (hcArrowWait); + hCursor = hcArrowWait; + } + g_waitCursorCounter++; } void HandCursor () @@ -5399,8 +5418,12 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP threadParam.hBenchDlg = hwndDlg; threadParam.bStatus = FALSE; + WaitCursor (); + ShowWaitDialog (hwndDlg, TRUE, BenchmarkThreadProc, &threadParam); + NormalCursor (); + if (threadParam.bStatus == FALSE) { EndDialog (hwndDlg, IDCLOSE); @@ -7092,13 +7115,16 @@ void BringToForeground(HWND hWnd) void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg) { HWND hParent = (hwnd && bUseHwndAsParent)? hwnd : GetDesktopWindow(); + BOOL bEffectiveHideWaitingDialog = bCmdHideWaitingDialogValid? bCmdHideWaitingDialog : bHideWaitingDialog; WaitThreadParam threadParam; threadParam.callback = callback; threadParam.pArg = pArg; - if (WaitDialogDisplaying) + if (WaitDialogDisplaying || bEffectiveHideWaitingDialog) { + if (!WaitDialogDisplaying) WaitCursor (); callback (pArg, hwnd); + if (!WaitDialogDisplaying) NormalCursor (); } else { diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index d9f29cd0..cf9239e0 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -117,6 +117,9 @@ extern BOOL Silent; extern BOOL bHistory; extern BOOL bPreserveTimestamp; extern BOOL bShowDisconnectedNetworkDrives; +extern BOOL bHideWaitingDialog; +extern BOOL bCmdHideWaitingDialog; +extern BOOL bCmdHideWaitingDialogValid; extern BOOL bStartOnLogon; extern BOOL bMountDevicesOnLogon; extern BOOL bMountFavoritesOnLogon; diff --git a/src/Common/Language.xml b/src/Common/Language.xml index b64e8568..add35c7a 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1398,6 +1398,7 @@ WARNING: Please keep in mind that if you enable this option, the PIM value will be stored unencrypted on the disk.\n\nAre you sure you want to enable this option? Personal Iterations Multiplier (PIM) maximum value is 2147468. Skip Rescue Disk verification + Don't show wait message dialog when performing operations -- cgit v1.2.3