set the clip before drawing the root pixmap, and add an ifdef for debugging-like...
authorDana Jansens <danakj@orodu.net>
Sun, 9 Mar 2008 23:41:47 +0000 (19:41 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 9 Mar 2008 23:41:47 +0000 (19:41 -0400)
render.c

index 0a2d479..ad0b8de 100644 (file)
--- a/render.c
+++ b/render.c
@@ -12,6 +12,9 @@
 
 static int plugin_id;
 
+/* if defined, it will not use double buffering */
+#undef MONITOR_REPAINT
+
 typedef struct {
     void (*screen_paint)(d_screen_t *sc);
     void (*screen_root_pixmap_change)(d_screen_t *sc);
@@ -132,8 +135,14 @@ render_init(d_screen_t *sc, int id)
                       sc->super.root, sc->super.width_in_pixels,
                       sc->super.height_in_pixels);
     d->overlay_buffer = xcb_generate_id(sc->dpy->conn);
+#ifdef MONITOR_REPAINT
+    xcb_render_create_picture(sc->dpy->conn,
+                              d->overlay_buffer, sc->overlay, d->root_format,
+                              0, NULL);
+#else
     xcb_render_create_picture(sc->dpy->conn, d->overlay_buffer, px,
                               d->root_format, 0, 0);
+#endif
     xcb_free_pixmap(sc->dpy->conn, px);
 
     d->solid_bg = solid_picture(d, sc, 0xffff, 0x6060, 02020, 0x3030);
@@ -248,11 +257,7 @@ render_update_opacity(d_window_t *w, data_t *d, window_data_t *wd)
                                wd->alpha_picture, c, 1, &rect);
     a = d->shadowalpha;
     a = a * window_get_opacity(w) / 0xffff;
-    //if (w->id == 0x1811453)
-    //    printf("window opacity 0x%x\n", c.alpha);
     c.alpha = a;
-    if (w->id == 0x1811453)
-        printf("shadow opacity 0x%04x\n", c.alpha);
     xcb_render_fill_rectangles(w->sc->dpy->conn,
                                XCB_RENDER_PICT_OP_SRC,
                                wd->shadow_picture, c, 1, &rect);
@@ -626,6 +631,10 @@ render_paint(d_screen_t *sc)
         }
     }
 
+    xcb_xfixes_set_picture_clip_region(sc->dpy->conn,
+                                       d->overlay_buffer,
+                                       d->paint_region,
+                                       0, 0);
     paint_root(sc, d);
 
     for (it = list_bottom(sc->stacking); it; it = it->prev) {
@@ -684,6 +693,7 @@ render_paint(d_screen_t *sc)
                                        0, 0);
 
     /* copy the double buffer to the overlay window */
+#ifndef MONITOR_REPAINT
     xcb_render_composite(sc->dpy->conn,
                          XCB_RENDER_PICT_OP_SRC,
                          d->overlay_buffer,
@@ -693,6 +703,7 @@ render_paint(d_screen_t *sc)
                          0, 0,
                          sc->super.width_in_pixels,
                          sc->super.height_in_pixels);
+#endif
 
     /* empty the damaged region */
     xcb_xfixes_subtract_region(sc->dpy->conn, d->all_region,