******************************************************************************/
static void retile_children(XConf* x) {
- size_t width = x->width / NChildren;
- size_t extra = x->width % NChildren;
- size_t offset = width+extra;
+ size_t height = x->height - Divider - 2;
+
Child_T* child = Children;
- XMoveResizeWindow(x->display, child->wid, 0, Divider+2, width+extra, x->height - Divider - 2);
- for (child = child->next; child; child = child->next) {
- XMoveResizeWindow(x->display, child->wid, offset, Divider+2, width, x->height - Divider - 2);
- offset += width;
+ if (NChildren == 1) {
+ XMoveResizeWindow(x->display, child->wid, 0, Divider+2, x->width, height);
+ } else {
+ /* place the master window */
+ 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 offset = Divider+2;
+ for (child = child->next; child; child = child->next, offset += slave_height) {
+ XMoveResizeWindow(x->display, child->wid, x->width/2, offset, x->width/2, slave_height);
+ }
}
retile = 0;
}
draw_view(x, &Regions[EDIT], x->font, editrows, &csr, EditBg, EditFg, EditSel, SyncMouse);
draw_scroll(x, &csr, win_view(EDIT), Divider);
draw_rect(x, WinBdr, 0, x->height-1, x->width, 1);
+ draw_rect(x, WinBdr, x->width-1, 0, 1, x->height);
XCopyArea(x->display, x->pixmap, x->self, x->gc, 0, 0, x->width, x->height, 0, 0);
SyncMouse = false;
XFlush(x->display);