VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-05 13:12:25 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-05 16:48:05 +0200
commit53aabf3f14e75762759bf58fbe726934db38ef76 (patch)
treed63c649ff16f714b85ab3d71169c970a55b00cab /src/Common/Dlgcode.c
parentfb9a49cb1afeebfda621774cd381791c78721949 (diff)
downloadVeraCrypt-53aabf3f14e75762759bf58fbe726934db38ef76.tar.gz
VeraCrypt-53aabf3f14e75762759bf58fbe726934db38ef76.zip
Windows: Add option and command line switch to hide waiting dialog when performing operations.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c40
1 files changed, 33 insertions, 7 deletions
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
{