wmii

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

commit 8c650f5bd0ce25fbb3cfe5790b7a727e06b3938b
parent 4041415222b4cfbb091222b669a28bf033e2931d
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Fri, 10 Mar 2006 21:42:39 +0100

fixed issue that client appears in different tag, improved update_keys (lock modifiers are updated now)


Diffstat:
cmd/wm/client.c | 6+-----
cmd/wm/event.c | 6+++---
cmd/wm/kb.c | 19++++++++++++-------
cmd/wm/tag.c | 21+++++++++++----------
cmd/wm/wm.c | 2+-
cmd/wm/wm.h | 2+-
rc/wmiirc | 10+++++-----
7 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -427,9 +427,6 @@ void resize_client(Client *c, XRectangle *r, XPoint *pt, Bool ignore_xcall) { Frame *f = c->frame[c->sel]; - int pi = tag2index(f->area->tag); - int px = sel * rect.width; - if((area2index(f->area) > 0) && pt) resize_area(c, r, pt); @@ -440,8 +437,7 @@ resize_client(Client *c, XRectangle *r, XPoint *pt, Bool ignore_xcall) match_sizehints(c); if(!ignore_xcall) - XMoveResizeWindow(dpy, c->framewin, px - (pi * rect.width) + f->rect.x, f->rect.y, - f->rect.width, f->rect.height); + XMoveResizeWindow(dpy, c->framewin, f->rect.x, f->rect.y, f->rect.width, f->rect.height); if((f->area->mode != Colstack) || (f->area->sel == frame2index(f))) { c->rect.x = def.border; diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -66,7 +66,7 @@ handle_buttonpress(XEvent *e) unsigned int i; for(i = 0; i < nlabel; i++) if(blitz_ispointinrect(ev->x, ev->y, &label[i]->rect)) { - snprintf(buf, sizeof(buf), "LB %s %d\n", label[i]->name, ev->button); + snprintf(buf, sizeof(buf), "LabelClick %s %d\n", label[i]->name, ev->button); write_event(buf); return; } @@ -85,7 +85,7 @@ handle_buttonpress(XEvent *e) } if(c->nframe) { - snprintf(buf, sizeof(buf), "CB %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); + snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); write_event(buf); } } @@ -111,7 +111,7 @@ handle_buttonpress(XEvent *e) focus(c); if(c->nframe) { - snprintf(buf, sizeof(buf), "CB %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); + snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button); write_event(buf); } } diff --git a/cmd/wm/kb.c b/cmd/wm/kb.c @@ -30,9 +30,8 @@ init_lock_modifiers() if(modmap && modmap->max_keypermod > 0) { int max = NUM_MASKS * modmap->max_keypermod; for(i = 0; i < max; i++) { - if(num_lock && (modmap->modifiermap[i] == num_lock)) { + if(num_lock && (modmap->modifiermap[i] == num_lock)) num_lock_mask = masks[i / modmap->max_keypermod]; - } } } XFreeModifiermap(modmap); @@ -220,7 +219,7 @@ handle_key_seq(Window w, Key **done, unsigned int ndone) return; /* grabbed but not found */ case 1: if(!found[0]->next) { - snprintf(buf, sizeof(buf), "K %s\n", found[0]->name); + snprintf(buf, sizeof(buf), "Key %s\n", found[0]->name); write_event(buf); break; } @@ -244,7 +243,7 @@ handle_key(Window w, unsigned long mod, KeyCode keycode) return; /* grabbed but not found */ case 1: if(!found[0]->next) { - snprintf(buf, sizeof(buf), "K %s\n", found[0]->name); + snprintf(buf, sizeof(buf), "Key %s\n", found[0]->name); write_event(buf); break; } @@ -263,19 +262,25 @@ update_keys() { char *l, *p; + init_lock_modifiers(); + while(nkey) { ungrab_key(key[0]); destroy_key(key[0]); } for(l = p = def.keys; p && *p;) { - if(*p == '\n') { - *p = 0; + if(*p == '\n' || !*(p + 1)) { + if(*(p + 1)) + *p = 0; grab_key(get_key(l)); - *p = '\n'; + if(*(p + 1)) + *p = '\n'; l = ++p; } else p++; } + + XSync(dpy, False); } diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c @@ -61,14 +61,13 @@ void focus_tag(Tag *t) { char buf[16]; - int i, j, pi = tag2index(t); - int px; + int i, j; - if(!ntag || (pi == -1)) + if(!ntag) return; - sel = pi; - px = sel * rect.width; + XGrabServer(dpy); + sel = tag2index(t); /* select correct frames of clients */ for(i = 0; i < nclient; i++) @@ -80,17 +79,19 @@ focus_tag(Tag *t) for(i = 0; i < nclient; i++) if(client[i]->nframe) { Frame *f = client[i]->frame[client[i]->sel]; - pi = tag2index(f->area->tag); - XMoveWindow(dpy, client[i]->framewin, px - (pi * rect.width) + f->rect.x, f->rect.y); if(f->area->tag == t) { + XMoveWindow(dpy, client[i]->framewin, f->rect.x, f->rect.y); if(client[i]->nframe > 1) resize_client(client[i], &f->rect, nil, False); draw_client(client[i]); } + else + XMoveWindow(dpy, client[i]->framewin, 2 * rect.width + f->rect.x, f->rect.y); } - snprintf(buf, sizeof(buf), "TF %s\n", t->name); + snprintf(buf, sizeof(buf), "FocusTag %s\n", t->name); write_event(buf); XSync(dpy, False); + XUngrabServer(dpy); } XRectangle * @@ -237,12 +238,12 @@ update_tags() /* propagate tagging events */ for(i = 0; i < nnewctag; i++) if(!has_tag(ctag, newctag[i], nctag)) { - snprintf(buf, sizeof(buf), "NT %s\n", newctag[i]); + snprintf(buf, sizeof(buf), "NewTag %s\n", newctag[i]); write_event(buf); } for(i = 0; i < nctag; i++) { if(!has_tag(newctag, ctag[i], nnewctag)) { - snprintf(buf, sizeof(buf), "RT %s\n", ctag[i]); + snprintf(buf, sizeof(buf), "RemoveTagT %s\n", ctag[i]); write_event(buf); } free(ctag[i]); diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -332,7 +332,7 @@ main(int argc, char *argv[]) init_atoms(); init_cursors(); xfont = blitz_getfont(dpy, def.font); - init_lock_modifiers(); + init_lock_modifiers(); init_screen(); wa.override_redirect = 1; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -272,8 +272,8 @@ void new_ixp_conn(IXPConn *c); /* kb.c */ void handle_key(Window w, unsigned long mod, KeyCode keycode); -void init_lock_modifiers(); void update_keys(); +void init_lock_modifiers(); /* mouse.c */ void mouse_resize(Client *c, Align align); diff --git a/rc/wmiirc b/rc/wmiirc @@ -101,7 +101,7 @@ do set -- $event type="$1"; shift case "$type" in - NT) + NewTag) wmiir create /bar/$1 if test $1 = "$oldtag" then @@ -110,9 +110,9 @@ do xwrite /bar/$1/colors $WMII_SELCOLORS fi xwrite /bar/$1/data $1;; - RT) + RemoveTag) wmiir remove /bar/$1;; - TF) + FocusTag) if test -n "$oldtag" then xwrite /bar/$oldtag/colors $WMII_SELCOLORS @@ -120,9 +120,9 @@ do xwrite /bar/$1/data $1 xwrite /bar/$1/colors $WMII_NORMCOLORS oldtag=$1;; - LB) + LabelClick) xwrite /ctl select $1;; - K) + Key) case "$1" in $MODKEY-Control-c) xwrite /ws/sel/sel/ctl kill;;