From da4c7e7ed675c3bf405668739c3012d140856109 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:42 +0200 Subject: Adding upstream version 126.0. Signed-off-by: Daniel Baumann --- widget/gtk/GtkCompositorWidget.cpp | 50 +++++++++++++++----------------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'widget/gtk/GtkCompositorWidget.cpp') diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp index 36559cfd54..073ad5248f 100644 --- a/widget/gtk/GtkCompositorWidget.cpp +++ b/widget/gtk/GtkCompositorWidget.cpp @@ -7,6 +7,7 @@ #include "mozilla/gfx/gfxVars.h" #include "mozilla/layers/CompositorThread.h" +#include "mozilla/WidgetUtilsGtk.h" #include "mozilla/widget/InProcessCompositorWidget.h" #include "mozilla/widget/PlatformWidgetTypes.h" #include "nsWindow.h" @@ -40,25 +41,22 @@ GtkCompositorWidget::GtkCompositorWidget( #if defined(MOZ_X11) if (GdkIsX11Display()) { ConfigureX11Backend((Window)aInitData.XWindow(), aInitData.Shaped()); - LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mXWindow %p " - "mIsRenderingSuspended %d\n", - (void*)mWidget.get(), (void*)aInitData.XWindow(), - !!mIsRenderingSuspended); + LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mXWindow %p\n", + (void*)mWidget.get(), (void*)aInitData.XWindow()); } #endif #if defined(MOZ_WAYLAND) if (GdkIsWaylandDisplay()) { ConfigureWaylandBackend(); - LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mWidget %p " - "mIsRenderingSuspended %d\n", - (void*)mWidget.get(), (void*)mWidget, !!mIsRenderingSuspended); + LOG("GtkCompositorWidget::GtkCompositorWidget() [%p] mWidget %p\n", + (void*)mWidget.get(), (void*)mWidget); } #endif } GtkCompositorWidget::~GtkCompositorWidget() { LOG("GtkCompositorWidget::~GtkCompositorWidget [%p]\n", (void*)mWidget.get()); - DisableRendering(); + CleanupResources(); RefPtr widget = mWidget.forget(); NS_ReleaseOnMainThread("GtkCompositorWidget::mWidget", widget.forget()); } @@ -169,57 +167,47 @@ GtkCompositorWidget::GetNativeLayerRoot() { } #endif -void GtkCompositorWidget::DisableRendering() { - LOG("GtkCompositorWidget::DisableRendering [%p]\n", (void*)mWidget.get()); - mIsRenderingSuspended = true; +void GtkCompositorWidget::CleanupResources() { + LOG("GtkCompositorWidget::CleanupResources [%p]\n", (void*)mWidget.get()); mProvider.CleanupResources(); } #if defined(MOZ_WAYLAND) -bool GtkCompositorWidget::ConfigureWaylandBackend() { +void GtkCompositorWidget::ConfigureWaylandBackend() { mProvider.Initialize(this); - return true; } #endif #if defined(MOZ_X11) -bool GtkCompositorWidget::ConfigureX11Backend(Window aXWindow, bool aShaped) { +void GtkCompositorWidget::ConfigureX11Backend(Window aXWindow, bool aShaped) { // We don't have X window yet. if (!aXWindow) { - mIsRenderingSuspended = true; - return false; + mProvider.CleanupResources(); + return; } // Initialize the window surface provider - return mProvider.Initialize(aXWindow, aShaped); + mProvider.Initialize(aXWindow, aShaped); } #endif -void GtkCompositorWidget::EnableRendering(const uintptr_t aXWindow, - const bool aShaped) { - LOG("GtkCompositorWidget::EnableRendering() [%p]\n", mWidget.get()); +void GtkCompositorWidget::SetRenderingSurface(const uintptr_t aXWindow, + const bool aShaped) { + LOG("GtkCompositorWidget::SetRenderingSurface() [%p]\n", mWidget.get()); - if (!mIsRenderingSuspended) { - LOG(" quit, mIsRenderingSuspended = false\n"); - return; - } #if defined(MOZ_WAYLAND) if (GdkIsWaylandDisplay()) { LOG(" configure widget %p\n", mWidget.get()); - if (!ConfigureWaylandBackend()) { - return; - } + ConfigureWaylandBackend(); } #endif #if defined(MOZ_X11) if (GdkIsX11Display()) { LOG(" configure XWindow %p shaped %d\n", (void*)aXWindow, aShaped); - if (!ConfigureX11Backend((Window)aXWindow, aShaped)) { - return; - } + ConfigureX11Backend((Window)aXWindow, aShaped); } #endif - mIsRenderingSuspended = false; } + #ifdef MOZ_LOGGING bool GtkCompositorWidget::IsPopup() { return mWidget ? mWidget->IsPopup() : false; -- cgit v1.2.3