diff --git a/i3bar/include/xcb.h b/i3bar/include/xcb.h index af2c8933..2e4b16a8 100644 --- a/i3bar/include/xcb.h +++ b/i3bar/include/xcb.h @@ -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 diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index 02e9d392..15e11faa 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -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); + } +}