mirror of https://github.com/snes9xgit/snes9x.git
Win32: Use accurate calculation for client area->window size conversion (gocha)
This commit is contained in:
parent
46bc2d4c5c
commit
695e4b6b8e
|
@ -776,26 +776,12 @@ void WinPreSave(ConfigFile& conf)
|
|||
if(GUI.window_size.bottom < 10) GUI.window_size.bottom = 10;
|
||||
if(GUI.window_size.right < 10) GUI.window_size.right = 10;
|
||||
|
||||
/*if(!Settings.SoundPlaybackRate) {Settings.SoundPlaybackRate = 6; GUI.Mute = TRUE;}
|
||||
else if(Settings.SoundPlaybackRate <= 8000) Settings.SoundPlaybackRate = 1;
|
||||
else if(Settings.SoundPlaybackRate <= 11025) Settings.SoundPlaybackRate = 2;
|
||||
else if(Settings.SoundPlaybackRate <= 16000) Settings.SoundPlaybackRate = 3;
|
||||
else if(Settings.SoundPlaybackRate <= 22050) Settings.SoundPlaybackRate = 4;
|
||||
else if(Settings.SoundPlaybackRate <= 30000) Settings.SoundPlaybackRate = 5;
|
||||
else if(Settings.SoundPlaybackRate <= 32000) Settings.SoundPlaybackRate = 6;
|
||||
else if(Settings.SoundPlaybackRate <= 35000) Settings.SoundPlaybackRate = 7;
|
||||
else if(Settings.SoundPlaybackRate <= 44100) Settings.SoundPlaybackRate = 8;
|
||||
else Settings.SoundPlaybackRate = 9;*/
|
||||
conf.DeleteKey("Sound::Mono");
|
||||
if(configSort == 2)
|
||||
conf.ClearLines();
|
||||
}
|
||||
void WinPostSave(ConfigFile& conf)
|
||||
{
|
||||
/*if(GUI.window_size.left < -30) GUI.window_size.left = -30;
|
||||
if(GUI.window_size.top < -30) GUI.window_size.top = -30;
|
||||
if(GUI.window_size.left+GUI.window_size.right > GetSystemMetrics(SM_CXSCREEN)+30) GUI.window_size.left = GetSystemMetrics(SM_CXSCREEN)+30-GUI.window_size.right;
|
||||
if(GUI.window_size.top+GUI.window_size.bottom > GetSystemMetrics(SM_CYSCREEN)+30) GUI.window_size.top = GetSystemMetrics(SM_CYSCREEN)+30-GUI.window_size.bottom;*/
|
||||
int extra_width = 2*(GetSystemMetrics(SM_CXBORDER) +
|
||||
GetSystemMetrics(SM_CXDLGFRAME));
|
||||
int extra_height = 2*(GetSystemMetrics(SM_CYBORDER) +
|
||||
|
@ -809,17 +795,6 @@ void WinPostSave(ConfigFile& conf)
|
|||
GUI.window_size.bottom += GUI.window_size.top;
|
||||
GUI.window_size.right += extra_width;
|
||||
GUI.window_size.bottom += extra_height;
|
||||
/*switch(Settings.SoundPlaybackRate){
|
||||
case 1: Settings.SoundPlaybackRate = 8000; break;
|
||||
case 2: Settings.SoundPlaybackRate = 11025; break;
|
||||
case 3: Settings.SoundPlaybackRate = 16000; break;
|
||||
case 4: Settings.SoundPlaybackRate = 22050; break;
|
||||
case 5: Settings.SoundPlaybackRate = 30000; break;
|
||||
case 6: Settings.SoundPlaybackRate = 32000; break;
|
||||
case 7: Settings.SoundPlaybackRate = 35000; break;
|
||||
case 8: Settings.SoundPlaybackRate = 44100; break;
|
||||
case 9: Settings.SoundPlaybackRate = 48000; break;
|
||||
}*/
|
||||
Settings.ShutdownMaster = preSaveShutdownMaster; // revert temp change
|
||||
}
|
||||
void WinPostLoad(ConfigFile& conf)
|
||||
|
|
|
@ -2058,15 +2058,17 @@ LRESULT CALLBACK WinProc(
|
|||
case ID_WINDOW_SIZE_2X:
|
||||
case ID_WINDOW_SIZE_3X:
|
||||
case ID_WINDOW_SIZE_4X:
|
||||
UINT factor,newWidth,newHeight;
|
||||
UINT factor, newWidth, newHeight;
|
||||
RECT margins;
|
||||
factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1;
|
||||
newWidth = GUI.AspectWidth * factor;
|
||||
newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor;
|
||||
newWidth += 2*(GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME));
|
||||
newHeight += 2*(GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYDLGFRAME)) +
|
||||
GetSystemMetrics(SM_CYCAPTION) + (GUI.HideMenu ? 0 : (GetSystemMetrics(SM_CYMENU) +
|
||||
(factor<2 ? GetSystemMetrics(SM_CYMENU) : 0)));
|
||||
SetWindowPos(GUI.hWnd,0,0,0,newWidth,newHeight,SWP_NOMOVE);
|
||||
|
||||
margins = GetWindowMargins(GUI.hWnd,newWidth);
|
||||
newHeight += margins.top + margins.bottom;
|
||||
newWidth += margins.left + margins.right;
|
||||
|
||||
SetWindowPos(GUI.hWnd, NULL, 0, 0, newWidth, newHeight, SWP_NOMOVE);
|
||||
break;
|
||||
case ID_WINDOW_STRETCH:
|
||||
GUI.Stretch = !GUI.Stretch;
|
||||
|
@ -4167,6 +4169,27 @@ void S9xSetRecentGames ()
|
|||
}
|
||||
}
|
||||
|
||||
RECT GetWindowMargins(HWND hwnd, UINT width)
|
||||
{
|
||||
RECT rcMargins = {0,0,0,0};
|
||||
|
||||
AdjustWindowRectEx(&rcMargins, GetWindowStyle(hwnd), !GUI.HideMenu, GetWindowExStyle(hwnd));
|
||||
|
||||
rcMargins.left = abs(rcMargins.left);
|
||||
rcMargins.top = abs(rcMargins.top);
|
||||
|
||||
if (!GUI.HideMenu) {
|
||||
RECT rcTemp = {0,0,width,0x7FFF}; // 0x7FFF="Infinite" height
|
||||
SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rcTemp);
|
||||
|
||||
// Adjust our previous calculation to compensate for menu
|
||||
// wrapping.
|
||||
rcMargins.top = rcTemp.top;
|
||||
}
|
||||
|
||||
return rcMargins;
|
||||
}
|
||||
|
||||
void WinDeleteRecentGamesList ()
|
||||
{
|
||||
for(int i=0;i<MAX_RECENT_GAMES_LIST_SIZE;i++)
|
||||
|
|
|
@ -584,5 +584,6 @@ const char* GetFilterName(RenderFilter filterID);
|
|||
int GetFilterScale(RenderFilter filterID);
|
||||
bool GetFilterHiResSupport(RenderFilter filterID);
|
||||
const TCHAR * S9xGetDirectoryT (enum s9x_getdirtype);
|
||||
RECT GetWindowMargins(HWND hwnd, UINT width);
|
||||
|
||||
#endif // !defined(SNES9X_H_INCLUDED)
|
||||
|
|
Loading…
Reference in New Issue