Fix problems with the initial positioning of windows when there is no setting in the config file

This commit is contained in:
Emmet Young 2015-02-15 18:10:25 +11:00
parent 9870277f60
commit 8388db4ac4
2 changed files with 13 additions and 2 deletions

View File

@ -519,8 +519,10 @@ DWORD CALLBACK CMainGui::MainGui_Proc (HWND hWnd, DWORD uMsg, DWORD wParam, DWOR
//Move the Main window to the location last executed from or center the window //Move the Main window to the location last executed from or center the window
int X = (GetSystemMetrics( SM_CXSCREEN ) - _this->Width()) / 2; int X = (GetSystemMetrics( SM_CXSCREEN ) - _this->Width()) / 2;
int Y = (GetSystemMetrics( SM_CYSCREEN ) - _this->Height()) / 2; int Y = (GetSystemMetrics( SM_CYSCREEN ) - _this->Height()) / 2;
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y); g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X); g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
_this->SetPos(X,Y); _this->SetPos(X,Y);
_this->ChangeWinSize(640,480); _this->ChangeWinSize(640,480);

View File

@ -1562,9 +1562,18 @@ void CRomBrowser::FixRomListWindow (void)
long Style = GetWindowLong(m_MainWindow,GWL_STYLE) | WS_SIZEBOX | WS_MAXIMIZEBOX; long Style = GetWindowLong(m_MainWindow,GWL_STYLE) | WS_SIZEBOX | WS_MAXIMIZEBOX;
SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style); SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style);
DWORD X, Y; //Get the current window size
g_Settings->LoadDword(RomBrowser_Top,(DWORD &)Y); RECT rect;
GetWindowRect((HWND)m_MainWindow, &rect);
//We find the middle position of the screen, we use this if theres no setting
int X = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
int Y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
//Load the value from settings, if none is available, default to above
g_Settings->LoadDword(RomBrowser_Top, (DWORD &)Y);
g_Settings->LoadDword(RomBrowser_Left,(DWORD &)X); g_Settings->LoadDword(RomBrowser_Left,(DWORD &)X);
SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE); SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
//Fix height and width //Fix height and width