mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 13:13:34 +01:00
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)
This commit is contained in:
parent
a81d45df82
commit
1e978e69cc
@ -99,6 +99,9 @@ namespace VeraCrypt
|
||||
Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
|
||||
Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
MainFrame::~MainFrame ()
|
||||
@ -119,6 +122,9 @@ namespace VeraCrypt
|
||||
Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
|
||||
Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
|
||||
Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
|
||||
#ifdef TC_MACOSX
|
||||
Disconnect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
|
||||
#endif
|
||||
Core->VolumeMountedEvent.Disconnect (this);
|
||||
Core->VolumeDismountedEvent.Disconnect (this);
|
||||
Gui->OpenVolumeSystemRequestEvent.Disconnect (this);
|
||||
@ -1723,4 +1729,11 @@ namespace VeraCrypt
|
||||
Core->WipePasswordCache();
|
||||
UpdateWipeCacheButton();
|
||||
}
|
||||
|
||||
#ifdef TC_MACOSX
|
||||
void MainFrame::OnMoveHandler(wxMoveEvent& event)
|
||||
{
|
||||
EnsureVisible (true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -163,7 +163,11 @@ namespace VeraCrypt
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user