From b261dd7d5699ed27556fbf1ed0b146dff4d8b63f Mon Sep 17 00:00:00 2001 From: stransky Date: Wed, 29 Nov 2023 12:08:45 +0000 Subject: [PATCH] Bug 1866669 [Linux/X11] Apply shape mask to parent window (mShell) for non-compositing desktops r=emilio Differential Revision: https://phabricator.services.mozilla.com/D194868 --- widget/gtk/WindowSurfaceX11Image.cpp | 20 +++++++++++++++++++- widget/gtk/WindowSurfaceX11Image.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/widget/gtk/WindowSurfaceX11Image.cpp b/widget/gtk/WindowSurfaceX11Image.cpp index f83b64336cc2..f797bfafad27 100644 --- a/widget/gtk/WindowSurfaceX11Image.cpp +++ b/widget/gtk/WindowSurfaceX11Image.cpp @@ -35,7 +35,21 @@ WindowSurfaceX11Image::WindowSurfaceX11Image(Display* aDisplay, Window aWindow, mTransparencyBitmap(nullptr), mTransparencyBitmapWidth(0), mTransparencyBitmapHeight(0), - mIsShaped(aIsShaped) {} + mIsShaped(aIsShaped), + mWindowParent(0) { + if (!mIsShaped) { + return; + } + + Window root, *children = nullptr; + unsigned int childrenNum; + if (XQueryTree(mDisplay, mWindow, &root, &mWindowParent, &children, + &childrenNum)) { + if (children) { + XFree((char*)children); + } + } +} WindowSurfaceX11Image::~WindowSurfaceX11Image() { if (mTransparencyBitmap) { @@ -206,6 +220,10 @@ void WindowSurfaceX11Image::ApplyTransparencyBitmap() { mTransparencyBitmapHeight); XShapeCombineMask(xDisplay, xDrawable, ShapeBounding, 0, 0, maskPixmap, ShapeSet); + if (mWindowParent) { + XShapeCombineMask(mDisplay, mWindowParent, ShapeBounding, 0, 0, + maskPixmap, ShapeSet); + } XFreePixmap(xDisplay, maskPixmap); } } diff --git a/widget/gtk/WindowSurfaceX11Image.h b/widget/gtk/WindowSurfaceX11Image.h index b8b2a33f0e63..281199b5dd57 100644 --- a/widget/gtk/WindowSurfaceX11Image.h +++ b/widget/gtk/WindowSurfaceX11Image.h @@ -39,6 +39,7 @@ class WindowSurfaceX11Image : public WindowSurfaceX11 { int32_t mTransparencyBitmapWidth; int32_t mTransparencyBitmapHeight; bool mIsShaped; + Window mWindowParent; }; } // namespace widget