VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/MainFrame.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-15 22:08:05 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-12-16 00:46:41 +0100
commit1e978e69cc3fdd3482091c770014646349812023 (patch)
treeca494a0cfc26be5a564963245467593bbd93c8a0 /src/Main/Forms/MainFrame.h
parenta81d45df820887cd9c66fb99d921f73632237bfc (diff)
downloadVeraCrypt-1e978e69cc3fdd3482091c770014646349812023.tar.gz
VeraCrypt-1e978e69cc3fdd3482091c770014646349812023.zip
MacOSX: Ensure that the heading bar is always visible when window is moved so that it can still be moved by user using mouse (https://github.com/veracrypt/VeraCrypt/issues/546)
Diffstat (limited to 'src/Main/Forms/MainFrame.h')
-rw-r--r--src/Main/Forms/MainFrame.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index b8991b73..d481daf5 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -162,8 +162,12 @@ namespace VeraCrypt
void UpdateVolumeList ();
void UpdateWipeCacheButton ();
void WipeCache ();
-
- void EnsureVisible()
+
+#ifdef TC_MACOSX
+ void OnMoveHandler(wxMoveEvent& event);
+#endif
+
+ void EnsureVisible(bool bOnlyHeadingBar = false)
{
wxDisplay display (this);
wxRect displayRect = display.GetClientArea();
@@ -171,14 +175,19 @@ namespace VeraCrypt
bool bMove = false;
wxPoint p = GetScreenPosition();
wxRect r = GetRect ();
- if (p.x < displayRect.x)
+ wxRect rc = GetClientRect ();
+ int titleBarHeight = r.height - rc.height;
+
+ if (!bOnlyHeadingBar && (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)
+ if (!bOnlyHeadingBar && (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)
+ if (!bOnlyHeadingBar && (p.y + r.height > displayRect.y + displayRect.height))
p.y = displayRect.y + displayRect.height - r.height, bMove = true;
+ if (bOnlyHeadingBar && (p.y > (displayRect.y + displayRect.height - titleBarHeight)))
+ p.y = displayRect.y + displayRect.height - titleBarHeight, bMove = true;
if (bMove)
Move (p);
}