When setting window size, don't add hardcoded chrome values 16/38 when running under win32. Instead calculate those values dynamically.

Nicky 2012-06-08 20:56:52 +02:00
parent 0c47c379f0
commit 8e0bc37f42
4 changed files with 34 additions and 8 deletions

View File

@ -210,6 +210,12 @@ protected:
void handleUnicodeUTF16(U16 utf16, MASK mask);
friend class LLWindowManager;
// <FS:ND> Allow to query for window chrome sizes. Default it none, only win32 windows override this.
public:
virtual void getWindowChrome( U32 &aChromeW, U32 &aChromeH )
{ aChromeW = aChromeH = 0; }
// </FS:ND>
};

View File

@ -3837,5 +3837,24 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
return std::vector<std::string>();
}
// <FS:ND> Allow to query for window chrome sizes.
void LLWindowWin32::getWindowChrome( U32 &aChromeW, U32 &aChromeH )
{
LLWindow::getWindowChrome( aChromeW, aChromeH );
RECT oClient, oWindow;
if( !::GetClientRect( mWindowHandle, &oClient ) || !::GetWindowRect( mWindowHandle, &oWindow ) )
return;
U32 nHeight = oWindow.bottom - oWindow.top;
U32 nWidth = oWindow.right - oWindow.left;
U32 nCHeight = oClient.bottom - oClient.top;
U32 nCWidth = oClient.right - oClient.left;
aChromeW = nWidth - nCWidth;
aChromeH = nHeight - nCHeight;
}
// </FS:ND>
#endif // LL_WINDOWS

View File

@ -214,6 +214,10 @@ protected:
U32 mKeyVirtualKey;
friend class LLWindowManager;
// <FS:ND> Allow to query for window chrome sizes.
public:
virtual void getWindowChrome( U32 &aChromeW, U32 &aChromeH );
// </FS:ND>
};
class LLSplashScreenWin32 : public LLSplashScreen

View File

@ -4299,15 +4299,12 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
// {
// gViewerWindow->getWindow()->setSize(new_size.convert());
// }
#ifdef LL_WINDOWS
// The Windows functions get the size wrong. The OS X and Linux
// versions don't.
new_width += 16;
new_height += 38;
#endif // LL_WINDOWS
U32 nChromeW(0), nChromeH(0);
gViewerWindow->getWindow()->getWindowChrome( nChromeW, nChromeH );
LLCoordScreen new_size;
new_size.mX = new_width;
new_size.mY = new_height;
new_size.mX = new_width + nChromeW;
new_size.mY = new_height + nChromeH;
gViewerWindow->getWindow()->setSize(new_size);
// FS:TS FIRE-6182 end
}