mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-08-22 12:08:54 -05:00
macOS: add screen protection preference
Persist a macOS-only preference for disabling wx content protection while keeping protection enabled by default. Add a Preferences checkbox that reuses IDC_DISABLE_SCREEN_PROTECTION and reapply the protection state after preference changes. Apply content-protection updates to all current top-level wx windows so changing the preference while a modal dialog is active does not leave the main frame or other windows with stale protection state.
This commit is contained in:
@@ -479,7 +479,11 @@ namespace VeraCrypt
|
||||
|
||||
void MainFrame::InitWindowPrivacy ()
|
||||
{
|
||||
Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture);
|
||||
bool enableContentProtection = !CmdLine->ArgAllowScreencapture;
|
||||
#ifdef TC_MACOSX
|
||||
enableContentProtection = enableContentProtection && !GetPreferences().DisableScreenProtection;
|
||||
#endif
|
||||
Gui->SetContentProtection (enableContentProtection);
|
||||
}
|
||||
|
||||
void MainFrame::InitPreferences ()
|
||||
@@ -1296,6 +1300,7 @@ namespace VeraCrypt
|
||||
if (Gui->IsInBackgroundMode() && !prefs.BackgroundTaskEnabled)
|
||||
Close (true);
|
||||
|
||||
InitWindowPrivacy();
|
||||
SavePreferences();
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,21 @@ namespace VeraCrypt
|
||||
TC_CHECK_BOX_VALIDATOR (WipeCacheOnAutoDismount);
|
||||
TC_CHECK_BOX_VALIDATOR (WipeCacheOnClose);
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
wxStaticBoxSizer *screenProtectionSizer = new wxStaticBoxSizer (new wxStaticBox (SecurityPage, wxID_ANY, LangString["IDT_SECURITY_OPTIONS"]), wxVERTICAL);
|
||||
DisableScreenProtectionCheckBox = new wxCheckBox (screenProtectionSizer->GetStaticBox(), wxID_ANY, LangString["IDC_DISABLE_SCREEN_PROTECTION"]);
|
||||
DisableScreenProtectionCheckBox->SetToolTip (LangString["DISABLE_SCREEN_PROTECTION_WARNING"]);
|
||||
screenProtectionSizer->Add (DisableScreenProtectionCheckBox, 0, wxALL, 5);
|
||||
SecurityPage->GetSizer()->Add (screenProtectionSizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10);
|
||||
TC_CHECK_BOX_VALIDATOR (DisableScreenProtection);
|
||||
DisableScreenProtectionCheckBox->Bind (wxEVT_CHECKBOX,
|
||||
[] (wxCommandEvent& event)
|
||||
{
|
||||
if (event.IsChecked())
|
||||
Gui->ShowWarning ("DISABLE_SCREEN_PROTECTION_WARNING");
|
||||
});
|
||||
#endif
|
||||
|
||||
// Mount options
|
||||
CachePasswordsCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.CachePassword));
|
||||
MountReadOnlyCheckBox->SetValue (Preferences.DefaultMountOptions.Protection == VolumeProtection::ReadOnly);
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace VeraCrypt
|
||||
KeyfilesPanel *DefaultKeyfilesPanel;
|
||||
#ifdef TC_LINUX
|
||||
wxCheckBox *MountNtfsWithKernelDriverCheckBox;
|
||||
#endif
|
||||
#ifdef TC_MACOSX
|
||||
wxCheckBox *DisableScreenProtectionCheckBox;
|
||||
#endif
|
||||
int LastVirtualKeyPressed;
|
||||
unique_ptr <wxTimer> mTimer;
|
||||
|
||||
Reference in New Issue
Block a user