[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] tree-height and tree-width
From: |
Magnus Henoch |
Subject: |
[STUMP] tree-height and tree-width |
Date: |
Tue, 29 Jun 2004 20:09:40 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Look closely at these function definitions in core.lisp:
(defun tree-x (screen tree)
(tree-accum-fn tree #'min (lambda (n)
(let ((f (frame-data screen n)))
(frame-x f)))))
(defun tree-y (screen tree)
(tree-accum-fn tree #'min (lambda (n)
(let ((f (frame-data screen n)))
(frame-y f)))))
(defun tree-width (screen tree)
(tree-accum-fn tree #'+ (lambda (n)
(let ((f (frame-data screen n)))
(frame-width f)))))
(defun tree-height (screen tree)
(tree-accum-fn tree #'+ (lambda (n)
(let ((f (frame-data screen n)))
(frame-height f)))))
tree-x and tree-y are correct. tree-width and tree-height are not.
For example, if you have two frames next to eachother, tree-height
will add their heights and return twice the correct result.
One way to fix this is to add tree-right and tree-bottom, making them
similar to tree-x and tree-y, and define tree-width as (- tree-right
tree-x) and likewise for tree-height. But this would mean traversing
the tree twice to get width or height. Can someone see a more elegant
solution?
Magnus
- [STUMP] tree-height and tree-width,
Magnus Henoch <=