[xserver-commit] xserver/composite compinit.c,1.4,1.5 compint.h,1.3,1.4 compwindow.c,1.4,1.5

Keith Packard xserver-commit@pdx.freedesktop.org
Sat, 08 Nov 2003 23:06:01 -0800


Committed by: keithp

Update of /cvs/xserver/xserver/composite
In directory pdx:/tmp/cvs-serv8142/composite

Modified Files:
	compinit.c compint.h compwindow.c 
Log Message:
	* composite/compinit.c: (compCloseScreen), (compScreenInit):
	* composite/compint.h:
	* composite/compwindow.c: (compCheckWindow),
	(compPaintWindowBackground), (compDestroyWindow):
	* damageext/damageext.c: (DamageExtNotify), (DamageExtDestroy),
	(ProcDamageSubtract), (FreeDamageExt), (FreeDamageExtWin):
	* dix/window.c: (SetBorderSize):
	* miext/damage/damage.c: (damageDamageRegion), (damageDamageBox),
	(damageDestroyPixmap), (damagePaintWindow), (damageCopyWindow),
	(damageRestoreAreas), (damageSetWindowPixmap),
	(damageDestroyWindow), (DamageSetup), (DamageCreate),
	(DamageRegister), (DamageUnregister), (DamageSubtract),
	(DamageDamageRegion):
	* miext/damage/damagestr.h:
	* render/mirect.c: (miColorRects):

	Wrap PaintWindowBackground in composite extension to
	disable painting window background in manual Subwindows mode.

	compDestroyWindow needed to refetch cw and csw because
	CompFreeClientWindow/compFreeClientSubwindows zeroed them.

	Damage must store all damage in window relative
	coordinates so that damage tracks window movement.  I doubt
	this will work "right" with bitGravity, apps are likely to
	lose in that case anyway.

	Check for clientGone before trying to write events.

	Better checking for freeing datastructures in various orders

	dix/window.c: oops.  Was setting wrong region in COMPOSITE side
	of SetBorderSize.

	Damage must be associated with windows, not just underlying pixmap
	in case that changes.  Wrap SetWindowPixmap to track changes
	to window pixmaps (and DestroyWindow as well).

	Don't smash PaintWindow/CopyWindow regions in damageDamageRegion.
	Also, translate region back for those cases.

	render/mirect.c: track subWindowMode (oops)


Index: compinit.c
===================================================================
RCS file: /cvs/xserver/xserver/composite/compinit.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- compinit.c	7 Nov 2003 23:29:29 -0000	1.4
+++ compinit.c	9 Nov 2003 07:05:59 -0000	1.5
@@ -41,6 +41,7 @@
     pScreen->CloseScreen = cs->CloseScreen;
     pScreen->BlockHandler = cs->BlockHandler;
     pScreen->ReparentWindow = cs->ReparentWindow;
+    pScreen->PaintWindowBackground = cs->PaintWindowBackground;
     pScreen->UnrealizeWindow = cs->UnrealizeWindow;
     pScreen->RealizeWindow = cs->RealizeWindow;
     pScreen->DestroyWindow = cs->DestroyWindow;
@@ -132,6 +133,9 @@
     cs->UnrealizeWindow = pScreen->UnrealizeWindow;
     pScreen->UnrealizeWindow = compUnrealizeWindow;
 
+    cs->PaintWindowBackground = pScreen->PaintWindowBackground;
+    pScreen->PaintWindowBackground = compPaintWindowBackground;
+
     cs->ReparentWindow = pScreen->ReparentWindow;
     pScreen->ReparentWindow = compReparentWindow;
 

Index: compint.h
===================================================================
RCS file: /cvs/xserver/xserver/composite/compint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- compint.h	7 Nov 2003 23:29:29 -0000	1.3
+++ compint.h	9 Nov 2003 07:05:59 -0000	1.4
@@ -80,6 +80,7 @@
     DestroyWindowProcPtr	DestroyWindow;
     RealizeWindowProcPtr	RealizeWindow;
     UnrealizeWindowProcPtr	UnrealizeWindow;
