Bug 768400 - clear win32 transparent windows when hidden so stale content isn't briefly displayed when they are reshown. r=roc

This commit is contained in:
Jim Mathies 2012-07-12 06:39:21 -05:00
parent 49fd13eb7d
commit 5af245a56b
2 changed files with 16 additions and 0 deletions

View File

@ -1155,6 +1155,11 @@ NS_METHOD nsWindow::Show(bool bState)
::SendMessageW(mWnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS | UISF_HIDEACCEL), 0);
}
} else {
// Clear contents to avoid ghosting of old content if we display
// this window again.
if (wasVisible && mTransparencyMode == eTransparencyTransparent) {
ClearTranslucentWindow();
}
if (mWindowType != eWindowType_dialog) {
::ShowWindow(mWnd, SW_HIDE);
} else {
@ -7454,6 +7459,16 @@ void nsWindow::SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode)
}
}
void nsWindow::ClearTranslucentWindow()
{
if (mTransparentSurface) {
nsRefPtr<gfxContext> thebesContext = new gfxContext(mTransparentSurface);
thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR);
thebesContext->Paint();
UpdateTranslucentWindow();
}
}
nsresult nsWindow::UpdateTranslucentWindow()
{
if (mBounds.IsEmpty())

View File

@ -431,6 +431,7 @@ private:
nsTransparencyMode GetWindowTranslucencyInner() const { return mTransparencyMode; }
void ResizeTranslucentWindow(PRInt32 aNewWidth, PRInt32 aNewHeight, bool force = false);
nsresult UpdateTranslucentWindow();
void ClearTranslucentWindow();
void SetupTranslucentWindowMemoryBitmap(nsTransparencyMode aMode);
void UpdateGlass();
protected: