commit ef4aef2f285852befdf48c83807cf23c277fc4f0
parent 2ddd734ab030ce3a38a623efb02c785e73da004d
Author: Kris Maglione <jg@suckless.org>
Date: Sun, 11 Feb 2007 01:09:00 -0500
A bunch of fixes to management of windows
Diffstat:
5 files changed, 55 insertions(+), 19 deletions(-)
diff --git a/area.c b/area.c
@@ -407,6 +407,8 @@ select_area(Area *a, char *arg) {
focus_frame:
frame_to_top(p);
focus_frame(p, False);
+ if(!p->area->floating)
+ arrange_column(p->area, False);
if(v == screen->sel)
restack_view(v);
flush_masked_events(EnterWindowMask);
diff --git a/client.c b/client.c
@@ -198,6 +198,22 @@ unmap_client(Client *c, int state) {
}
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
reparent_client(Client *c, Window w, int x, int y) {
XSelectInput(blz.dpy, c->win, CLIENT_MASK & ~StructureNotifyMask);
XReparentWindow(blz.dpy, c->win, w, x, y);
@@ -493,30 +509,47 @@ resize_client(Client *c, XRectangle *r) {
(c->rect.height == screen->rect.height)) {
f->rect.x = -def.border;
f->rect.y = -labelh(&def.font);
- }else{
+ }else
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,
f->rect.y, f->rect.width, f->rect.height);
else {
unmap_client(c, IconicState);
- XUnmapWindow(blz.dpy, c->framewin);
+ unmap_frame(c);
+ return;
}
c->rect.x = def.border;
c->rect.y = labelh(&def.font);
- if((f->area->sel == f) || (f->area->mode != Colstack)) {
- if(!c->mapped)
- map_client(c);
- c->rect.width = f->rect.width - 2 * def.border;
- c->rect.height = f->rect.height - def.border - labelh(&def.font);
- XMoveResizeWindow(blz.dpy, c->win, c->rect.x, c->rect.y,
+ c->rect.width = f->rect.width - 2 * def.border;
+ c->rect.height = f->rect.height - def.border - labelh(&def.font);
+
+ if(f->area->sel != f)
+ switch(f->area->mode) {
+ 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);
- }else
- unmap_client(c, IconicState);
+ map_frame(c);
+ 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);
}
diff --git a/column.c b/column.c
@@ -91,8 +91,6 @@ relax_column(Area *a) {
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
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;
}
relax_column(a);
+ for(f=a->frame; f; f=f->anext)
+ resize_client(f->client, &f->rect);
flush_masked_events(EnterWindowMask);
}
diff --git a/view.c b/view.c
@@ -116,12 +116,10 @@ focus_view(WMScreen *s, View *v) {
for(c=client; c; c=c->next)
if((f = c->sel)) {
if(f->view == v) {
- map_client(c);
- XMapWindow(blz.dpy, c->framewin);
resize_client(c, &f->rect);
update_client_grab(c);
} else {
- XUnmapWindow(blz.dpy, c->framewin);
+ unmap_frame(c);
unmap_client(c, IconicState);
}
}
diff --git a/wmii.h b/wmii.h
@@ -145,6 +145,7 @@ struct Client {
Bool fixedsize;
Bool urgent;
Bool mapped;
+ Bool frame_mapped;
int unmapped;
Window win;
Window trans;
@@ -273,8 +274,11 @@ extern void configure_client(Client *c);
extern void prop_client(Client *c, XPropertyEvent *e);
extern void kill_client(Client *c);
extern void gravitate_client(Client *c, Bool invert);
-extern void unmap_client(Client *c, int state);
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 manage_client(Client *c);
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 Bool frame_to_top(Frame *f);
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_frames();
extern void update_frame_widget_colors(Frame *f);