[PATCH 3/5] Add logging of window ops enabled via DEBUG_WINDOWS.

Forest Bond forest at alittletooquiet.net
Sun Jun 13 08:58:26 PDT 2010


Some extra debug logging is implemented, enabled by defining
DEBUG_WINDOWS.  Existing window logging (dump_wins) is uncommented and
instead also made conditional on DEBUG_WINDOWS.

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

diff --git a/xcompmgr.c b/xcompmgr.c
index 1f6b450..bd731f0 100644
--- a/xcompmgr.c
+++ b/xcompmgr.c
@@ -156,6 +156,7 @@ static conv		*gaussianMap;
 
 #define TRANS_OPACITY	0.75
 
+#define DEBUG_WINDOWS 0
 #define DEBUG_REPAINT 0
 #define DEBUG_EVENTS 0
 #define MONITOR_REPAINT 0
@@ -1182,6 +1183,10 @@ map_win (Display *dpy, Window id, unsigned long sequence, Bool fade)
 {
     win		*w = find_win (dpy, id);
 
+#if DEBUG_WINDOWS
+    printf ("map_win: 0x%x\n", w->id);
+#endif
+
     if (!w)
 	return;
 
@@ -1207,6 +1212,9 @@ map_win (Display *dpy, Window id, unsigned long sequence, Bool fade)
 static void
 finish_unmap_win (Display *dpy, win *w)
 {
+#if DEBUG_WINDOWS
+    printf ("finish_unmap_win: 0x%x\n", w->id);
+#endif
     w->damaged = 0;
 #if CAN_DO_USABLE
     w->usable = False;
@@ -1268,6 +1276,11 @@ static void
 unmap_win (Display *dpy, Window id, Bool fade)
 {
     win *w = find_win (dpy, id);
+
+#if DEBUG_WINDOWS
+    printf ("unmap_win: 0x%x\n", w->id);
+#endif
+
     if (!w)
 	return;
     w->a.map_state = IsUnmapped;
@@ -1432,6 +1445,10 @@ add_win (Display *dpy, Window id, Window prev)
     win				*new = malloc (sizeof (win));
     win				**p;
     
+#if DEBUG_WINDOWS
+    printf ("add_win: 0x%x\n", id);
+#endif
+
     if (!new)
 	return;
     if (prev)
@@ -1447,6 +1464,9 @@ add_win (Display *dpy, Window id, Window prev)
     if (!XGetWindowAttributes (dpy, id, &new->a))
     {
 	free (new);
+#if DEBUG_WINDOWS
+	printf ("not adding 0x%x: failed to get attributes\n", new->id);
+#endif
 	return;
     }
     new->damaged = 0;
@@ -1494,6 +1514,10 @@ restack_win (Display *dpy, win *w, Window new_above)
 {
     Window  old_above;
     
+#if DEBUG_WINDOWS
+    printf("restack_win: 0x%x\n", w->id);
+#endif
+
     if (w->next)
 	old_above = w->next->id;
     else
@@ -1606,6 +1630,10 @@ finish_destroy_win (Display *dpy, Window id, Bool gone)
 {
     win	**prev, *w;
 
+#if DEBUG_WINDOWS
+    printf ("finish_destroy_win: 0x%x\n", id);
+#endif
+
     for (prev = &list; (w = *prev); prev = &w->next)
 	if (w->id == id)
 	{
@@ -1657,6 +1685,9 @@ static void
 destroy_win (Display *dpy, Window id, Bool gone, Bool fade)
 {
     win *w = find_win (dpy, id);
+#if DEBUG_WINDOWS
+    printf ("destroy_win: 0x%x\n", w->id);
+#endif
 #if HAS_NAME_WINDOW_PIXMAP
     if (w && w->pixmap && fade && fadeWindows)
 	set_fade (dpy, w, w->opacity*1.0/OPAQUE, 0.0, fade_out_step, destroy_callback, gone, False, True);
@@ -1667,7 +1698,7 @@ destroy_win (Display *dpy, Window id, Bool gone, Bool fade)
     }
 }
 
-/*
+#if DEBUG_WINDOWS
 static void
 dump_win (win *w)
 {
@@ -1685,7 +1716,7 @@ dump_wins (void)
     for (w = list; w; w = w->next)
 	dump_win (w);
 }
-*/
+#endif
 
 static void
 damage_win (Display *dpy, XDamageNotifyEvent *de)
@@ -2147,7 +2178,9 @@ main (int argc, char **argv)
 	paint_all (dpy, None);
     for (;;)
     {
-	/*	dump_wins (); */
+#if DEBUG_WINDOWS
+	dump_wins ();
+#endif
 	do {
 	    if (autoRedirect)
 		XFlush (dpy);
-- 
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/20100613/bec10e56/attachment.pgp>


More information about the xorg-devel mailing list