From: Michael D. Lowis Date: Mon, 20 May 2019 01:56:05 +0000 (-0400) Subject: tweaked tiling strategy X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7ecb853ec937a960d892301e05507990249e5b32;p=projs%2Ftide.git tweaked tiling strategy --- diff --git a/src/tframe.c b/src/tframe.c index 718d15b..2755f27 100644 --- a/src/tframe.c +++ b/src/tframe.c @@ -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) {