From 83ee720817fccac7463d833b977691a14a87f968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 30 Oct 2025 16:45:23 +0100 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 d1342799b..df9cf18e5 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -526,6 +526,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) { @@ -560,7 +569,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;