+bar_print_legacy(struct swm_region *r, const char *s)
+{
+ xcb_rectangle_t rect;
+ uint32_t gcv[1];
+ XGCValues gcvd;
+ int x = 0;
+ size_t len;
+ XRectangle ibox, lbox;
+ GC draw;
+
+ len = strlen(s);
+ XmbTextExtents(bar_fs, s, len, &ibox, &lbox);
+
+ switch (bar_justify) {
+ case SWM_BAR_JUSTIFY_LEFT:
+ x = SWM_BAR_OFFSET;
+ break;
+ case SWM_BAR_JUSTIFY_CENTER:
+ x = (WIDTH(r) - lbox.width) / 2;
+ break;
+ case SWM_BAR_JUSTIFY_RIGHT:
+ x = WIDTH(r) - lbox.width - SWM_BAR_OFFSET;
+ break;
+ }
+
+ if (x < SWM_BAR_OFFSET)
+ x = SWM_BAR_OFFSET;
+
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = WIDTH(r->bar);
+ rect.height = HEIGHT(r->bar);
+
+ /* clear back buffer */
+ gcv[0] = r->s->c[SWM_S_COLOR_BAR].pixel;
+ xcb_change_gc(conn, r->s->bar_gc, XCB_GC_FOREGROUND, gcv);
+ xcb_poly_fill_rectangle(conn, r->bar->buffer, r->s->bar_gc,
+ sizeof(rect), &rect);
+
+ /* draw back buffer */
+ gcvd.graphics_exposures = 0;
+ draw = XCreateGC(display, r->bar->buffer, GCGraphicsExposures, &gcvd);
+ XSetForeground(display, draw, r->s->c[SWM_S_COLOR_BAR_FONT].pixel);
+ DRAWSTRING(display, r->bar->buffer, bar_fs, draw,
+ x, (bar_fs_extents->max_logical_extent.height - lbox.height) / 2 -
+ lbox.y, s, len);
+ XFreeGC(display, draw);
+
+ /* blt */
+ xcb_copy_area(conn, r->bar->buffer, r->bar->id, r->s->bar_gc, 0, 0,
+ 0, 0, WIDTH(r->bar), HEIGHT(r->bar));
+}
+
+void