]> git.mdlowis.com Git - projs/tide.git/commitdiff
implement crude version of dwm tiling
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 16 May 2019 02:42:41 +0000 (22:42 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 16 May 2019 02:42:41 +0000 (22:42 -0400)
src/tframe.c
src/tide.c

index 26da11a3814c21eac18bb7bfab203c1a69c96c15..718d15b46a815aeb4aa04023c24388cf57cb0c2f 100644 (file)
@@ -158,14 +158,20 @@ static void xbtnmotion(XConf* x, XEvent* e) {
  ******************************************************************************/
 
 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;
 }
index 628b5e7e97a5a3d4457178a946d843d8d7255d96..473c89b4043a2bc06582b16ff18387699a7e13da 100644 (file)
@@ -200,6 +200,7 @@ static void xredraw(XConf* x) {
     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);