Cache the last size of the nsWindow on WIN32 to determine how much to invalidate when widget is resized. Also added checks to see if width or height actually changed before invalidating b=33799 r=buster@netscape.com

This commit is contained in:
kmcclusk%netscape.com 2000-05-11 22:59:20 +00:00
Родитель 5898c54054
Коммит 8cdb172384
2 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -327,8 +327,9 @@ nsWindow::nsWindow() : nsBaseWidget()
mWindowType = eWindowType_child;
mBorderStyle = eBorderStyle_default;
mBorderlessParent = 0;
mIsInMouseCapture = PR_FALSE;
mLastSize.width = 0;
mLastSize.height = 0;
mIMEProperty = 0;
mIMEIsComposing = PR_FALSE;
@ -341,6 +342,7 @@ nsWindow::nsWindow() : nsBaseWidget()
mIMECompClauseStringSize = 0;
mIMECompClauseStringLength = 0;
static BOOL gbInitHKL = FALSE;
if(! gbInitHKL)
{
@ -2884,40 +2886,38 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
newWidth = PRInt32(r.right - r.left);
newHeight = PRInt32(r.bottom - r.top);
nsRect rect(wp->x, wp->y, newWidth, newHeight);
//if (newWidth != mBounds.width)
if (newWidth != mLastSize.width)
{
RECT drect;
//getting wider
drect.left = wp->x + mBounds.width;
drect.top = wp->y;
drect.right = drect.left + (newWidth - mBounds.width);
drect.left = wp->x + mLastSize.width;
drect.top = wp->y;
drect.right = drect.left + (newWidth - mLastSize.width);
drect.bottom = drect.top + newHeight;
// ::InvalidateRect(mWnd, NULL, FALSE);
// ::InvalidateRect(mWnd, &drect, FALSE);
::RedrawWindow(mWnd, &drect, NULL,
RDW_INVALIDATE | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ERASENOW | RDW_ALLCHILDREN);
}
//if (newHeight != mBounds.height)
if (newHeight != mLastSize.height)
{
RECT drect;
//getting taller
drect.left = wp->x;
drect.top = wp->y + mBounds.height;
drect.top = wp->y + mLastSize.height;
drect.right = drect.left + newWidth;
drect.bottom = drect.top + (newHeight - mBounds.height);
drect.bottom = drect.top + (newHeight - mLastSize.height);
// ::InvalidateRect(mWnd, NULL, FALSE);
// ::InvalidateRect(mWnd, &drect, FALSE);
::RedrawWindow(mWnd, &drect, NULL,
RDW_INVALIDATE | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ERASENOW | RDW_ALLCHILDREN);
}
mBounds.width = newWidth;
mBounds.height = newHeight;
mLastSize.width = newWidth;
mLastSize.height = newHeight;
///nsRect rect(wp->x, wp->y, wp->cx, wp->cy);
// recalculate the width and height

Просмотреть файл

@ -257,6 +257,7 @@ private:
#endif
protected:
nsSize mLastSize;
static nsWindow* gCurrentWindow;
PRBool mIsTopWidgetWindow;
nsPoint mLastPoint;