Added positioning switch.

This commit is contained in:
LemonBoy 2012-07-22 11:45:10 +02:00
parent b0cc51c1c9
commit 4ecaa1c6c2
2 changed files with 25 additions and 6 deletions

17
bar.c
View File

@ -208,7 +208,11 @@ set_ewmh_atoms (void)
(const unsigned []){ 0xffffffff } );
/* Set the window geometry */
xcb_change_property (c, XCB_PROP_MODE_REPLACE, win, atoms[3], XCB_ATOM_CARDINAL, 32, 12,
(const unsigned []) { 0, 0, BAR_HEIGHT, 0, 0, 0, 0, 0, bar_width, 0, 0} );
#if (BAR_BOTTOM == 1)
(const unsigned []) { 0, 0, 0, BAR_HEIGHT, 0, 0, 0, 0, 0, 0, 0, bar_width } );
#else
(const unsigned []) { 0, 0, BAR_HEIGHT, 0, 0, 0, 0, 0, bar_width, 0, 0, 0 } );
#endif
}
void
@ -242,10 +246,15 @@ init (void)
free (font_info);
/* Create the main window */
win = xcb_generate_id (c);
xcb_create_window (c, XCB_COPY_FROM_PARENT, win, root, 0, 0, bar_width, BAR_HEIGHT,
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual,
xcb_create_window (c, XCB_COPY_FROM_PARENT, win, root, 0,
#if (BAR_BOTTOM == 1)
scr->height_in_pixels - BAR_HEIGHT,
#else
0,
#endif
bar_width, BAR_HEIGHT, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual,
XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK,
(const unsigned []){ pal[0], 1, XCB_EVENT_MASK_EXPOSURE });
(const unsigned []){ pal[0], !BAR_EWMH_DOCKING, XCB_EVENT_MASK_EXPOSURE });
/* Set EWMH hints */
set_ewmh_atoms ();
/* Create a temporary canvas */

View File

@ -1,7 +1,17 @@
/* The height of the bar (in pixels) */
#define BAR_HEIGHT 18
/* The thickness of the underline (in pixels) */
#define BAR_UNDERLINE_HEIGHT 2
#define BAR_FONT "-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1"
/* Tell the WM to reserve the space we use.
* Some window managers don't respect the EWMH hints though and
* leave bar as a separate window. Just set this to 0 if it happens.
*/
#define BAR_EWMH_DOCKING 1
/* Whether to put the bar at the screen bottom or not */
#define BAR_BOTTOM 0
/* The font used for the bar */
#define BAR_FONT "-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1"
/* Color palette */
#define COLOR0 0x1A1A1A /* background */
#define COLOR1 0xA9A9A9 /* foreground */
#define COLOR2 0x303030