Bug 1469716 SetTransparentMode: warn only when requesting translucency without support r=stransky
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 19 Nov 2019 23:57:47 +0000
changeset 502769 79821df172391d2d9ab224951b36bd8856df0fb1
parent 502768 e55213821970c55c7f4b703b4cde196334e27dc0
child 502770 53d116eb2adb6d25ba5ef3664127c2f204652466
push id36823
push usermalexandru@mozilla.com
push dateWed, 20 Nov 2019 09:47:58 +0000
treeherdermozilla-central@79821df17239 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1469716
milestone72.0a1
first release with
nightly linux32
79821df17239 / 72.0a1 / 20191120094758 / files
nightly linux64
79821df17239 / 72.0a1 / 20191120094758 / files
nightly mac
79821df17239 / 72.0a1 / 20191120094758 / files
nightly win32
79821df17239 / 72.0a1 / 20191120094758 / files
nightly win64
79821df17239 / 72.0a1 / 20191120094758 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1469716 SetTransparentMode: warn only when requesting translucency without support r=stransky Differential Revision: https://phabricator.services.mozilla.com/D53391
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3782,19 +3782,20 @@ nsresult nsWindow::Create(nsIWidget* aPa
           GdkVisual* visual = gdk_screen_get_rgba_visual(screen);
           if (visual) {
             gtk_widget_set_visual(mShell, visual);
             mHasAlphaVisual = true;
           }
         }
       }
 
-      // We have a toplevel window with transparency. Mark it as transparent
-      // now as nsWindow::SetTransparencyMode() can't be called after
-      // nsWindow is created (Bug 1344839).
+      // We have a toplevel window with transparency.
+      // Calls to UpdateTitlebarTransparencyBitmap() from OnExposeEvent()
+      // occur before SetTransparencyMode() receives eTransparencyTransparent
+      // from layout, so set mIsTransparent here.
       if (mWindowType == eWindowType_toplevel &&
           (mHasAlphaVisual || mTransparencyBitmapForTitlebar)) {
         mIsTransparent = true;
       }
 
       // We only move a general managed toplevel window if someone has
       // actually placed the window somewhere.  If no placement has taken
       // place, we just let the window manager Do The Right Thing.
@@ -4557,17 +4558,23 @@ void nsWindow::SetTransparencyMode(nsTra
   bool isTransparent = aMode == eTransparencyTransparent;
 
   if (mIsTransparent == isTransparent) {
     return;
   }
   LOG(("nsWindow::SetTransparencyMode [%p] mode %d\n", this, (int)aMode));
 
   if (mWindowType != eWindowType_popup) {
-    NS_WARNING("Cannot set transparency mode on non-popup windows.");
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=1344839 reported
+    // problems cleaning the layer manager for toplevel windows.
+    // Ignore the request so as to workaround that.
+    // mIsTransparent is set in Create() if transparency may be required.
+    if (isTransparent) {
+      NS_WARNING("Transparent mode not supported on non-popup windows.");
+    }
     return;
   }
 
   if (!isTransparent) {
     ClearTransparencyBitmap();
   }  // else the new default alpha values are "all 1", so we don't
   // need to change anything yet