[hackers] [wmii] A bunch of fixes to management of windows

From: Kris Maglione <jg_AT_suckless.org>
Date: Sun Feb 11 07:10:45 2007

changeset: 1841:0ba78a35a7ec
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sun Feb 11 01:09:00 2007 -0500
summary: A bunch of fixes to management of windows

diff -r f5cf28af4a47 -r 0ba78a35a7ec area.c
--- a/area.c Sun Feb 11 00:11:10 2007 -0500
+++ b/area.c Sun Feb 11 01:09:00 2007 -0500
@@ -407,6 +407,8 @@ focus_frame:
 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 -r f5cf28af4a47 -r 0ba78a35a7ec client.c
--- a/client.c Sun Feb 11 00:11:10 2007 -0500
+++ b/client.c Sun Feb 11 01:09:00 2007 -0500
@@ -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);
+ 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);
+ 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);
- }else
- unmap_client(c, IconicState);
+ c->rect.width, c->rect.height);
+ map_client(c);
+ map_frame(c);
+
+ }
         configure_client(c);
 }
 
diff -r f5cf28af4a47 -r 0ba78a35a7ec column.c
--- a/column.c Sun Feb 11 00:11:10 2007 -0500
+++ b/column.c Sun Feb 11 01:09:00 2007 -0500
@@ -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 -r f5cf28af4a47 -r 0ba78a35a7ec view.c
--- a/view.c Sun Feb 11 00:11:10 2007 -0500
+++ b/view.c Sun Feb 11 01:09:00 2007 -0500
@@ -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 -r f5cf28af4a47 -r 0ba78a35a7ec wmii.h
--- a/wmii.h Sun Feb 11 00:11:10 2007 -0500
+++ b/wmii.h Sun Feb 11 01:09:00 2007 -0500
@@ -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 prop_client(Client *c, XProp
 extern void prop_client(Client *c, XPropertyEvent *e);
 extern void kill_client(Client *c);
 extern void gravitate_client(Client *c, Bool invert);
+extern void map_client(Client *c);
 extern void unmap_client(Client *c, int state);
-extern void map_client(Client *c);
+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 resize_frame(Frame *f, XRect
 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);
Received on Sun Feb 11 2007 - 07:10:45 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:10 UTC