Fix problems with the initial positioning of windows when there is no setting in the config file
This commit is contained in:
parent
9870277f60
commit
8388db4ac4
|
@ -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
|
||||
int X = (GetSystemMetrics( SM_CXSCREEN ) - _this->Width()) / 2;
|
||||
int Y = (GetSystemMetrics( SM_CYSCREEN ) - _this->Height()) / 2;
|
||||
|
||||
g_Settings->LoadDword(UserInterface_MainWindowTop,(DWORD &)Y);
|
||||
g_Settings->LoadDword(UserInterface_MainWindowLeft,(DWORD &)X);
|
||||
|
||||
_this->SetPos(X,Y);
|
||||
|
||||
_this->ChangeWinSize(640,480);
|
||||
|
|
|
@ -1562,9 +1562,18 @@ void CRomBrowser::FixRomListWindow (void)
|
|||
long Style = GetWindowLong(m_MainWindow,GWL_STYLE) | WS_SIZEBOX | WS_MAXIMIZEBOX;
|
||||
SetWindowLong((HWND)m_MainWindow,GWL_STYLE,Style);
|
||||
|
||||
DWORD X, Y;
|
||||
g_Settings->LoadDword(RomBrowser_Top,(DWORD &)Y);
|
||||
//Get the current window size
|
||||
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);
|
||||
|
||||
SetWindowPos(m_MainWindow,NULL,X,Y,0,0,SWP_NOZORDER|SWP_NOSIZE);
|
||||
|
||||
//Fix height and width
|
||||
|
|
Loading…
Reference in New Issue