Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!psuvax1!wuarchive!husc6!encore!pierson From: pierson@encore.com (Dan L. Pierson) Newsgroups: comp.windows.x Subject: Re: twm - What is size of title bar? Message-ID: Date: 15 Oct 90 23:22:38 GMT References: <162@sdrc.UUCP> <1990Oct13.184110.13150@ux1.cso.uiuc.edu> <1990Oct15.140039.24990@Solbourne.COM> Sender: news@Encore.COM Distribution: usa Organization: Encore Computer Corporation Lines: 67 In-reply-to: toml@ninja.Solbourne.COM's message of 15 Oct 90 14:00:39 GMT Regarding Re: twm - What is size of title bar?; toml@ninja.Solbourne.COM (Tom LaStrange) adds: In article <1990Oct15.140039.24990@Solbourne.COM> toml@ninja.Solbourne.COM (Tom LaStrange) writes: > In article <1990Oct13.184110.13150@ux1.cso.uiuc.edu>, > carroll@sunc5.cs.uiuc.edu (Alan M. Carroll) writes: |> What we've > done for this is to trace back the X window tree until you get a > window |> whose parent is the root window, and then retrieve the > screen information for that |> window. This can be compared to the > information for the actual client window to |> determine the size of > the various WM borders. I don't have any C code for this, |> but > here's some Epoch code that does it - > This will not work with tvtwm or any other window manager that > places an extra window on top of the root window. There really is > no "standard" way to find out how big the decoration is around your > window. However this should: ;;; Utilities to find screen information for the tvtwm virtual root ;;; (or the real root if not running tvtwm). (defun find-root (&optional start) (setq start (or start (current-screen))) (let ((tree (epoch::query-tree start))) (while (car (cdr tree)) (setq tree (epoch::query-tree (car (cdr tree))))) tree)) ;;; Standard Elisp control structures are very impoverished. If ;;; you're willing to load cl.elc use this one, if not see below. (defun find-virtual-root (&optional start) (do* ((vr-atom (epoch::intern-atom "__SWM_VROOT")) (tree (find-root start) (cdr tree)) (win (car tree) (car tree)) (root win) (ans nil)) ((or ans (null tree)) (or ans root)) (when win (setq ans (epoch::get-property vr-atom win))))) ;;; Use this version to avoid using cl.ecl. (defun find-virtual-root (&optional start) (let* ((vr-atom (epoch::intern-atom "__SWM_VROOT")) (tree (find-root start)) (root (car tree))) (catch 'found-it (while tree (let ((win (car tree))) (setq tree (cdr tree)) (if win (let ((ans (epoch::get-property vr-atom win))) (if ans (progn (setq root ans) (throw 'found-it ans)))))))))) (defun backing-screen-info (&optional win) (let ((root (find-virtual-root (or win (current-screen))))) (and root (screen-information root)))) -- dan In real life: Dan Pierson, Encore Computer Corporation, Research UUCP: {talcott,linus,necis,decvax}!encore!pierson Internet: pierson@encore.com