AtlatestRepositorysigil-wm

sigil-wm / tree / examplestiling.sgl

1(import (sigil ffi) (sigil async) (sigil wm model) (sigil wm scene)
2 (sigil wm host) (sigil wm input) (sigil wm repl) (sigil process) (sigil wm examples support))
3
4(define (tiling root box snapshot trigger)
5 (let ((ids (container-children root)))
6 (if (null? ids)
7 '()
8 (let ((width (quotient (rect-width box) (length ids))))
9 (map (lambda (id index)
10 (placement window: id tiled: 15
11 activated?: (= id (container-data root))
12 box: (rect x: (+ (rect-x box) (* index width)) y: (rect-y box)
13 width: (if (= index (- (length ids) 1))
14 (- (rect-width box) (* index width)) width)
15 height: (rect-height box))))
16 ids (iota (length ids)))))))
18(define example (make-example tiling #f))
19(define host (example-host example))
20(with-async
21 (let ((repl (and (getenv "SIGIL_WM_REPL")
22 (start-repl! host (getenv "SIGIL_WM_REPL") (interaction-environment)))))
23 (run-host! host)
24 (when repl (stop-repl! repl))))
25(unless (and (= (host-statistic host 1) 0)
26 (= (host-statistic host 2) 0)
27 (= (host-statistic host 4) 0))
28 (error "native objects or copied buffers survived shutdown"))