소스 검색

fix client integration on the screen

Jérémy Anger 12 년 전
부모
커밋
e65c6a706a
3개의 변경된 파일12개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 1
      src/client.c
  2. 5 2
      src/client.h
  3. 6 3
      src/layout.c

+ 1 - 1
src/client.c

@@ -549,7 +549,7 @@ _client_tab(struct client *c, struct client *cm)
      /* Do not tab already tabbed client */
      if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER)
         || c->tag != cm->tag || c == cm
-        || (c->flags & CLIENT_IGNORE_TAG) != (cm->flags & CLIENT_IGNORE_TAG))
+        || !COMPCLIENT(c, cm))
           return;
 
      layout_split_arrange_closed(c);

+ 5 - 2
src/client.h

@@ -18,6 +18,9 @@
      SLIST_FOREACH(V, H, F)       \
      if(!(V->flags & CLIENT_FREE))
 
+/* Are two clients compatibles ? (to be tabbed together) */
+#define COMPCLIENT(C1, C2) ((C1->flags & CLIENT_IGNORE_TAG) == (C2->flags & CLIENT_IGNORE_TAG))
+
 void client_configure(struct client *c);
 struct client *client_gb_win(Window w);
 struct client *client_gb_frame(Window w);
@@ -188,14 +191,14 @@ clients_tag_arrange_map(struct tag *t)
 }
 
 static inline struct client*
-client_get_larger(struct tag *t)
+client_get_larger(struct tag *t, bool ignoring_tag)
 {
      struct client *c, *lc = NULL;
      int tmp, l = 0;
 
      FOREACH_NFCLIENT(c, &t->clients, tnext)
      {
-          if((tmp = (c->geo.w + c->geo.h)) > l)
+          if((tmp = (c->geo.w + c->geo.h)) > l && (c->flags & CLIENT_IGNORE_TAG) == ignoring_tag)
           {
                l = tmp;
                lc = c;

+ 6 - 3
src/layout.c

@@ -395,8 +395,9 @@ layout_split_integrate(struct client *c, struct client *sc)
      if(!sc
         || sc == c
         || sc->tag != c->tag
-        || (sc->flags & CLIENT_FREE))
-          sc = client_get_larger(c->tag);
+        || (sc->flags & CLIENT_FREE)
+								|| !COMPCLIENT(c, sc))
+          sc = client_get_larger(c->tag, c->flags & CLIENT_IGNORE_TAG);
 
      /* Largest not correct */
      if(!sc || sc == c)
@@ -419,13 +420,14 @@ layout_split_integrate(struct client *c, struct client *sc)
      }
 
      /* Tab Next Opened Client option */
-     if(W->flags & WMFS_TABNOC)
+     if(W->flags & WMFS_TABNOC && COMPCLIENT(c, sc))
      {
           W->flags ^= WMFS_TABNOC;
           _client_tab(c, sc);
           return;
      }
 
+     /* If there are clients but we can tab with them, split the screen. */
      c->flags |= CLIENT_TILED;
 
      g = layout_split(sc, (sc->geo.h < sc->geo.w));
@@ -437,6 +439,7 @@ layout_split_integrate(struct client *c, struct client *sc)
      client_fac_hint(sc);
 
      layout_save_set(c->tag);
+     W->flags &= ~WMFS_TABNOC;
 }
 
 /* Arrange inter-clients holes: