- create-simple-window now uses a border-width of 0.

- fixed a bug in query-tree.

- added auxiliary functions for query-tree: window-root, window-parent
  and window-children.

- added auxiliary functions for map-state: window-mapped?,
  window-viewable? and window-unviewable?
This commit is contained in:
frese 2002-03-17 15:54:09 +00:00
parent 546f0d828f
commit 8b739b7124
1 changed files with 35 additions and 7 deletions

View File

@ -45,7 +45,7 @@
(define (create-simple-window parent width height (define (create-simple-window parent width height
set-window-attribute-alist) set-window-attribute-alist)
(create-window parent 0 0 width height 1 (create-window parent 0 0 width height 0
'copy-from-parent 'copy-from-parent 'copy-from-parent 'copy-from-parent 'copy-from-parent 'copy-from-parent
set-window-attribute-alist)) set-window-attribute-alist))
@ -182,6 +182,15 @@
(define window-override-redirect (define window-override-redirect
(make-win-attr-getter (window-attribute override-redirect))) (make-win-attr-getter (window-attribute override-redirect)))
;; some functions for easier access to the attributes
(define (window-mapped? window)
(not (eq? (map-state is-unmapped) (window-map-state window))))
(define (window-viewable? window)
(eq? (map-state is-viewable) (window-map-state window)))
(define (window-unviewable? window)
(eq? (map-state is-unviewable) (window-map-state window)))
;; The map-window function maps the window and all of its subwindows ;; The map-window function maps the window and all of its subwindows
;; that have had map requests. See XMapWindow. ;; that have had map requests. See XMapWindow.
@ -284,16 +293,35 @@
(let* ((display (window-display window)) (let* ((display (window-display window))
(res (%query-tree (window-Xwindow window) (res (%query-tree (window-Xwindow window)
(display-Xdisplay display)))) (display-Xdisplay display))))
(if res
(list (list
(make-window (vector-ref res 0) display #f) (make-window (vector-ref res 0) display #f)
(make-window (vector-ref res 1) display #f) (make-window (vector-ref res 1) display #f)
(vector->list (vector-map! (lambda (Xwindow) (vector->list (vector-map! (lambda (Xwindow)
(make-window Xwindow display #f)) (make-window Xwindow display #f))
(vector-ref res 2)))))) (vector-ref res 2))))
res)))
(import-lambda-definition %query-tree (Xwindow Xdisplay) (import-lambda-definition %query-tree (Xwindow Xdisplay)
"scx_Query_Tree") "scx_Query_Tree")
(define (window-root window)
(let ((t (query-tree window)))
(and t (car t))))
(define (window-parent window)
(let ((t (query-tree window)))
(and t (cadr t))))
(define (window-children window)
(let ((t (query-tree window)))
(and t (caddr t))))
(define (window-exists? window) ;; maybe this should be done a little
;; bit more clever
(if (query-tree window)
#t #f))
;; translate-coordinates takes the x and y coordinates relative to the ;; translate-coordinates takes the x and y coordinates relative to the
;; source window's origin and returns a list of three elements: the x ;; source window's origin and returns a list of three elements: the x
;; and y coordinates relative to the destination window's origin. If ;; and y coordinates relative to the destination window's origin. If