A bunch of fixes to management of windows

This commit is contained in:
Kris Maglione 2007-02-11 01:09:00 -05:00
parent 2ddd734ab0
commit ef4aef2f28
5 changed files with 55 additions and 19 deletions

2
area.c
View File

@ -407,6 +407,8 @@ select_area(Area *a, char *arg) {
focus_frame: focus_frame:
frame_to_top(p); frame_to_top(p);
focus_frame(p, False); focus_frame(p, False);
if(!p->area->floating)
arrange_column(p->area, False);
if(v == screen->sel) if(v == screen->sel)
restack_view(v); restack_view(v);
flush_masked_events(EnterWindowMask); flush_masked_events(EnterWindowMask);

View File

@ -197,6 +197,22 @@ unmap_client(Client *c, int state) {
c->mapped = 0; c->mapped = 0;
} }
void
map_frame(Client *c) {
if(!c->frame_mapped) {
XMapWindow(blz.dpy, c->framewin);
c->frame_mapped = True;
}
}
void
unmap_frame(Client *c) {
if(c->frame_mapped) {
XUnmapWindow(blz.dpy, c->framewin);
c->frame_mapped = False;
}
}
void void
reparent_client(Client *c, Window w, int x, int y) { reparent_client(Client *c, Window w, int x, int y) {
XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask); XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
@ -493,30 +509,47 @@ resize_client(Client *c, XRectangle *r) {
(c->rect.height == screen->rect.height)) { (c->rect.height == screen->rect.height)) {
f->rect.x = -def.border; f->rect.x = -def.border;
f->rect.y = -labelh(&def.font); f->rect.y = -labelh(&def.font);
}else{ }else
check_frame_constraints(&f->rect); check_frame_constraints(&f->rect);
}
} }
if(f->area->view == screen->sel) if(f->area->view == screen->sel)
XMoveResizeWindow(blz.dpy, c->framewin, f->rect.x, XMoveResizeWindow(blz.dpy, c->framewin, f->rect.x,
f->rect.y, f->rect.width, f->rect.height); f->rect.y, f->rect.width, f->rect.height);
else { else {
unmap_client(c, IconicState); unmap_client(c, IconicState);
XUnmapWindow(blz.dpy, c->framewin); unmap_frame(c);
return;
} }
c->rect.x = def.border; c->rect.x = def.border;
c->rect.y = labelh(&def.font); c->rect.y = labelh(&def.font);
if((f->area->sel == f) || (f->area->mode != Colstack)) { c->rect.width = f->rect.width - 2 * def.border;
if(!c->mapped) c->rect.height = f->rect.height - def.border - labelh(&def.font);
map_client(c);
c->rect.width = f->rect.width - 2 * def.border; if(f->area->sel != f)
c->rect.height = f->rect.height - def.border - labelh(&def.font); switch(f->area->mode) {
XMoveResizeWindow(blz.dpy, c->win, c->rect.x, c->rect.y, case Colmax:
unmap_frame(c);
unmap_client(c, IconicState);
break;
case Colstack:
XMoveResizeWindow(blz.dpy, c->win, c->rect.x, c->rect.y,
c->rect.width, c->rect.height); c->rect.width, c->rect.height);
}else map_frame(c);
unmap_client(c, IconicState); unmap_client(c, IconicState);
break;
default:
goto ShowWindow;
}
else {
ShowWindow:
XMoveResizeWindow(blz.dpy, c->win, c->rect.x, c->rect.y,
c->rect.width, c->rect.height);
map_client(c);
map_frame(c);
}
configure_client(c); configure_client(c);
} }

View File

@ -91,8 +91,6 @@ relax_column(Area *a) {
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2; f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
yoff = f->rect.y + f->rect.height + hdiff; yoff = f->rect.y + f->rect.height + hdiff;
} }
if(a->mode != Colstack || f == a->sel)
match_sizehints(f->client, &f->rect, f->area->floating, NORTH|EAST);
} }
} }
@ -185,6 +183,8 @@ Fallthrough:
break; break;
} }
relax_column(a); relax_column(a);
for(f=a->frame; f; f=f->anext)
resize_client(f->client, &f->rect);
flush_masked_events(EnterWindowMask); flush_masked_events(EnterWindowMask);
} }

4
view.c
View File

@ -116,12 +116,10 @@ focus_view(WMScreen *s, View *v) {
for(c=client; c; c=c->next) for(c=client; c; c=c->next)
if((f = c->sel)) { if((f = c->sel)) {
if(f->view == v) { if(f->view == v) {
map_client(c);
XMapWindow(blz.dpy, c->framewin);
resize_client(c, &f->rect); resize_client(c, &f->rect);
update_client_grab(c); update_client_grab(c);
} else { } else {
XUnmapWindow(blz.dpy, c->framewin); unmap_frame(c);
unmap_client(c, IconicState); unmap_client(c, IconicState);
} }
} }

7
wmii.h
View File

@ -145,6 +145,7 @@ struct Client {
Bool fixedsize; Bool fixedsize;
Bool urgent; Bool urgent;
Bool mapped; Bool mapped;
Bool frame_mapped;
int unmapped; int unmapped;
Window win; Window win;
Window trans; Window trans;
@ -273,8 +274,11 @@ extern void configure_client(Client *c);
extern void prop_client(Client *c, XPropertyEvent *e); extern void prop_client(Client *c, XPropertyEvent *e);
extern void kill_client(Client *c); extern void kill_client(Client *c);
extern void gravitate_client(Client *c, Bool invert); extern void gravitate_client(Client *c, Bool invert);
extern void unmap_client(Client *c, int state);
extern void map_client(Client *c); extern void map_client(Client *c);
extern void unmap_client(Client *c, int state);
extern void map_frame(Client *c);
extern void unmap_frame(Client *c);
extern void focus_frame(Frame *f, Bool restack);
extern void reparent_client(Client *c, Window w, int x, int y); extern void reparent_client(Client *c, Window w, int x, int y);
extern void manage_client(Client *c); extern void manage_client(Client *c);
extern void focus(Client *c, Bool restack); extern void focus(Client *c, Bool restack);
@ -326,7 +330,6 @@ extern void insert_frame(Frame *pos, Frame *f, Bool before);
extern void resize_frame(Frame *f, XRectangle *r); extern void resize_frame(Frame *f, XRectangle *r);
extern Bool frame_to_top(Frame *f); extern Bool frame_to_top(Frame *f);
extern void swap_frames(Frame *fa, Frame *fb); extern void swap_frames(Frame *fa, Frame *fb);
extern void focus_frame(Frame *f, Bool restack);
extern void draw_frame(Frame *f); extern void draw_frame(Frame *f);
extern void draw_frames(); extern void draw_frames();
extern void update_frame_widget_colors(Frame *f); extern void update_frame_widget_colors(Frame *f);