Bug 1464679 - X11: Only use _NET_WM_BYPASS_COMPOSITOR hint with Basic compositor. r=karlt
authorRyan Hendrickson <ryan.hendrickson@alum.mit.edu>
Thu, 29 Nov 2018 03:22:10 +0000
changeset 505097 a0315e4606c744555a20bc7e6fc4f3c33bed8463
parent 505096 f5ffebdcc0147b4e95fdec64dbfce46076ce58da
child 505098 d8361a515653d512a52024aa05a4d86e68e065a3
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1464679
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464679 - X11: Only use _NET_WM_BYPASS_COMPOSITOR hint with Basic compositor. r=karlt Differential Revision: https://phabricator.services.mozilla.com/D13284
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3991,25 +3991,16 @@ nsWindow::Create(nsIWidget* aParent,
             if (aInitData->mMouseTransparent) {
               cairo_rectangle_int_t rect = { 0, 0, 0, 0 };
               cairo_region_t *region = cairo_region_create_rectangle(&rect);
 
               gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
               cairo_region_destroy(region);
             }
         }
-
-#ifdef MOZ_X11
-        // Set window manager hint to keep fullscreen windows composited.
-        //
-        // If the window were to get unredirected, there could be visible
-        // tearing because Gecko does not align its framebuffer updates with
-        // vblank.
-        SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
-#endif
     }
         break;
 
     case eWindowType_plugin:
     case eWindowType_plugin_ipc_chrome:
     case eWindowType_plugin_ipc_content:
         MOZ_ASSERT_UNREACHABLE("Unexpected eWindowType_plugin*");
         return NS_ERROR_FAILURE;
@@ -4206,16 +4197,25 @@ nsWindow::Create(nsIWidget* aParent,
 
       GdkVisual* gdkVisual = gdk_window_get_visual(mGdkWindow);
       mXVisual = gdk_x11_visual_get_xvisual(gdkVisual);
       mXDepth = gdk_visual_get_depth(gdkVisual);
       bool shaped = needsAlphaVisual && !mHasAlphaVisual;
 
       mSurfaceProvider.Initialize(mXDisplay, mXWindow, mXVisual, mXDepth,
                                   shaped);
+
+      if (mIsTopLevel) {
+        // Set window manager hint to keep fullscreen windows composited.
+        //
+        // If the window were to get unredirected, there could be visible
+        // tearing because Gecko does not align its framebuffer updates with
+        // vblank.
+        SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
+      }
     }
 #ifdef MOZ_WAYLAND
     else if (!mIsX11Display) {
       mSurfaceProvider.Initialize(this);
     }
 #endif
 #endif
     return NS_OK;
@@ -7395,17 +7395,18 @@ nsWindow::SetProgress(unsigned long prog
                            progressPercent);
 #endif // MOZ_X11
 }
 
 #ifdef MOZ_X11
 void
 nsWindow::SetCompositorHint(WindowComposeRequest aState)
 {
-    if (mIsX11Display) {
+    if (mIsX11Display &&
+        (!GetLayerManager() || GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC)) {
         gulong value = aState;
         GdkAtom cardinal_atom = gdk_x11_xatom_to_atom(XA_CARDINAL);
         gdk_property_change(gtk_widget_get_window(mShell),
                             gdk_atom_intern("_NET_WM_BYPASS_COMPOSITOR", FALSE),
                             cardinal_atom,
                             32, // format
                             GDK_PROP_MODE_REPLACE,
                             (guchar*)&value,