[PATCH 2/3] xcompmgr: prevent flicker on root background pixmap change

Forest Bond forest.bond at outpostembedded.com
Sat Jun 12 15:39:47 PDT 2010


Changes to the root background pixmap would previously cause the new
image to flicker into visibility briefy before windows were redrawn
over it.  This patch fixes this by dropping a XClearWindow call and
providing a new function ("damage_screen") to force a redraw of the
entire screen.

Signed-off-by: Forest Bond <forest at alittletooquiet.net>
---
 xcompmgr.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xcompmgr.c b/xcompmgr.c
index 3a01cce..47f5667 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -128,6 +128,7 @@ static int		composite_event, composite_error;
 static int		render_event, render_error;
 static Bool		synchronize;
 static int		composite_opcode;
+static Bool		screen_damaged = False;
 
 /* find these once and be done with it */
 static Atom		opacityAtom;
@@ -947,7 +948,7 @@ paint_all (Display *dpy, XserverRegion region)
 	    continue;
 #endif
 	/* never painted, ignore it */
-	if (!w->damaged)
+	if ((!screen_damaged) && (!w->damaged))
 	    continue;
 	/* if invisible, ignore it */
 	if (w->a.x + w->a.width < 1 || w->a.y + w->a.height < 1
@@ -1120,6 +1121,7 @@ paint_all (Display *dpy, XserverRegion region)
 	XRenderComposite (dpy, PictOpSrc, rootBuffer, None, rootPicture,
 			  0, 0, 0, 0, 0, 0, root_width, root_height);
     }
+    screen_damaged = False;
 }
 
 static void
@@ -1738,6 +1740,22 @@ damage_win (Display *dpy, XDamageNotifyEvent *de)
 	repair_win (dpy, w);
 }
 
+static void
+damage_screen (Display *dpy)
+{
+	XserverRegion region;
+	XRectangle r;
+
+	r.x = 0;
+	r.y = 0;
+	r.width = root_width;
+	r.height = root_height;
+
+	region = XFixesCreateRegion (dpy, &r, 1);
+	add_damage (dpy, region);
+	screen_damaged = True;
+}
+
 static int
 error (Display *dpy, XErrorEvent *ev)
 {
@@ -2193,9 +2211,10 @@ main (int argc, char **argv)
 		    {
 			if (rootTile)
 			{
-			    XClearArea (dpy, root, 0, 0, 0, 0, True);
 			    XRenderFreePicture (dpy, rootTile);
 			    rootTile = None;
+
+			    damage_screen(dpy);
 			    break;
 			}
 		    }
@@ -2232,12 +2251,13 @@ main (int argc, char **argv)
 	} while (QLength (dpy));
 	if (allDamage && !autoRedirect)
 	{
-	    static int	paint;
 	    paint_all (dpy, allDamage);
-	    paint++;
 	    XSync (dpy, False);
 	    allDamage = None;
 	    clipChanged = False;
 	}
     }
+
+    XClearArea (dpy, root, 0, 0, 0, 0, True);
+    XSync (dpy, False);
 }
-- 
1.7.0.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100612/90323f6b/attachment.pgp>


More information about the xorg-devel mailing list