From 03c39538a59a0942e93a505b4bdd11313939087e Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 10 Nov 2012 14:48:21 +0100 Subject: [PATCH] Workaround for OpenBox (Thanks ma @ arch bbs). Handle some fonts better. --- bar.c | 7 +++++-- config.def.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bar.c b/bar.c index 58698e7..29a6dda 100644 --- a/bar.c +++ b/bar.c @@ -90,9 +90,9 @@ draw_char (int x, int align, wchar_t ch) sel_font->table[ch - sel_font->char_min].character_width : 0; - + /* Some fonts (such as anorexia) have the space char with the width set to 0 */ if (ch_width == 0) - return 0; + ch_width = BAR_FONT_FALLBACK_WIDTH; switch (align) { case ALIGN_C: @@ -360,6 +360,9 @@ init (void) /* Make the bar visible */ xcb_map_window (c, win); + /* Send a configure event. Needed to make bar work with Openbox */ + xcb_configure_window (c, win, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ BAR_OFFSET, y }); + xcb_flush (c); } diff --git a/config.def.h b/config.def.h index 28ffcb5..1532fdc 100644 --- a/config.def.h +++ b/config.def.h @@ -12,6 +12,8 @@ #define BAR_BOTTOM 0 /* The fonts used for the bar, comma separated. Only the first 2 will be used. */ #define BAR_FONT "-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1","fixed" +/* Some fonts don't set the right width for some chars, pheex it */ +#define BAR_FONT_FALLBACK_WIDTH 6 /* Color palette */ #define COLOR0 0x1A1A1A /* background */ #define COLOR1 0xA9A9A9 /* foreground */