]> git.mdlowis.com Git - projs/tide.git/commitdiff
tweaked tiling strategy
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 20 May 2019 01:56:05 +0000 (21:56 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 20 May 2019 01:56:05 +0000 (21:56 -0400)
src/tframe.c

index 718d15b46a815aeb4aa04023c24388cf57cb0c2f..2755f2795ed03a051314fbe10f3d1f82ce6ebbe5 100644 (file)
@@ -159,7 +159,6 @@ static void xbtnmotion(XConf* x, XEvent* e) {
 
 static void retile_children(XConf* x) {
     size_t height = x->height - Divider - 2;
-
     Child_T* child = Children;
     if (NChildren == 1) {
         XMoveResizeWindow(x->display, child->wid, 0, Divider+2, x->width, height);
@@ -168,15 +167,19 @@ static void retile_children(XConf* x) {
         XMoveResizeWindow(x->display, child->wid, 0, Divider+2, x->width/2, height);
         /* place the slave windows */
         size_t slave_height = height / (NChildren - 1);
+        size_t slave_extra = height % (NChildren - 1);
         size_t offset = Divider+2;
         for (child = child->next; child; child = child->next, offset += slave_height) {
+            if (!child->next) slave_height += slave_extra;
             XMoveResizeWindow(x->display, child->wid, x->width/2, offset, x->width/2, slave_height);
         }
     }
+    XSync(x->display, False);
     retile = 0;
 }
 
 static void xredraw(XConf* x) {
+    /* retile the windows */
     /* determine the size of the regions */
     size_t maxtagrows = ((x->height/4) / x->font->height);
     size_t tagrows = view_limitrows(&Tags, maxtagrows);
@@ -189,10 +192,9 @@ static void xredraw(XConf* x) {
     Divider = draw_hrule(x, &csr);
     draw_rect(x, EditBg, 0, Divider+2, csr.w, csr.h);
     XCopyArea(x->display, x->pixmap, x->self, x->gc, 0, 0, x->width, x->height, 0, 0);
-    if ((retile || prev_div != Divider) && NChildren) {
-        retile_children(x);
-    }
     XFlush(x->display);
+    if ((retile || prev_div != Divider) && NChildren)
+        retile_children(x);
 }
 
 static void xupdate(Job* job) {