diff --git a/config.c b/config.c index 90d046a..0811080 100644 --- a/config.c +++ b/config.c @@ -95,7 +95,7 @@ name_to_func(char *name, func_name_list_t l[]) return NULL; } -unsigned long +ulong char_to_modkey(char *name) { int i; @@ -107,7 +107,7 @@ char_to_modkey(char *name) return NoSymbol; } -unsigned int +uint char_to_button(char *name) { int i; @@ -137,6 +137,7 @@ init_conf(void) static cfg_opt_t misc_opts[] = { CFG_STR("bar_position", "top", CFGF_NONE), + CFG_BOOL("barborder", cfg_false, CFGF_NONE), CFG_BOOL("raisefocus", cfg_false, CFGF_NONE), CFG_BOOL("raiseswitch", cfg_true, CFGF_NONE), CFG_INT("border_height", 1, CFGF_NONE), @@ -283,6 +284,7 @@ init_conf(void) /* misc */ conf.raisefocus = cfg_getbool(cfg_misc, "raisefocus"); + conf.barborder = cfg_getbool(cfg_misc, "barborder"); conf.raiseswitch = cfg_getbool(cfg_misc, "raiseswitch"); conf.borderheight = cfg_getint(cfg_misc, "border_height"); conf.ttbarheight = cfg_getint(cfg_misc, "titlebar_height"); diff --git a/event.c b/event.c index 6d7da41..76d580f 100644 --- a/event.c +++ b/event.c @@ -58,7 +58,7 @@ buttonpress(XEvent ev) mouseaction(c, ev.xbutton.x_root, ev.xbutton.y_root, False); } /* BUTTON 2 */ - { +{ if(ev.xbutton.button == Button2) { if(tags[seltag].layout.func == tile) @@ -339,7 +339,7 @@ focusin(XEvent ev) void keypress(XEvent ev) { - unsigned int i; + uint i; KeySym keysym; keysym = XKeycodeToKeysym(dpy, (KeyCode)ev.xkey.keycode, 0); diff --git a/layout.c b/layout.c index f62c2cd..b7fe18b 100644 --- a/layout.c +++ b/layout.c @@ -53,7 +53,6 @@ freelayout(void) return; } -/* Improved ! :) */ void layoutswitch(Bool b) { @@ -157,8 +156,8 @@ uicb_set_nmaster(uicb_t cmd) void tile(void) { - unsigned int i, n, x, y, yt, w, h, ww, hh, th; - unsigned int barto, bord, mwf, nm, mht; + uint i, n, x, y, yt, w, h, ww, hh, th; + uint barto, bord, mwf, nm, mht; Client *c; bord = conf.borderheight * 2; @@ -169,7 +168,7 @@ tile(void) /* count all the "can-be-tiled" client */ for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), ++n); - if(n == 0) + if(!n) return; /* window geoms */ diff --git a/util.c b/util.c index 1731baf..ae135cd 100644 --- a/util.c +++ b/util.c @@ -33,7 +33,7 @@ #include "wmfs.h" void* -emalloc(unsigned int element, unsigned int size) +emalloc(uint element, uint size) { void *ret = calloc(element, size); @@ -43,7 +43,7 @@ emalloc(unsigned int element, unsigned int size) return ret; } -unsigned long +ulong getcolor(char *color) { Colormap cmap = DefaultColormap(dpy, screen); diff --git a/wmfs.c b/wmfs.c index d4a035a..62980da 100644 --- a/wmfs.c +++ b/wmfs.c @@ -293,7 +293,7 @@ grabbuttons(Client *c, Bool focused) void grabkeys(void) { - unsigned int i; + uint i; KeyCode code; XUngrabKey(dpy, AnyKey, AnyModifier, root); @@ -398,15 +398,20 @@ init(void) XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &at); /* INIT BAR / BUTTON */ - bary = (conf.bartop) ? 0 : mh - barheight; + bary = (conf.bartop) ? 0 : mh - barheight - conf.barborder; dr = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), barheight, DefaultDepth(dpy, screen)); at.override_redirect = 1; at.background_pixmap = ParentRelative; at.event_mask = ButtonPressMask | ExposureMask; - bar = XCreateWindow(dpy, root, 0, bary, mw, barheight, 0, DefaultDepth(dpy, screen), + bar = XCreateWindow(dpy, root, 0, bary, mw - conf.barborder*2, barheight, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); XMapRaised(dpy, bar); + if(conf.barborder) + { + XSetWindowBorder(dpy, bar, conf.colors.borderfocus); + XSetWindowBorderWidth(dpy, bar, 1); + } strcpy(bartext, WMFS_VERSION); updatebutton(False); updatebar(); @@ -739,7 +744,7 @@ raiseclient(Client *c) void scan(void) { - unsigned int i, num; + uint i, num; Window *wins, d1, d2; XWindowAttributes wa; @@ -859,7 +864,7 @@ uicb_togglebarpos(uicb_t cmd) if(conf.bartop) bary = 0; else - bary = mh - barheight; + bary = mh - barheight - conf.barborder; XMoveWindow(dpy, bar, 0, bary); updatebar(); for(i = 0; i < conf.nbutton; ++i) diff --git a/wmfs.h b/wmfs.h index 7a3ac9d..e1d343d 100644 --- a/wmfs.h +++ b/wmfs.h @@ -94,7 +94,7 @@ struct Client /* Keybind Structure */ typedef struct { - unsigned long mod; + uint mod; KeySym keysym; void (*func)(uicb_t); char *cmd; @@ -107,11 +107,11 @@ typedef struct Window win; int fg_color; int bg_color; - unsigned int x; + uint x; int nmousesec; void (*func[NBUTTON])(uicb_t); char *cmd[NBUTTON]; - unsigned int mouse[NBUTTON]; + uint mouse[NBUTTON]; } BarButton; /* Layout Structure */ @@ -136,6 +136,7 @@ typedef struct bool raisefocus; bool raiseswitch; bool bartop; + bool barborder; int borderheight; int ttbarheight; struct @@ -146,14 +147,14 @@ typedef struct } font; struct { - int bordernormal; - int borderfocus; - int bar; - int text; - int tagselfg; - int tagselbg; - int layout_fg; - int layout_bg; + uint bordernormal; + uint borderfocus; + uint bar; + uint text; + uint tagselfg; + uint tagselbg; + uint layout_fg; + uint layout_bg; } colors; Tag tag[MAXTAG]; Layout layout[MAXLAYOUT]; @@ -180,7 +181,7 @@ typedef struct typedef struct { char *name; - unsigned int button; + uint button; } name_to_uint_t; /* Enum */ @@ -208,8 +209,8 @@ void unmapnotify(XEvent ev); void getevent(void); /* util.c */ -void *emalloc(unsigned int elemet, unsigned int size); -unsigned long getcolor(char *color); +void *emalloc(uint elemet, uint size); +ulong getcolor(char *color); void xprint(Drawable d, int x, int y, uint fg, uint bg, int d1, int d2, char* str);