Fix for blank windows on Mac bug 42289. Ensure we only validate regions which we've painted. r=pinkerton

This commit is contained in:
sfraser%netscape.com 2000-07-20 00:13:06 +00:00
Родитель d3b24601dd
Коммит 0e0d0b0819
3 изменённых файлов: 16 добавлений и 14 удалений

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

@ -1094,7 +1094,7 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
//-------------------------------------------------------------------------
PRBool nsMacEventHandler::HandleUpdateEvent(EventRecord& aOSEvent)
{
mTopLevelWidget->HandleUpdateEvent();
mTopLevelWidget->HandleUpdateEvent(nil);
return PR_TRUE;
}

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

@ -1057,11 +1057,15 @@ NS_IMETHODIMP nsWindow::Update()
static PRBool reentrant = PR_FALSE;
if (reentrant)
HandleUpdateEvent();
HandleUpdateEvent(nil);
else
{
reentrant = PR_TRUE;
StRegionFromPool regionToValidate;
if (!regionToValidate)
return NS_ERROR_OUT_OF_MEMORY;
// make a copy of the window update rgn
StRegionFromPool saveUpdateRgn;
if (!saveUpdateRgn)
@ -1073,7 +1077,7 @@ NS_IMETHODIMP nsWindow::Update()
StPortSetter portSetter(mWindowPtr);
::BeginUpdate(mWindowPtr);
HandleUpdateEvent();
HandleUpdateEvent(regionToValidate);
::EndUpdate(mWindowPtr);
// restore the window update rgn
@ -1082,16 +1086,10 @@ NS_IMETHODIMP nsWindow::Update()
// ::CopyRgn(saveUpdateRgn, ((WindowRecord*)mWindowPtr)->updateRgn);
::InvalWindowRgn(mWindowPtr, saveUpdateRgn);
#else
::CopyRgn(saveUpdateRgn, ((WindowRecord*)mWindowPtr)->updateRgn);
::CopyRgn(saveUpdateRgn, ((WindowRecord*)mWindowPtr)->updateRgn);
#endif
// validate the rect of the widget we have just drawn
nsRect bounds = mBounds;
LocalToWindowCoordinate(bounds);
Rect macRect;
nsRectToMacRect(bounds, macRect);
::ValidWindowRect(mWindowPtr, &macRect);
::ValidWindowRgn(mWindowPtr, regionToValidate);
reentrant = PR_FALSE;
}
@ -1219,7 +1217,7 @@ nsWindow :: CountUpdateRect (Rect *inDirtyRect, void* inData)
// Must be called between BeginUpdate/EndUpdate: the window visRgn
// is expected to be set to whatever needs to be drawn.
//-------------------------------------------------------------------------
nsresult nsWindow::HandleUpdateEvent()
nsresult nsWindow::HandleUpdateEvent(RgnHandle regionToValidate)
{
if (! mVisible)
return NS_OK;
@ -1297,6 +1295,10 @@ nsresult nsWindow::HandleUpdateEvent()
printf("update took %g microseconds.\n", double(finish - start));
}
#endif
// Copy updateRgn to regionToValidate
if (regionToValidate)
::CopyRgn(updateRgn, regionToValidate);
}
return NS_OK;
}

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

@ -161,7 +161,7 @@ public:
virtual PRBool DispatchWindowEvent(nsGUIEvent& event);
virtual PRBool DispatchWindowEvent(nsGUIEvent &event,nsEventStatus &aStatus);
virtual nsresult HandleUpdateEvent();
virtual nsresult HandleUpdateEvent(RgnHandle regionToValidate);
virtual void AcceptFocusOnClick(PRBool aBool) { mAcceptFocusOnClick = aBool;};
PRBool AcceptFocusOnClick() { return mAcceptFocusOnClick;};
void Flash(nsPaintEvent &aEvent);