scx/scheme/xlib/drawable.scm

28 lines
992 B
Scheme

;; defined in window.c
(import-lambda-definition %get-geometry (Xdisplay Xdrawable)
"scx_Get_Geometry")
(define (get-geometry drawable)
(let* ((display (drawable-display drawable))
(v (%get-geometry (display-Xdisplay display)
(drawable-Xobject drawable))))
;; wrap the root-window
(vector-set! v 0 (make-window (vector-ref v 0) display #f))
v))
(define (make-geometry-getter num)
(lambda (drawable)
(vector-ref (get-geometry drawable) num)))
;; the drawable-* functions return common information of a window or a
;; pixmap. drawable-root returns a window, all other functions return
;; an integer. See XGetGeometry.
(define drawable-root (make-geometry-getter 0))
(define drawable-x (make-geometry-getter 1))
(define drawable-y (make-geometry-getter 2))
(define drawable-width (make-geometry-getter 3))
(define drawable-height (make-geometry-getter 4))
(define drawable-border-width (make-geometry-getter 5))
(define drawable-depth (make-geometry-getter 6))