]> git.sur5r.net Git - i3/i3/commitdiff
Only copy the double-buffer on expose-events
authorAxel Wagner <mail@merovius.de>
Sun, 22 Aug 2010 08:24:32 +0000 (10:24 +0200)
committerAxel Wagner <mail@merovius.de>
Sun, 22 Aug 2010 08:24:32 +0000 (10:24 +0200)
i3bar/include/xcb.h
i3bar/src/xcb.c

index af2c89336b110ca8a5a66092202bb4a95aa07aeb..2e4b16a88a8679107d6657509e6b5f675b4b7aa6 100644 (file)
@@ -48,6 +48,12 @@ void reconfig_windows();
  */
 void draw_bars();
 
+/*
+ * Redraw the bars, i.e. simply copy the buffer to the barwindow
+ *
+ */
+void redraw_bars();
+
 /*
  * Calculate the rendered width of a string with the configured font.
  * The string has to be encoded in ucs2 and glyph_len has to be the length
index 02e9d3921734f7f401c38f730c85ac76061c87df..15e11faa33ee17f5e3b970db940138b4de95986d 100644 (file)
@@ -157,7 +157,7 @@ void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
     switch (event->response_type & ~0x80) {
         case XCB_EXPOSE:
             /* Expose-events happen, when the window needs to be redrawn */
-            draw_bars();
+            redraw_bars();
             break;
         case XCB_BUTTON_PRESS:
             /* Button-press-events are mouse-buttons clicked on one of our bars */
@@ -569,3 +569,22 @@ void draw_bars() {
         i = 0;
     }
 }
+
+/*
+ * Redraw the bars, i.e. simply copy the buffer to the barwindow
+ *
+ */
+void redraw_bars() {
+    i3_output *outputs_walk;
+    SLIST_FOREACH(outputs_walk, outputs, slist) {
+        xcb_copy_area(xcb_connection,
+                      outputs_walk->buffer,
+                      outputs_walk->bar,
+                      outputs_walk->bargc,
+                      0, 0,
+                      0, 0,
+                      outputs_walk->rect.w,
+                      outputs_walk->rect.h);
+        xcb_flush(xcb_connection);
+    }            
+}