+    PaintWindowProcPtr		PaintWindowBackground;
     ReparentWindowProcPtr	ReparentWindow;
     ScreenBlockHandlerProcPtr	BlockHandler;
     CloseScreenProcPtr		CloseScreen;
@@ -178,6 +179,9 @@
 compUnrealizeWindow (WindowPtr pWin);
 
 void
+compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
+
+void
 compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent);
 
 Bool

Index: compwindow.c
===================================================================
RCS file: /cvs/xserver/xserver/composite/compwindow.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- compwindow.c	7 Nov 2003 23:29:29 -0000	1.4
+++ compwindow.c	9 Nov 2003 07:05:59 -0000	1.5
@@ -33,23 +33,28 @@
 compCheckWindow (WindowPtr pWin, pointer data)
 {
     ScreenPtr	pScreen = pWin->drawable.pScreen;
+    PixmapPtr	pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
+    PixmapPtr	pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
+    PixmapPtr	pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
     
     if (!pWin->parent)
     {
 	assert (!pWin->redirectDraw);
-	assert ((*pScreen->GetWindowPixmap) (pWin) ==
-		(*pScreen->GetScreenPixmap) (pScreen));
+	assert (pWinPixmap == pScreenPixmap);
     }
     else if (pWin->redirectDraw)
     {
-	assert ((*pScreen->GetWindowPixmap) (pWin) !=
-		(*pScreen->GetWindowPixmap) (pWin->parent));
+	assert (pWinPixmap != pParentPixmap);
+	assert (pWinPixmap != pScreenPixmap);
     }
     else
     {
-	assert ((*pScreen->GetWindowPixmap) (pWin) ==
-		(*pScreen->GetWindowPixmap) (pWin->parent));
+	assert (pWinPixmap == pParentPixmap);
     }
+    assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
+    assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
+    if (pParentPixmap)
+	assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
     return WT_WALKCHILDREN;
 }
 
@@ -151,6 +156,21 @@
 }
 
 void
+compPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what)
+{
+    ScreenPtr		pScreen = pWin->drawable.pScreen;
+    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
+    CompScreenPtr	cs = GetCompScreen (pScreen);
+    
+    if (csw && csw->update == CompositeRedirectManual)
+	return;
+    pScreen->PaintWindowBackground = cs->PaintWindowBackground;
+    (*pScreen->PaintWindowBackground) (pWin, pRegion, what);
+    cs->PaintWindowBackground = pScreen->PaintWindowBackground;
+    pScreen->PaintWindowBackground = compPaintWindowBackground;
+}
+
+void
 compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
 {
     ScreenPtr		pScreen = pWin->drawable.pScreen;
@@ -242,25 +262,22 @@
 {
     ScreenPtr		pScreen = pWin->drawable.pScreen;
     CompScreenPtr	cs = GetCompScreen (pScreen);
-    CompWindowPtr	cw = GetCompWindow (pWin);
-    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);
-    CompClientWindowPtr ccw;
+    CompWindowPtr	cw;
+    CompSubwindowsPtr	csw;
     Bool		ret;
 
     pScreen->DestroyWindow = cs->DestroyWindow;
-    if (cw)
-	while ((ccw = cw->clients))
-	    FreeResource (ccw->id, RT_NONE);
-    if (csw)
-	while ((ccw = csw->clients))
-	    FreeResource (ccw->id, RT_NONE);
+    while ((cw = GetCompWindow (pWin)))
+	FreeResource (cw->clients->id, RT_NONE);
+    while ((csw = GetCompSubwindows (pWin)))
+	FreeResource (csw->clients->id, RT_NONE);
     
     if (pWin->redirectDraw)
 	compFreePixmap (pWin);
     ret = (*pScreen->DestroyWindow) (pWin);
     cs->DestroyWindow = pScreen->DestroyWindow;
     pScreen->DestroyWindow = compDestroyWindow;
-    compCheckTree (pWin->drawable.pScreen);
+/*    compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
     return ret;
 }