From 96c23315e4469740a17996f106a794f0533e34c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 12 Dec 2025 02:55:02 +0200 Subject: [PATCH] composite: Skip copying parent pixmap contents when possible If the parent window has a different depth (which means pWin can't have valid contents yet) and pWin has effective background other than None. --- composite/compalloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index a0d532ea80..42f9c0ad82 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -527,6 +527,15 @@ compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin) return Success; } +static unsigned +compGetBackgroundState(WindowPtr pWin) +{ + while (pWin->backgroundState == ParentRelative) + pWin = pWin->parent; + + return pWin->backgroundState; +} + static PixmapPtr compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) { @@ -568,7 +577,7 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h) FreeScratchGC(pGC); } } - else { + else if (compGetBackgroundState(pWin) == None) { PictFormatPtr pSrcFormat = PictureWindowFormat(pParent); PictFormatPtr pDstFormat = PictureWindowFormat(pWin); XID inferiors = IncludeInferiors;