VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/Main/Forms/MainFrame.cpp13
-rw-r--r--src/Main/Forms/MainFrame.h19
2 files changed, 27 insertions, 5 deletions
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 8e0c401b..25853193 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -99,6 +99,9 @@ namespace VeraCrypt
99 Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); 99 Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
100 Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); 100 Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
101 101
102#ifdef TC_MACOSX
103 Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
104#endif
102 } 105 }
103 106
104 MainFrame::~MainFrame () 107 MainFrame::~MainFrame ()
@@ -119,6 +122,9 @@ namespace VeraCrypt
119 Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); 122 Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
120 Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); 123 Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
121 Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); 124 Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
125#ifdef TC_MACOSX
126 Disconnect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) );
127#endif
122 Core->VolumeMountedEvent.Disconnect (this); 128 Core->VolumeMountedEvent.Disconnect (this);
123 Core->VolumeDismountedEvent.Disconnect (this); 129 Core->VolumeDismountedEvent.Disconnect (this);
124 Gui->OpenVolumeSystemRequestEvent.Disconnect (this); 130 Gui->OpenVolumeSystemRequestEvent.Disconnect (this);
@@ -1723,4 +1729,11 @@ namespace VeraCrypt
1723 Core->WipePasswordCache(); 1729 Core->WipePasswordCache();
1724 UpdateWipeCacheButton(); 1730 UpdateWipeCacheButton();
1725 } 1731 }
1732
1733#ifdef TC_MACOSX
1734 void MainFrame::OnMoveHandler(wxMoveEvent& event)
1735 {
1736 EnsureVisible (true);
1737 }
1738#endif
1726} 1739}
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
162 void UpdateVolumeList (); 162 void UpdateVolumeList ();
163 void UpdateWipeCacheButton (); 163 void UpdateWipeCacheButton ();
164 void WipeCache (); 164 void WipeCache ();
165 165
166 void EnsureVisible() 166#ifdef TC_MACOSX
167 void OnMoveHandler(wxMoveEvent& event);
168#endif
169
170 void EnsureVisible(bool bOnlyHeadingBar = false)
167 { 171 {
168 wxDisplay display (this); 172 wxDisplay display (this);
169 wxRect displayRect = display.GetClientArea(); 173 wxRect displayRect = display.GetClientArea();
@@ -171,14 +175,19 @@ namespace VeraCrypt
171 bool bMove = false; 175 bool bMove = false;
172 wxPoint p = GetScreenPosition(); 176 wxPoint p = GetScreenPosition();
173 wxRect r = GetRect (); 177 wxRect r = GetRect ();
174 if (p.x < displayRect.x) 178 wxRect rc = GetClientRect ();
179 int titleBarHeight = r.height - rc.height;
180
181 if (!bOnlyHeadingBar && (p.x < displayRect.x))
175 p.x = 0, bMove = true; 182 p.x = 0, bMove = true;
176 if (p.y < displayRect.y) 183 if (p.y < displayRect.y)
177 p.y = displayRect.y, bMove = true; 184 p.y = displayRect.y, bMove = true;
178 if (p.x + r.width > displayRect.x + displayRect.width) 185 if (!bOnlyHeadingBar && (p.x + r.width > displayRect.x + displayRect.width))
179 p.x = displayRect.x + displayRect.width - r.width, bMove = true; 186 p.x = displayRect.x + displayRect.width - r.width, bMove = true;
180 if (p.y + r.height > displayRect.y + displayRect.height) 187 if (!bOnlyHeadingBar && (p.y + r.height > displayRect.y + displayRect.height))
181 p.y = displayRect.y + displayRect.height - r.height, bMove = true; 188 p.y = displayRect.y + displayRect.height - r.height, bMove = true;
189 if (bOnlyHeadingBar && (p.y > (displayRect.y + displayRect.height - titleBarHeight)))
190 p.y = displayRect.y + displayRect.height - titleBarHeight, bMove = true;
182 if (bMove) 191 if (bMove)
183 Move (p); 192 Move (p);
184 } 193 }