From 47d3ad2b271467f3df33d2189f3194d6b3a1a42c Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Fri, 2 Sep 2016 10:25:38 +0200 Subject: [PATCH] Backed out changeset 2df13967b746 (bug 1289251) --- gfx/gl/GLContextProviderGLX.cpp | 41 ++++++++++---------------------- widget/gtk/X11CompositorWidget.h | 3 --- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 981588632bd5..916c4016d0a5 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -16,7 +16,6 @@ #include "mozilla/MathAlgorithms.h" #include "mozilla/StaticPtr.h" #include "mozilla/widget/CompositorWidget.h" -#include "mozilla/widget/X11CompositorWidget.h" #include "mozilla/Unused.h" #include "prenv.h" @@ -1098,7 +1097,13 @@ GLContextProviderGLX::CreateWrappingExisting(void* aContext, void* aSurface) } already_AddRefed -CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated) +GLContextProviderGLX::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated) +{ + return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated); +} + +already_AddRefed +GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated) { if (!sGLXLibrary.EnsureInitialized()) { return nullptr; @@ -1111,17 +1116,19 @@ CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated) // performance might be suboptimal. But using the existing visual // is a relatively safe intermediate step. - if (!aXDisplay) { + Display* display = (Display*)aWidget->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY); + if (!display) { NS_ERROR("X Display required for GLX Context provider"); return nullptr; } - int xscreen = DefaultScreen(aXDisplay); + int xscreen = DefaultScreen(display); + Window window = GET_NATIVE_WINDOW(aWidget); ScopedXFree cfgs; GLXFBConfig config; int visid; - if (!GLContextGLX::FindFBConfigForWindow(aXDisplay, xscreen, aXWindow, &cfgs, + if (!GLContextGLX::FindFBConfigForWindow(display, xscreen, window, &cfgs, &config, &visid)) { return nullptr; @@ -1131,33 +1138,11 @@ CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated) GLContextGLX* shareContext = GetGlobalContextGLX(); RefPtr gl = GLContextGLX::CreateGLContext(CreateContextFlags::NONE, caps, shareContext, false, - aXDisplay, aXWindow, config, + display, window, config, false); return gl.forget(); } -already_AddRefed -GLContextProviderGLX::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated) -{ - X11CompositorWidget* compWidget = aCompositorWidget->AsX11(); - MOZ_ASSERT(compWidget); - - return CreateForWidget(compWidget->XDisplay(), - compWidget->XWindow(), - aForceAccelerated); -} - -already_AddRefed -GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated) -{ - Display* display = (Display*)aWidget->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY); - Window window = GET_NATIVE_WINDOW(aWidget); - - return CreateForWidget(display, - window, - aForceAccelerated); -} - static bool ChooseConfig(GLXLibrary* glx, Display* display, int screen, const SurfaceCaps& minCaps, ScopedXFree* const out_scopedConfigArr, diff --git a/widget/gtk/X11CompositorWidget.h b/widget/gtk/X11CompositorWidget.h index c0e0edeb3351..fb783ca31ded 100644 --- a/widget/gtk/X11CompositorWidget.h +++ b/widget/gtk/X11CompositorWidget.h @@ -49,9 +49,6 @@ public: X11CompositorWidget* AsX11() override { return this; } CompositorWidgetDelegate* AsDelegate() override { return this; } - Display* XDisplay() const { return mXDisplay; } - Window XWindow() const { return mXWindow; } - protected: nsWindow* mWidget;