Workaround for OpenBox (Thanks ma @ arch bbs). Handle some fonts better.

This commit is contained in:
LemonBoy 2012-11-10 14:48:21 +01:00
parent febe0f822d
commit 03c39538a5
2 changed files with 7 additions and 2 deletions

7
bar.c
View File

@ -90,9 +90,9 @@ draw_char (int x, int align, wchar_t ch)
sel_font->table[ch - sel_font->char_min].character_width : sel_font->table[ch - sel_font->char_min].character_width :
0; 0;
/* Some fonts (such as anorexia) have the space char with the width set to 0 */
if (ch_width == 0) if (ch_width == 0)
return 0; ch_width = BAR_FONT_FALLBACK_WIDTH;
switch (align) { switch (align) {
case ALIGN_C: case ALIGN_C:
@ -360,6 +360,9 @@ init (void)
/* Make the bar visible */ /* Make the bar visible */
xcb_map_window (c, win); 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); xcb_flush (c);
} }

View File

@ -12,6 +12,8 @@
#define BAR_BOTTOM 0 #define BAR_BOTTOM 0
/* The fonts used for the bar, comma separated. Only the first 2 will be used. */ /* 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" #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 */ /* Color palette */
#define COLOR0 0x1A1A1A /* background */ #define COLOR0 0x1A1A1A /* background */
#define COLOR1 0xA9A9A9 /* foreground */ #define COLOR1 0xA9A9A9 /* foreground */