- added wm-state property getter and setter.

This commit is contained in:
frese 2002-04-26 08:28:40 +00:00
parent 205abfb826
commit 2b2cdd70dd
1 changed files with 32 additions and 0 deletions

View File

@ -201,3 +201,35 @@
(import-lambda-definition %set-pointer-mapping (Xdisplay map)
"scx_Set_Pointer_Mapping")
;; WM_STATE property
(define (get-wm-state window)
(let* ((dpy (window-display window))
(a (intern-atom dpy "WM_STATE"))
(v.t.f (get-property window a #f)))
(if (and v.t.f
(eq? (cadr v.t.f) a)
(>= (vector-length (car v.t.f)) 2))
(let ((v (car v.t.f)))
(list (integer->wm-state (vector-ref v 0))
(make-window (vector-ref v 1) dpy #f)))
#f)))
(define (set-wm-state window wm-state icon-window)
(let* ((dpy (window-display window))
(a (intern-atom dpy "WM_STATE")))
(change-property window a a 32
(list->vector (list (wm-state->integer wm-state)
(window-Xwindow icon-window))))))
(define-enumerated-type wm-state :wm-state
wm-state? wm-states wm-state-name wm-state-index
(withdrawn normal wm-state-2 iconic))
(define (integer->wm-state i)
(vector-ref wm-states i))
(define (wm-state->integer s)
(wm-state-index s))