Browse Source

Fix resize at removing fullscreen state with free clients

Martin Duquesnoy 12 years ago
parent
commit
8ba39d3960
3 changed files with 32 additions and 4 deletions
  1. 20 0
      src/client.h
  2. 4 1
      src/ewmh.c
  3. 8 3
      src/layout.c

+ 20 - 0
src/client.h

@@ -186,5 +186,25 @@ clients_tag_arrange_map(struct tag *t)
           sfunc(c);
 }
 
+static inline struct client*
+client_get_larger(struct tag *t)
+{
+     struct client *c, *lc = NULL;
+     int tmp, l = 0;
+
+     FOREACH_NFCLIENT(c, &t->clients, tnext)
+     {
+          if((tmp = (c->geo.w + c->geo.h)) > l)
+          {
+               l = tmp;
+               lc = c;
+          }
+     }
+
+     if(lc && (lc->flags & CLIENT_TABBED))
+          lc = lc->tabmaster;
+
+     return lc;
+}
 
 #endif /* CLIENT_H */

+ 4 - 1
src/ewmh.c

@@ -220,7 +220,10 @@ ewmh_manage_state(long data[], struct client *c)
                                (unsigned char*)0, 0);
                XReparentWindow(W->dpy, c->win, c->frame, c->wgeo.x, c->wgeo.y);
 
-               layout_fix_hole(c);
+               if(c->flags & CLIENT_FREE)
+                    client_moveresize(c, &c->geo);
+               else
+                    layout_fix_hole(c);
           }
      }
 }

+ 8 - 3
src/layout.c

@@ -370,10 +370,15 @@ layout_split_integrate(struct client *c, struct client *sc)
      struct geo g;
      bool f = false;
 
-     /* No sc or not compatible sc */
-     if(!sc || sc == c || sc->tag != c->tag
-        || sc->flags & CLIENT_FREE)
+     /* No sc or not compatible sc to integrate in */
+     if(!sc
+        || sc == c
+        || sc->tag != c->tag
+        || (sc->flags & CLIENT_FREE))
      {
+          /* Larger tiled one?
+             if(!(sc = client_get_larger(c->tag)) || sc == c)*/
+
           /*
            * check for the first tiled client or
            * maximize the lonely client