Configure geometry before applying rules
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index 0362114..9585683 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -565,6 +565,7 @@ void
 configurenotify(XEvent *e)
 {
        Monitor *m;
+       Client *c;
        XConfigureEvent *ev = &e->xconfigure;
        int dirty;
 
@@ -576,8 +577,12 @@ configurenotify(XEvent *e)
                if (updategeom() || dirty) {
                        drw_resize(drw, sw, bh);
                        updatebars();
-                       for (m = mons; m; m = m->next)
+                       for (m = mons; m; m = m->next) {
+                               for (c = m->clients; c; c = c->next)
+                                       if (c->isfullscreen)
+                                               resizeclient(c, m->mx, m->my, m->mw, m->mh);
                                XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
+                       }
                        focus(NULL);
                        arrange(NULL);
                }
@@ -1038,6 +1043,13 @@ manage(Window w, XWindowAttributes *wa)
 
        c = ecalloc(1, sizeof(Client));
        c->win = w;
+       /* geometry */
+       c->x = c->oldx = wa->x;
+       c->y = c->oldy = wa->y;
+       c->w = c->oldw = wa->width;
+       c->h = c->oldh = wa->height;
+       c->oldbw = wa->border_width;
+
        updatetitle(c);
        if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
                c->mon = t->mon;
@@ -1046,12 +1058,6 @@ manage(Window w, XWindowAttributes *wa)
                c->mon = selmon;
                applyrules(c);
        }
-       /* geometry */
-       c->x = c->oldx = wa->x;
-       c->y = c->oldy = wa->y;
-       c->w = c->oldw = wa->width;
-       c->h = c->oldh = wa->height;
-       c->oldbw = wa->border_width;
 
        if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
                c->x = c->mon->mx + c->mon->mw - WIDTH(c);