From 2b2cdd70dd2df19cdce5f0e80c861edbf310cfea Mon Sep 17 00:00:00 2001 From: frese Date: Fri, 26 Apr 2002 08:28:40 +0000 Subject: [PATCH] - added wm-state property getter and setter. --- scheme/xlib/wm.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/scheme/xlib/wm.scm b/scheme/xlib/wm.scm index b9760fd..6d9cefe 100644 --- a/scheme/xlib/wm.scm +++ b/scheme/xlib/wm.scm @@ -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)) +