2001-10-09 11:32:54 -04:00
|
|
|
;; If the specified window is mapped, reparent-window automatically
|
|
|
|
;; performs an UnmapWindow request on it, removes it from its current
|
|
|
|
;; position in the hierarchy, and inserts it as the child of the
|
|
|
|
;; specified parent. See XReparentWindow.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (reparent-window window parent-window x y)
|
|
|
|
(%reparent-window (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
|
|
|
(window-Xwindow parent-window)
|
|
|
|
x y))
|
|
|
|
|
|
|
|
(import-lambda-definition %reparent-window (Xdisplay Xwindow Xwindow_parent x y)
|
|
|
|
"scx_Reparent_Window")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; install-colormap function installs the specified colormap for
|
|
|
|
;; its associated screen. See XInstallColormap.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (install-colormap colormap)
|
|
|
|
(%install-colormap (display-Xdisplay (colormap-display colormap))
|
|
|
|
(colormap-Xcolormap colormap)))
|
|
|
|
|
|
|
|
(import-lambda-definition %install-colormap (Xdisplay Xcolormap)
|
|
|
|
"scx_Install_Colormap")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; uninstall-colormap removes the specified colormap from the required
|
|
|
|
;; list for its screen. See XUninstallColormap.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (uninstall-colormap colormap)
|
|
|
|
(%uninstall-colormap (display-Xdisplay (colormap-display colormap))
|
|
|
|
(colormap-Xcolormap colormap)))
|
|
|
|
|
|
|
|
(import-lambda-definition %uninstall-colormap (Xdisplay Xcolormap)
|
|
|
|
"scx_Uninstall_Colormap")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; list-installed-colormaps function returns a list of the currently
|
|
|
|
;; installed colormaps for the screen of the specified window. See
|
|
|
|
;; XListInstalledColormaps.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (list-installed-colormaps window)
|
|
|
|
(let* ((dpy (window-display window))
|
|
|
|
(ret (%list-installed-colormaps
|
|
|
|
(display-Xdisplay dpy)
|
|
|
|
(window-Xwindow window))))
|
|
|
|
(vector-map! (lambda (Xcolormap)
|
|
|
|
(make-colormap Xcolormap display #f))
|
|
|
|
ret)))
|
|
|
|
|
|
|
|
(import-lambda-definition %list-installed-colormaps (Xdisplay Xwindow)
|
|
|
|
"scx_List_Installed_Colormaps")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; set-input-focus function changes the input focus and the
|
|
|
|
;; last-focus-change time. See XSetInputFocus.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (set-input-focus display window revert-to time)
|
|
|
|
(%set-input-focus (display-Xdisplay display)
|
2002-03-17 10:41:56 -05:00
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
(revert-to->integer revert-to)
|
2001-07-31 10:53:49 -04:00
|
|
|
time))
|
|
|
|
|
2002-02-08 12:09:43 -05:00
|
|
|
(import-lambda-definition %set-input-focus (Xdisplay Xwindow revert-to time)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_Set_Input_Focus")
|
|
|
|
|
2002-02-08 12:09:43 -05:00
|
|
|
(define-enumerated-type revert-to :revert-to
|
|
|
|
revert-to? revert-tos revert-to-name revert-to-index
|
|
|
|
(none pointer-root parent))
|
|
|
|
|
|
|
|
(define (integer->revert-to i)
|
|
|
|
(vector-ref revert-tos i))
|
|
|
|
|
|
|
|
(define (revert-to->integer v)
|
|
|
|
(revert-to-index v))
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; input-focus returns the current focus window and the current focus
|
|
|
|
;; state as a pair. See XGetInputFocus.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (input-focus display)
|
|
|
|
(let ((ret (%input-focus (display-Xdisplay display))))
|
|
|
|
(cons (make-window (car ret) display #f)
|
2002-02-08 12:09:43 -05:00
|
|
|
(integer->revert-to (cdr ret)))))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
(import-lambda-definition %input-focus (Xdisplay)
|
|
|
|
"scx_Input_Focus")
|
|
|
|
|
|
|
|
;; general-warp-pointer moves the pointer in the specified way. See
|
|
|
|
;; XWarpPointer for a detailed description.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (general-warp-pointer display
|
|
|
|
dst-win dst-x dst-y
|
|
|
|
src-win src-x src-y src-width src-height)
|
|
|
|
(%general-warp-pointer (display-Xdisplay display)
|
|
|
|
(window-Xwindow dst-win) dst-x dst-y
|
|
|
|
(window-Xwindow src-win)
|
|
|
|
src-x src-y src-width src-height))
|
|
|
|
|
|
|
|
(import-lambda-definition %general-warp-pointer
|
|
|
|
(Xdisplay Xdst-win dst-x dst-y
|
|
|
|
Xsrc-win src-x src-y src-width src-height)
|
|
|
|
"scx_General_Warp_Pointer")
|
|
|
|
|
2002-03-17 10:41:56 -05:00
|
|
|
;; warp-pointer calls general-warp-pointer with using
|
|
|
|
;; (special-window:none dpy) as the src-win and 0 for the src-*
|
|
|
|
;; coordinates. The display is taken from dst-window.
|
2001-10-09 11:32:54 -04:00
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (warp-pointer dst-window dst-x dst-y)
|
|
|
|
(general-warp-pointer (window-display dst-window)
|
|
|
|
dst-window dst-x dst-y
|
2002-03-17 10:41:56 -05:00
|
|
|
(special-window:none (window-display dst-window))
|
|
|
|
0 0 0 0))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; warp-pointer-relative uses general-warp-pointer to move the pointer
|
|
|
|
;; by x-offset and y-offset away from it's current position.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (warp-pointer-relative display x-offset y-offset)
|
|
|
|
(general-warp-pointer display
|
2002-03-17 10:41:56 -05:00
|
|
|
(special-window:none display)
|
|
|
|
x-offset y-offset
|
|
|
|
(special-window:none display)
|
|
|
|
0 0 0 0))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; bell rings the bell on the keyboard on the specified display, if
|
|
|
|
;; possible. The optional percent argument specifies the volume in a
|
|
|
|
;; range from -100 to 100. 0 is the default value. See XBell.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (bell display . percent)
|
|
|
|
(%bell (display-Xdisplay display)
|
|
|
|
(if (null? percent)
|
|
|
|
0
|
|
|
|
(car percent))))
|
|
|
|
|
|
|
|
(import-lambda-definition %bell (Xdisplay percent)
|
|
|
|
"scx_Bell")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; set-access-control either enables or disables the use of the access
|
|
|
|
;; control list at each connection setup. See XSetAccessControl.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (set-access-control display enable?)
|
|
|
|
(%set-access-control (display-Xdisplay display)
|
|
|
|
enable?))
|
|
|
|
|
|
|
|
(import-lambda-definition %set-access-control (Xdisplay on)
|
|
|
|
"scx_Set_Access_Control")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; Depending on the specified mode, change-save-set either inserts or
|
|
|
|
;; deletes the specified window from the client's save-set. The
|
|
|
|
;; specified window must have been created by some other client, or a
|
|
|
|
;; BadMatch error results. mode is one of 'insert or 'delete. See
|
|
|
|
;; XChangeSaveSet.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (change-save-set window mode)
|
|
|
|
(%change-save-set (display-Xdisplay (window-display window))
|
|
|
|
(window-Xwindow window)
|
2002-02-08 12:09:43 -05:00
|
|
|
(save-set-mode->integer mode)))
|
|
|
|
|
|
|
|
(define-enumerated-type save-set :save-set
|
|
|
|
save-set? save-sets save-set-name save-set-index
|
|
|
|
(insert delete))
|
|
|
|
|
|
|
|
(define (save-set-mode->integer v)
|
|
|
|
(save-set-index v))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %change-save-set (Xdisplay Xwindow mode)
|
|
|
|
"scx_Change_Save_Set")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; set-close-down-mode defines what will happen to the client's
|
|
|
|
;; resources at connection close. mode is one of 'destroy-all,
|
|
|
|
;; 'retain-permanent or 'retain-temporary. See XSetCloseDownMode.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (set-close-down-mode display mode)
|
|
|
|
(%set-close-down-mode (display-Xdisplay display)
|
2002-02-08 12:09:43 -05:00
|
|
|
(close-down-mode->integer mode)))
|
|
|
|
|
|
|
|
(define-enumerated-type close-down-mode :close-down-mode
|
|
|
|
close-down-mode? close-down-modes close-down-mode-name close-down-mode-index
|
|
|
|
(destroy-all retain-permanent retain-temporary))
|
|
|
|
|
|
|
|
(define (close-down-mode->integer v)
|
|
|
|
(close-down-mode-index v))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %set-close-down-mode (Xdisplay mode)
|
|
|
|
"scx_Set_Close_Down_Mode")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; get-pointer-mapping returns a vector, that specifies in the i-th
|
|
|
|
;; element the logical button number for the physical button i+1. See
|
|
|
|
;; XGetPointerMapping.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (get-pointer-mapping display)
|
|
|
|
(%get-pointer-mapping (display-Xdisplay display)))
|
|
|
|
|
|
|
|
(import-lambda-definition %get-pointer-mapping (Xdisplay)
|
|
|
|
"scx_Get_Pointer_Mapping")
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; set-pointer-mapping sets the mapping of the pointer. mapping must
|
|
|
|
;; be a vector of the same length that get-pointer-mapping would
|
|
|
|
;; return. If any of the buttons to be altered are logically in the
|
|
|
|
;; down state, then #f is returned. #t otherwise. See
|
|
|
|
;; XSetPointerMapping.
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (set-pointer-mapping display mapping)
|
|
|
|
(%set-pointer-mapping (display-Xdisplay display)
|
|
|
|
mapping))
|
|
|
|
|
|
|
|
(import-lambda-definition %set-pointer-mapping (Xdisplay map)
|
|
|
|
"scx_Set_Pointer_Mapping")
|
2002-04-26 04:28:40 -04:00
|
|
|
|
|
|
|
;; 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))
|
|
|
|
|