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

This commit is contained in:
Anselm R. Garbe 2006-03-09 13:19:12 +01:00
parent 02999b502b
commit 4d796b3c5c
4 changed files with 34 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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();