Bug 1447270 - Use GLContextGLX::FindVisual() on GLX enabled builds only, r?jhorak
MozReview-Commit-ID: HB86kRurkDG
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3636,44 +3636,48 @@ nsWindow::Create(nsIWidget* aParent,
bool useAlphaVisual = (mWindowType == eWindowType_popup &&
aInitData->mSupportTranslucency);
// mozilla.widget.use-argb-visuals is a hidden pref defaulting to false
// to allow experimentation
if (Preferences::GetBool("mozilla.widget.use-argb-visuals", false))
useAlphaVisual = true;
+#ifdef GL_PROVIDER_GLX
bool useWebRender = gfxPlatform::Initialized() &&
gfx::gfxVars::UseWebRender() &&
AllowWebRenderForThisWindow();
// If using WebRender on X11, we need to select a visual with a depth buffer,
// as well as an alpha channel if transparency is requested. This must be done
// before the widget is realized.
if (mIsX11Display && useWebRender) {
auto display =
GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(mShell));
auto screen = gtk_widget_get_screen(mShell);
int screenNumber = GDK_SCREEN_XNUMBER(screen);
int visualId = 0;
-
if (GLContextGLX::FindVisual(display, screenNumber,
useWebRender, useAlphaVisual,
&visualId)) {
// If we're using CSD, rendering will go through mContainer, but
// it will inherit this visual as it is a child of mShell.
gtk_widget_set_visual(mShell,
gdk_x11_screen_lookup_visual(screen,
visualId));
}
- } else if (useAlphaVisual) {
- GdkScreen *screen = gtk_widget_get_screen(mShell);
- if (gdk_screen_is_composited(screen)) {
- GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
- gtk_widget_set_visual(mShell, visual);
+ } else
+#endif // GL_PROVIDER_GLX
+ {
+ if (useAlphaVisual) {
+ GdkScreen *screen = gtk_widget_get_screen(mShell);
+ if (gdk_screen_is_composited(screen)) {
+ GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
+ gtk_widget_set_visual(mShell, visual);
+ }
}
}
// 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.
NativeResize();