wmii

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

commit 4d796b3c5c36384aa1f4c8f64e49ddf31b1c0352
parent 02999b502b2e4d24114122eae8cce698618d479d
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Thu,  9 Mar 2006 13:19:12 +0100

removed Raise stuff, implement restack_tag instead which is called on focus_client and takes care of the correct Z layers of all windows of the tag


Diffstat:
cmd/wm/client.c | 6++++--
cmd/wm/event.c | 1-
cmd/wm/tag.c | 29+++++++++++++++++++++++++++++
cmd/wm/wm.h | 1+
4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -99,7 +99,9 @@ focus_client(Client *c) ungrab_mouse(c->win, AnyModifier, AnyButton); grab_mouse(c->win, Mod1Mask, Button1); grab_mouse(c->win, Mod1Mask, Button3); - XRaiseWindow(dpy, c->framewin); + + restack_tag(f->area->tag); + XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); draw_client(c); XSync(dpy, False); @@ -112,7 +114,7 @@ void map_client(Client *c) { XSelectInput(dpy, c->win, CLIENT_MASK & ~StructureNotifyMask); - XMapRaised(dpy, c->win); + XMapWindow(dpy, c->win); XSelectInput(dpy, c->win, CLIENT_MASK); set_client_state(c, NormalState); } diff --git a/cmd/wm/event.c b/cmd/wm/event.c @@ -91,7 +91,6 @@ handle_buttonpress(XEvent *e) else if((c = win2client(ev->window))) { ev->state &= valid_mask; if(ev->state & Mod1Mask) { - XRaiseWindow(dpy, c->framewin); switch (ev->button) { case Button1: focus(c); diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c @@ -305,3 +305,32 @@ sel_client_of_tag(Tag *t) } return nil; } + +void +restack_tag(Tag *t) +{ + unsigned int i, j, n = 0; + static Window *wins = nil; + static unsigned int winssz = 0; + + if(nclient > winssz) { + winssz = 2 * nclient; + free(wins); + wins = cext_emallocz(sizeof(Window) * winssz); + } + + for(i = 0; i < t->narea; i++) { + Area *a = t->area[i]; + if(a->nframe) { + wins[n++] = a->frame[a->sel]->client->framewin; + for(j = 0; j < a->nframe; j++) { + if(j == a->sel) + continue; + wins[n++] = a->frame[j]->client->framewin; + } + } + } + + if(n) + XRestackWindows(dpy, wins, n); +} diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -321,6 +321,7 @@ Bool clientoftag(Tag *t, Client *c); void detach_fromtag(Tag *t, Client *c, Bool unmap); void attach_totag(Tag *t, Client *c); Client *sel_client_of_tag(Tag *t); +void restack_tag(Tag *t); /* wm.c */ void scan_wins();