VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Hotkeys.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-21 23:29:35 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-22 00:02:53 (GMT)
commite1157ea935f0d0f115e9dffcb379f137219b85bf (patch)
treeaacd83610fd74170b3c1fa9d790c377d71019798 /src/Mount/Hotkeys.c
parent92674503462fc5336a30d99d358c59bda311f2fa (diff)
downloadVeraCrypt-e1157ea935f0d0f115e9dffcb379f137219b85bf.zip
VeraCrypt-e1157ea935f0d0f115e9dffcb379f137219b85bf.tar.gz
Windows: Solve issue of some dialogs not showing up and that was caused by wrong handling of WM_NOTIFY messages. This behavior appeared after switching to Windows visual styles.
Diffstat (limited to 'src/Mount/Hotkeys.c')
-rw-r--r--src/Mount/Hotkeys.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/Mount/Hotkeys.c b/src/Mount/Hotkeys.c
index c082960..34f980e 100644
--- a/src/Mount/Hotkeys.c
+++ b/src/Mount/Hotkeys.c
@@ -270,25 +270,19 @@ static void DisplayHotkeyList (HWND hwndDlg)
BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hList = GetDlgItem (hwndDlg, IDC_HOTKEY_LIST);
- HWND hwndMainDlg = hwndDlg;
+{
WORD lw = LOWORD (wParam);
WORD hw = HIWORD (wParam);
static BOOL bKeyScanOn;
static BOOL bTPlaySoundOnSuccessfulHkDismount;
static BOOL bTDisplayBalloonOnSuccessfulHkDismount;
- while (GetParent (hwndMainDlg) != NULL)
- {
- hwndMainDlg = GetParent (hwndMainDlg);
- }
-
switch (msg)
{
case WM_INITDIALOG:
{
LVCOLUMNW col;
+ HWND hList = GetDlgItem (hwndDlg, IDC_HOTKEY_LIST);
bKeyScanOn = FALSE;
nSelectedHotkeyId = -1;
@@ -354,16 +348,8 @@ BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
return 1;
}
- case WM_COMMAND:
case WM_NOTIFY:
-
- if (lw == IDC_HOTKEY_KEY && hw == EN_CHANGE)
- {
- if (!bKeyScanOn && nSelectedHotkeyId < 0 && GetWindowTextLengthW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY)))
- SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
- }
-
- if (msg == WM_NOTIFY && wParam == IDC_HOTKEY_LIST)
+ if (wParam == IDC_HOTKEY_LIST)
{
if (((LPNMHDR) lParam)->code == LVN_ITEMACTIVATE
|| ((LPNMHDR) lParam)->code == LVN_ITEMCHANGED && (((LPNMLISTVIEW) lParam)->uNewState & LVIS_FOCUSED))
@@ -381,6 +367,15 @@ BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
}
+ return 0;
+
+ case WM_COMMAND:
+ if (lw == IDC_HOTKEY_KEY && hw == EN_CHANGE)
+ {
+ if (!bKeyScanOn && nSelectedHotkeyId < 0 && GetWindowTextLengthW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY)))
+ SetWindowTextW (GetDlgItem (hwndDlg, IDC_HOTKEY_KEY), L"");
+ }
+
if (lw == IDC_HOTKEY_ASSIGN)
{
BOOL bOwnActiveShortcut = FALSE;
@@ -502,6 +497,12 @@ BOOL CALLBACK HotkeysDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (lw == IDOK)
{
+ HWND hwndMainDlg = hwndDlg;
+
+ while (GetParent (hwndMainDlg) != NULL)
+ {
+ hwndMainDlg = GetParent (hwndMainDlg);
+ }
UnregisterAllHotkeys (hwndMainDlg, Hotkeys);
memcpy (Hotkeys, tmpHotkeys, sizeof(Hotkeys));
RegisterAllHotkeys (hwndMainDlg, Hotkeys);