Bug 1883004 [Linux] Remove mXWindow member from GtkCompositorWidget and use the one from WindowSurfaceProvider r=emilio

Depends on D203255

Differential Revision: https://phabricator.services.mozilla.com/D203256
This commit is contained in:
stransky 2024-03-04 10:38:55 +00:00
parent b3fb52a4f7
commit d81c2d5b20
3 changed files with 10 additions and 33 deletions

View File

@ -39,11 +39,11 @@ GtkCompositorWidget::GtkCompositorWidget(
"GtkCompositorWidget::mClientSize") {
#if defined(MOZ_X11)
if (GdkIsX11Display()) {
mXWindow = (Window)aInitData.XWindow();
ConfigureX11Backend(mXWindow, aInitData.Shaped());
ConfigureX11Backend((Window)aInitData.XWindow(), aInitData.Shaped());
LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mXWindow %p "
"mIsRenderingSuspended %d\n",
(void*)mWidget.get(), (void*)mXWindow, !!mIsRenderingSuspended);
(void*)mWidget.get(), (void*)aInitData.XWindow(),
!!mIsRenderingSuspended);
}
#endif
#if defined(MOZ_WAYLAND)
@ -123,8 +123,8 @@ EGLNativeWindowType GtkCompositorWidget::GetEGLNativeWindow() {
window = (EGLNativeWindowType)mWidget->GetNativeData(NS_NATIVE_EGL_WINDOW);
}
#if defined(MOZ_X11)
if (mXWindow) {
window = (EGLNativeWindowType)mXWindow;
else {
window = (EGLNativeWindowType)mProvider.GetXWindow();
}
#endif
LOG("GtkCompositorWidget::GetEGLNativeWindow [%p] window %p\n", mWidget.get(),
@ -173,9 +173,6 @@ void GtkCompositorWidget::DisableRendering() {
LOG("GtkCompositorWidget::DisableRendering [%p]\n", (void*)mWidget.get());
mIsRenderingSuspended = true;
mProvider.CleanupResources();
#if defined(MOZ_X11)
mXWindow = {};
#endif
}
#if defined(MOZ_WAYLAND)
@ -187,27 +184,13 @@ bool GtkCompositorWidget::ConfigureWaylandBackend() {
#if defined(MOZ_X11)
bool GtkCompositorWidget::ConfigureX11Backend(Window aXWindow, bool aShaped) {
mXWindow = aXWindow;
// We don't have X window yet.
if (!mXWindow) {
if (!aXWindow) {
mIsRenderingSuspended = true;
return false;
}
// Grab the window's visual and depth
XWindowAttributes windowAttrs;
if (!XGetWindowAttributes(DefaultXDisplay(), mXWindow, &windowAttrs)) {
NS_WARNING("GtkCompositorWidget(): XGetWindowAttributes() failed!");
return false;
}
Visual* visual = windowAttrs.visual;
int depth = windowAttrs.depth;
// Initialize the window surface provider
mProvider.Initialize(mXWindow, visual, depth, aShaped);
return true;
return mProvider.Initialize(aXWindow, aShaped);
}
#endif

View File

@ -84,7 +84,7 @@ class GtkCompositorWidget : public CompositorWidget,
bool SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
#if defined(MOZ_X11)
Window XWindow() const { return mXWindow; }
Window XWindow() const { return mProvider.GetXWindow(); }
#endif
#if defined(MOZ_WAYLAND)
RefPtr<mozilla::layers::NativeLayerRoot> GetNativeLayerRoot() override;
@ -123,11 +123,9 @@ class GtkCompositorWidget : public CompositorWidget,
// of the two.
DataMutex<LayoutDeviceIntSize> mClientSize;
// Holds rendering resources
WindowSurfaceProvider mProvider;
#if defined(MOZ_X11)
Window mXWindow = {};
#endif
#ifdef MOZ_WAYLAND
RefPtr<mozilla::layers::NativeLayerRootWayland> mNativeLayerRoot;
#endif

View File

@ -5875,11 +5875,7 @@ void nsWindow::ConfigureGdkWindow() {
#ifdef MOZ_X11
if (GdkIsX11Display()) {
GdkVisual* gdkVisual = gdk_window_get_visual(mGdkWindow);
Visual* visual = gdk_x11_visual_get_xvisual(gdkVisual);
int depth = gdk_visual_get_depth(gdkVisual);
mSurfaceProvider.Initialize(GetX11Window(), visual, depth,
GetShapedState());
mSurfaceProvider.Initialize(GetX11Window(), GetShapedState());
// Set window manager hint to keep fullscreen windows composited.
//