diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2016-05-05 13:12:25 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2016-05-05 16:48:05 +0200 |
commit | 53aabf3f14e75762759bf58fbe726934db38ef76 (patch) | |
tree | d63c649ff16f714b85ab3d71169c970a55b00cab /src/Common | |
parent | fb9a49cb1afeebfda621774cd381791c78721949 (diff) | |
download | VeraCrypt-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')
-rw-r--r-- | src/Common/Dlgcode.c | 40 | ||||
-rw-r--r-- | src/Common/Dlgcode.h | 3 | ||||
-rw-r--r-- | src/Common/Language.xml | 1 |
3 files changed, 37 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
{
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 @@ <string lang="en" key="DISABLE_BOOT_LOADER_PIM_PROMPT">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?</string>
<string lang="en" key="PIM_TOO_BIG">Personal Iterations Multiplier (PIM) maximum value is 2147468.</string>
<control lang="en" key="IDC_SKIP_RESCUE_VERIFICATION">Skip Rescue Disk verification</control>
+ <control lang="en" key="IDC_HIDE_WAITING_DIALOG">Don't show wait message dialog when performing operations</control>
</localization>
<!-- XML Schema -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|