wmii

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

commit 4904a19aae0a0d51dc105b4618b907c89beba840
parent d2a9e3a86049469ac2af0cde11340cd5552e130b
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed, 31 May 2006 09:51:40 +0200

added /def/ncol stuff, see wmiirc for an initial syntax proposal


Diffstat:
cmd/wm/area.c | 26++++----------------------
cmd/wm/client.c | 2+-
cmd/wm/mouse.c | 4++--
cmd/wm/rule.c | 18+++++++++---------
cmd/wm/view.c | 20++++++++++++++++++++
cmd/wm/wm.h | 3++-
rc/wmiirc | 3+++
7 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -234,25 +234,6 @@ place_client(Area *a, Client *c) free(rects); } -static unsigned int -ncol_of_view(View *v) -{ - unsigned int i, n; - regmatch_t tmpregm; - - for(i = 0; i < vrule.size; i++) { - Rule *r = vrule.data[i]; - if(!regexec(&r->regex, v->name, 1, &tmpregm, 0)) { - if(sscanf(r->values, "%u", &n) == 1) { - fprintf(stderr, "r->values=%s n=%d\n", r->values, n); - return n; - } - fprintf(stderr, "r->values=%s n=%d\n", r->values, n); - } - } - return 0; -} - void attach_to_area(Area *a, Client *c) { @@ -269,9 +250,10 @@ attach_to_area(Area *a, Client *c) if(aidx) { /* column */ unsigned int nc = ncol_of_view(v); - fprintf(stderr, "nc=%d v->area.size=%d\n", nc, v->area.size); - if(nc && nc > v->area.size - 1) - a = create_area(v, v->sel); + if(v->area.data[1]->frame.size && nc && nc > v->area.size - 1) { + a = create_area(v, ++v->sel); + arrange_view(v); + } } f = create_frame(a, c); diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -872,7 +872,7 @@ match_tags(Client *c, const char *prop) Rule *r = crule.data[i]; if(!regexec(&r->regex, prop, 1, &tmpregm, 0)) if(!strlen(c->tags) || !strncmp(c->tags, "nil", 4)) - apply_tags(c, r->values); + apply_tags(c, r->value); } } diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -127,7 +127,7 @@ do_mouse_resize(Client *c, BlitzAlign align) int px = 0, py = 0, i, ox, oy; Window dummy; XEvent ev; - unsigned int num = 0; + unsigned int num = 0, di; Frame *f = c->frame.data[c->sel]; int aidx = idx_of_area(f->area); int snap = aidx ? 0 : rect.height / 66; @@ -136,7 +136,7 @@ do_mouse_resize(Client *c, BlitzAlign align) XRectangle origin = frect; XPoint pt; - XQueryPointer(dpy, c->framewin, &dummy, &dummy, &ox, &oy, &i, &i, &i); + XQueryPointer(dpy, c->framewin, &dummy, &dummy, &ox, &oy, &i, &i, &di); pt.x = ox; pt.y = oy; XSync(dpy, False); diff --git a/cmd/wm/rule.c b/cmd/wm/rule.c @@ -13,7 +13,7 @@ enum { IGNORE, REGEX, - TAGS + VALUE }; static Vector * @@ -26,7 +26,7 @@ void update_rules(RuleVector *rule, const char *data) { int mode = IGNORE; - char *p, *r = nil, *v = nil, regex[256], values[256]; + char *p, *r = nil, *v = nil, regex[256], value[256]; if(!data || !strlen(data)) return; @@ -46,9 +46,9 @@ update_rules(RuleVector *rule, const char *data) r = regex; } else if(*p == '>') { - mode = TAGS; - values[0] = 0; - v = values; + mode = VALUE; + value[0] = 0; + v = value; } break; case REGEX: @@ -61,13 +61,13 @@ update_rules(RuleVector *rule, const char *data) r++; } break; - case TAGS: - if(*p == '\n' || *(p + 1) == 0) { + case VALUE: + if(*p == '\n' || *p == 0) { Rule *rul = cext_emallocz(sizeof(Rule)); *v = 0; - cext_trim(values, " \t/"); + cext_trim(value, " \t/"); if(!regcomp(&rul->regex, regex, 0)) { - cext_strlcpy(rul->values, values, sizeof(rul->values)); + cext_strlcpy(rul->value, value, sizeof(rul->value)); cext_vattach(vector_of_rules(rule), rul); } else diff --git a/cmd/wm/view.c b/cmd/wm/view.c @@ -387,3 +387,23 @@ update_views() else update_view_bars(); } + +unsigned int +ncol_of_view(View *v) +{ + unsigned int i, n; + regmatch_t tmpregm; + + for(i = 0; i < vrule.size; i++) { + Rule *r = vrule.data[i]; + if(!regexec(&r->regex, v->name, 1, &tmpregm, 0)) { + if(sscanf(r->value, "%u", &n) == 1) { + fprintf(stderr, "r->value=%s n=%d\n", r->value, n); + return n; + } + fprintf(stderr, "r->value=%s n=%d\n", r->value, n); + } + } + return 0; +} + diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -177,7 +177,7 @@ VECTOR(BarVector, Bar *); typedef struct { regex_t regex; - char values[256]; + char value[256]; } Rule; VECTOR(RuleVector, Rule *); @@ -322,6 +322,7 @@ void restack_view(View *v); View *view_of_name(const char *name); void destroy_view(View *v); void update_views(); +unsigned int ncol_of_view(View *v); /* wm.c */ void scan_wins(); diff --git a/rc/wmiirc b/rc/wmiirc @@ -36,6 +36,9 @@ xwrite /def/border 2 xwrite /def/font $WMII_FONT xwrite /def/selcolors $WMII_SELCOLORS xwrite /def/normcolors $WMII_NORMCOLORS +wmiir write /def/ncol <<EOF +/.*/ -> 2 +EOF # TAGGING RULES wmiir write /def/rules <<EOF