b=408284 clear transparency bitmap when window is hidden r=roc

--HG--
extra : rebase_source : ac16e4b25da2684fd7fd80a6d16ceb2ae2d4caaf
This commit is contained in:
Karl Tomlinson 2012-10-03 11:37:06 +13:00
parent c8b1517414
commit 0d97afb958
2 changed files with 34 additions and 13 deletions

View File

@ -3877,6 +3877,8 @@ nsWindow::NativeShow(bool aAction)
if (mIsTopLevel) {
gtk_widget_hide(GTK_WIDGET(mShell));
gtk_widget_hide(GTK_WIDGET(mContainer));
ClearTransparencyBitmap(); // Release some resources
}
else if (mContainer) {
gtk_widget_hide(GTK_WIDGET(mContainer));
@ -3993,17 +3995,7 @@ nsWindow::SetTransparencyMode(nsTransparencyMode aMode)
return;
if (!isTransparent) {
if (mTransparencyBitmap) {
delete[] mTransparencyBitmap;
mTransparencyBitmap = nullptr;
mTransparencyBitmapWidth = 0;
mTransparencyBitmapHeight = 0;
#if defined(MOZ_WIDGET_GTK2)
gtk_widget_reset_shapes(mShell);
#else
// GTK3 TODO
#endif
}
ClearTransparencyBitmap();
} // else the new default alpha values are "all 1", so we don't
// need to change anything yet
@ -4303,6 +4295,32 @@ nsWindow::ApplyTransparencyBitmap()
#endif // MOZ_X11
}
void
nsWindow::ClearTransparencyBitmap()
{
if (!mTransparencyBitmap)
return;
delete[] mTransparencyBitmap;
mTransparencyBitmap = nullptr;
mTransparencyBitmapWidth = 0;
mTransparencyBitmapHeight = 0;
if (!mShell)
return;
#ifdef MOZ_X11
GdkWindow *window = gtk_widget_get_window(mShell);
if (!window)
return;
Display* xDisplay = GDK_WINDOW_XDISPLAY(window);
Window xWindow = gdk_x11_window_get_xid(window);
XShapeCombineMask(xDisplay, xWindow, ShapeBounding, 0, 0, None, ShapeSet);
#endif
}
nsresult
nsWindow::UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
uint8_t* aAlphas, int32_t aStride)

View File

@ -281,8 +281,11 @@ public:
NS_IMETHOD OnIMEFocusChange(bool aFocus);
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState);
void ResizeTransparencyBitmap();
void ApplyTransparencyBitmap();
// These methods are for toplevel windows only.
void ResizeTransparencyBitmap();
void ApplyTransparencyBitmap();
void ClearTransparencyBitmap();
virtual void SetTransparencyMode(nsTransparencyMode aMode);
virtual nsTransparencyMode GetTransparencyMode();
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);