wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit f478c7f6d2bb5ec3e6c038b7f69cf1b95ecd7021
parent 53c50eb697901c5e5ef752870e7c9ba1273bd15b
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Fri, 24 Feb 2006 10:38:48 +0100

removed option to disable client bars, we don't allow that in the future because of intelligent stacks,
		also removed option for per-client based border width, unnecessary bloat nobody really needs


Diffstat:
cmd/wm/bar.c | 8+++++++-
cmd/wm/client.c | 29++++++++++++++---------------
cmd/wm/event.c | 4++--
cmd/wm/fs.c | 78++++++++----------------------------------------------------------------------
cmd/wm/mouse.c | 4++--
cmd/wm/wm.c | 2+-
cmd/wm/wm.h | 6++----
rc/wmiirc | 12+-----------
8 files changed, 37 insertions(+), 106 deletions(-)

diff --git a/cmd/wm/bar.c b/cmd/wm/bar.c @@ -27,12 +27,18 @@ detach_label(Label *l) nlabel--; } +unsigned int +bar_height() +{ + return xfont->ascent + xfont->descent + 4; +} + void update_bar_geometry() { size_t i, j; brect = rect; - brect.height = xfont->ascent + xfont->descent + 4; + brect.height = bar_height(); brect.y = rect.height - brect.height; XMoveResizeWindow(dpy, winbar, brect.x, brect.y, brect.width, brect.height); XSync(dpy, False); diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -45,9 +45,7 @@ alloc_client(Window w, XWindowAttributes *wa) fwa.background_pixmap = ParentRelative; fwa.event_mask = SubstructureRedirectMask | ExposureMask | ButtonPressMask | PointerMotionMask; - c->frame.bar = def.bar; - c->frame.border = bw; - bh = bar_height(c); + bh = bar_height(); c->frame.rect = c->rect; c->frame.rect.width += 2 * bw; c->frame.rect.height += bw + (bh ? bh : bw); @@ -260,8 +258,8 @@ void draw_client(Client *c) { Draw d = { 0 }; - unsigned int bh = bar_height(c); - unsigned int bw = c->frame.border; + unsigned int bh = bar_height(); + unsigned int bw = def.border; XRectangle notch; d.align = WEST; @@ -455,14 +453,6 @@ win_to_frame(Window w) return nil; } -unsigned int -bar_height(Client * c) -{ - if(c->frame.bar) - return xfont->ascent + xfont->descent + 4; - return 0; -} - static void check_dimensions(Client *c, unsigned int tabh, unsigned int bw) { @@ -511,8 +501,8 @@ resize_incremental(Client *c, unsigned int tabh, unsigned int bw) void resize_client(Client *c, XRectangle *r, XPoint *pt) { - unsigned int bh = bar_height(c); - unsigned int bw = c->frame.border; + unsigned int bh = bar_height(); + unsigned int bw = def.border; if(area_to_index(c->area) > 0) resize_column(c, r, pt); @@ -635,3 +625,12 @@ sendtoarea_client(Client *c, char *arg) { sendto_area(new, c); } + +void +resize_all_clients() +{ + size_t i; + for(i = 0; i < nclient; i++) + if(client[i]->area) + resize_client(client[i], &client[i]->frame.rect, 0); +} diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -134,8 +134,8 @@ handle_configurerequest(XEvent *e) if(c) { if(c->area) { - bw = c->frame.border; - bh = bar_height(c); + bw = def.border; + bh = bar_height(); } gravitate(c, bh ? bh : bw, bw, 1); diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c @@ -34,7 +34,6 @@ static char Enocommand[] = "command not supported"; * / Droot * /def/ Ddef * /def/border Fborder 0..n - * /def/bar Fbar 0, 1 * /def/snap Fsnap 0..n * /def/inc Finc 0..n * /def/font Ffont xlib font name @@ -60,8 +59,6 @@ static char Enocommand[] = "command not supported"; * /1/float/ctl Fctl command interface (area) * /1/float/sel/ Dclient * /1/float/1/ Dclient - * /1/float/1/border Fborder 0..n - * /1/float/1/bar Fbar 0, 1 * /1/float/1/name Fname name of client * /1/float/1/geom Fgeom geometry of client * /1/float/1/ctl Fctl command interface (client) @@ -69,8 +66,6 @@ static char Enocommand[] = "command not supported"; * /1/1/ctl Fctl command interface (area) * /1/1/1/sel/ Dclient * /1/1/1/1/ Dclient - * /1/1/1/border Fborder 0..n - * /1/1/1/bar Fbar 0, 1 * /1/1/1/name Fname name of client * /1/1/1/geom Fgeom geometry of client * /1/1/1/ctl Fctl command interface (client) @@ -158,7 +153,6 @@ qid_to_name(Qid *qid) case Droot: return "/"; break; case Ddef: return "def"; break; case Dkeys: return "keys"; break; - case Fbar: case Dbar: return "bar"; break; case Dpage: if(i1 == sel) @@ -219,12 +213,8 @@ name_to_type(char *name, unsigned char dir_type) case Dpage: return Darea; break; } } - if(!strncmp(name, "bar", 4)) { - if(dir_type == Droot) - return Dbar; - else - return Fbar; - } + if(!strncmp(name, "bar", 4)) + return Dbar; if(!strncmp(name, "def", 4)) return Ddef; if(!strncmp(name, "keys", 5)) @@ -556,17 +546,7 @@ type_to_stat(Stat *stat, char *wname, Qid *dir) return mkstat(stat, dir, wname, 0, DMREAD); break; case Fborder: - if(dir_type == Ddef) - snprintf(buf, sizeof(buf), "%d", def.border); - else - snprintf(buf, sizeof(buf), "%d", page[dir_i1]->area[dir_i2]->client[dir_i3]->frame.border); - return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE); - break; - case Fbar: - if(dir_type == Ddef) - snprintf(buf, sizeof(buf), "%d", def.bar); - else - snprintf(buf, sizeof(buf), "%d", page[dir_i1]->area[dir_i2]->client[dir_i3]->frame.bar); + snprintf(buf, sizeof(buf), "%d", def.border); return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE); break; case Finc: @@ -865,8 +845,6 @@ xread(IXPConn *c, Fcall *fcall) case Ddef: fcall->count += type_to_stat(&stat, "border", &m->qid); p = ixp_enc_stat(p, &stat); - fcall->count += type_to_stat(&stat, "bar", &m->qid); - p = ixp_enc_stat(p, &stat); fcall->count += type_to_stat(&stat, "inc", &m->qid); p = ixp_enc_stat(p, &stat); fcall->count += type_to_stat(&stat, "snap", &m->qid); @@ -913,8 +891,6 @@ xread(IXPConn *c, Fcall *fcall) case Dclient: fcall->count = type_to_stat(&stat, "border", &m->qid); p = ixp_enc_stat(p, &stat); - fcall->count += type_to_stat(&stat, "bar", &m->qid); - p = ixp_enc_stat(p, &stat); fcall->count += type_to_stat(&stat, "name", &m->qid); p = ixp_enc_stat(p, &stat); fcall->count += type_to_stat(&stat, "geometry", &m->qid); @@ -931,18 +907,7 @@ xread(IXPConn *c, Fcall *fcall) return nil; break; case Fborder: - if(m->qid.dir_type == Ddef) - snprintf(buf, sizeof(buf), "%u", def.border); - else - snprintf(buf, sizeof(buf), "%u", page[i1]->area[i2]->client[i3]->frame.border); - fcall->count = strlen(buf); - memcpy(p, buf, fcall->count); - break; - case Fbar: - if(m->qid.dir_type == Ddef) - snprintf(buf, sizeof(buf), "%u", def.bar); - else - snprintf(buf, sizeof(buf), "%u", page[i1]->area[i2]->client[i3]->frame.bar); + snprintf(buf, sizeof(buf), "%u", def.border); fcall->count = strlen(buf); memcpy(p, buf, fcall->count); break; @@ -1102,29 +1067,8 @@ xwrite(IXPConn *c, Fcall *fcall) i = cext_strtonum(buf, 0, 0xffff, &err); if(err) return "border value out of range 0..0xffff"; - if(m->qid.dir_type == Ddef) - def.border = i; - else { - Client *c = page[i1]->area[i2]->client[i3]; - c->frame.border = i; - resize_client(c, &c->frame.rect, 0); - } - break; - case Fbar: - if(fcall->count > sizeof(buf)) - return "bar value out of range 0, 1"; - memcpy(buf, fcall->data, fcall->count); - buf[fcall->count] = 0; - i = cext_strtonum(buf, 0, 1, &err); - if(err) - return "bar value out of range 0, 1"; - if(m->qid.dir_type == Ddef) - def.border = i; - else { - Client *c = page[i1]->area[i2]->client[i3]; - c->frame.bar = i; - resize_client(c, &c->frame.rect, 0); - } + def.border = i; + resize_all_clients(); break; case Finc: if(fcall->count > sizeof(buf)) @@ -1135,9 +1079,7 @@ xwrite(IXPConn *c, Fcall *fcall) if(err) return "increment value out of range 0, 1"; def.inc = i; - for(i = 0; i < nclient; i++) - if(client[i]->area) - resize_client(client[i], &client[i]->frame.rect, 0); + resize_all_clients(); break; case Fgeom: cl = page[i1]->area[i2]->client[i3]; @@ -1218,12 +1160,8 @@ xwrite(IXPConn *c, Fcall *fcall) memcpy(def.font, fcall->data, fcall->count); XFreeFont(dpy, xfont); xfont = blitz_getfont(dpy, def.font); - for(i = 0; i < nclient; i++) { - if(!client[i]->area->page) - continue; - resize_client(client[i], &client[i]->frame.rect, 0); - } update_bar_geometry(); + resize_all_clients(); break; case Fkey: break; diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -15,8 +15,8 @@ cursor_for_motion(Client *c, int x, int y) int n, e, w, s, tn, te, tw, ts; unsigned int bh, bw; - bw = c->frame.border; - bh = bar_height(c); + bw = def.border; + bh = bar_height(); if(!bw) return normal_cursor; diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -534,7 +534,7 @@ main(int argc, char *argv[]) def.font = strdup(BLITZ_FONT); def.border = DEF_BORDER; def.snap = DEF_SNAP; - def.inc = def.bar = True; + def.inc = True; cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor)); blitz_loadcolor(dpy, screen, def.selcolor, &def.sel); cext_strlcpy(def.normcolor, BLITZ_NORMCOLORS, sizeof(def.normcolor)); diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -96,8 +96,6 @@ struct Client { XRectangle revert; GC gc; Cursor cursor; - Bool bar; - unsigned int border; } frame; }; @@ -123,7 +121,6 @@ typedef struct { char selcolor[24]; char normcolor[24]; char *font; - Bool bar; Bool inc; Color sel; Color norm; @@ -202,6 +199,7 @@ void detach_label(Label *l); void draw_bar(); int lid_to_index(unsigned short id); void update_bar_geometry(); +unsigned int bar_height(); /* client.c */ Client *alloc_client(Window w, XWindowAttributes *wa); @@ -221,12 +219,12 @@ Client *sel_client_of_page(Page *p); void focus_client(Client *c, Bool fevent); Client *win_to_frame(Window w); void resize_client(Client *c, XRectangle * r, XPoint * pt); -unsigned int bar_height(Client *c); int cid_to_index(Area *a, unsigned short id); int client_to_index(Client *c); void select_client(Client *c, char *arg); void sendtopage_client(Client *c, char *arg); void sendtoarea_client(Client *c, char *arg); +void resize_all_clients(); /* event.c */ void init_x_event_handler(); diff --git a/rc/wmiirc b/rc/wmiirc @@ -23,7 +23,6 @@ fn sigint { } -CLIENT_BAR=1 CLIENT_BORDER=3 MODKEY=Alt WMII_FONT='fixed' @@ -32,21 +31,12 @@ WMII_SELCOLORS='#ffffff #285577 #4c7899' # WM CONFIGURATION -xwrite /def/bar $CLIENT_BAR xwrite /def/border $CLIENT_BORDER xwrite /def/inc 1 xwrite /def/snap 20 xwrite /def/font $WMII_FONT xwrite /def/selcolors $WMII_SELCOLORS xwrite /def/normcolors $WMII_NORMCOLORS -for(page in `{wmiir read / | awk '/^d/ && !/new$/ {print $NF}'}) { - for(area in `{wmiir read /$page | awk '/^d/ && !/new$/ {print $NF}'}) { - for(client in `{wmiir read /$page/$area | awk '/^d/ {print $NF}'}) { - xwrite /$page/$area/$client/bar $CLIENT_BAR - xwrite /$page/$area/$client/border $CLIENT_BORDER - } - } -} # BAR CONFIGURATION for(i in `{seq 1 `{wmiir read /bar|maxlab}}) @@ -88,7 +78,7 @@ while(event=`{read}) { xwrite /bar/2/data $"buf } if(~ $event(1) CF) { - buf=`{echo $event| awk '{print "warp "$2+4" "$3+4}'} + buf=`{echo $event| awk '{print "warp "$2+6" "$3+6}'} xwrite /ctl $"buf } if(~ $event(1) LB) { # label button press