VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-15 17:59:38 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-16 00:46:34 +0100
commita81d45df820887cd9c66fb99d921f73632237bfc (patch)
tree08f072a9eb3244559a83358b7c9e42d17de9fe11 /src/Main/Forms
parenta4ed6be38c58a009a480a81931676273a78e36fb (diff)
downloadVeraCrypt-a81d45df820887cd9c66fb99d921f73632237bfc.tar.gz
VeraCrypt-a81d45df820887cd9c66fb99d921f73632237bfc.zip
MacOSX: Ensure that main window is visible on screen when About is display as a way to workaround for situations where UI is not visible or can't be move (for example, when changing display monitor with a different resolution).
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--src/Main/Forms/MainFrame.cpp1
-rw-r--r--src/Main/Forms/MainFrame.h21
2 files changed, 22 insertions, 0 deletions
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 9abe2552..8e0c401b 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -725,6 +725,7 @@ namespace VeraCrypt
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
+ EnsureVisible ();
#endif
AboutDialog dialog (this);
dialog.ShowModal();
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index 39c411ad..b8991b73 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -15,6 +15,7 @@
#include "Forms.h"
#include "ChangePasswordDialog.h"
+#include <wx/display.h>
namespace VeraCrypt
{
@@ -161,6 +162,26 @@ namespace VeraCrypt
void UpdateVolumeList ();
void UpdateWipeCacheButton ();
void WipeCache ();
+
+ void EnsureVisible()
+ {
+ wxDisplay display (this);
+ wxRect displayRect = display.GetClientArea();
+
+ bool bMove = false;
+ wxPoint p = GetScreenPosition();
+ wxRect r = GetRect ();
+ if (p.x < displayRect.x)
+ p.x = 0, bMove = true;
+ if (p.y < displayRect.y)
+ p.y = displayRect.y, bMove = true;
+ if (p.x + r.width > displayRect.x + displayRect.width)
+ p.x = displayRect.x + displayRect.width - r.width, bMove = true;
+ if (p.y + r.height > displayRect.y + displayRect.height)
+ p.y = displayRect.y + displayRect.height - r.height, bMove = true;
+ if (bMove)
+ Move (p);
+ }
struct VolumeActivityMapEntry
{