mirror of https://github.com/BOINC/boinc.git
MGR: Prevent zero-size window in a rare situation where registry values have accidentally been set to zero
This commit is contained in:
parent
401aa50b04
commit
5c9e012d5b
|
@ -984,6 +984,9 @@ bool CBOINCGUIApp::SetActiveGUI(int iGUISelection, bool bShowWindow) {
|
|||
m_pConfig->Read(wxT("XPos"), &iLeft, 30);
|
||||
m_pConfig->Read(wxT("Width"), &iWidth, 800);
|
||||
m_pConfig->Read(wxT("Height"), &iHeight, 600);
|
||||
// Guard against a rare situation where registry values are zero
|
||||
if (iWidth < 50) iWidth = 800;
|
||||
if (iHeight < 50) iHeight = 600;
|
||||
} else {
|
||||
m_pConfig->SetPath(wxT("/Simple"));
|
||||
m_pConfig->Read(wxT("YPos"), &iTop, 30);
|
||||
|
|
|
@ -763,6 +763,9 @@ void CDlgEventLog::GetWindowDimensions( wxPoint& position, wxSize& size ) {
|
|||
pConfig->Read(wxT("Width"), &iWidth, 640);
|
||||
pConfig->Read(wxT("Height"), &iHeight, 480);
|
||||
|
||||
// Guard against a rare situation where registry values are zero
|
||||
if (iWidth < 50) iWidth = 640;
|
||||
if (iHeight < 50) iHeight = 480;
|
||||
position.y = iTop;
|
||||
position.x = iLeft;
|
||||
size.x = iWidth;
|
||||
|
|
|
@ -129,6 +129,10 @@ bool CDlgItemProperties::RestoreState() {
|
|||
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
|
||||
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
|
||||
|
||||
// Guard against a rare situation where registry values are zero
|
||||
if ((iWidth < 50) && (iWidth != wxDefaultCoord)) iWidth = wxDefaultCoord;
|
||||
if ((iHeight < 50) && (iHeight != wxDefaultCoord)) iHeight = wxDefaultCoord;
|
||||
|
||||
#ifndef __WXMAC__
|
||||
// Set size to saved values or defaults if no saved values
|
||||
SetSize(iWidth, iHeight);
|
||||
|
|
|
@ -597,6 +597,10 @@ void CDlgMessages::RestoreWindowDimensions() {
|
|||
pConfig->Read(wxT("WindowIconized"), &bWindowIconized, false);
|
||||
pConfig->Read(wxT("WindowMaximized"), &bWindowMaximized, false);
|
||||
|
||||
// Guard against a rare situation where registry values are zero
|
||||
if (iWidth < 50) iWidth = 640;
|
||||
if (iHeight < 50) iHeight = 480;
|
||||
|
||||
#ifndef __WXMAC__
|
||||
|
||||
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
|
||||
|
|
Loading…
Reference in New Issue