2003-03-10 21:47:38 -05:00
|
|
|
;; Copyright (c) 2001-2003 by Norbert Freudemann, David Frese
|
|
|
|
|
|
|
|
;; *** reparent windows **********************************************
|
|
|
|
|
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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function reparent-window (display window parent x y)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_Reparent_Window")
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** control colormaps *********************************************
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; install-colormap function installs the specified colormap for
|
|
|
|
;; its associated screen. See XInstallColormap.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function install-colormap (display colormap)
|
2001-07-31 10:53:49 -04:00
|
|
|
"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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function uninstall-colormap (display colormap)
|
2001-07-31 10:53:49 -04:00
|
|
|
"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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function list-installed-colormaps (display window)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_List_Installed_Colormaps")
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** control input focus *******************************************
|
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; set-input-focus function changes the input focus and the
|
|
|
|
;; last-focus-change time. See XSetInputFocus.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function set-input-focus (display window 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))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-exported-binding "scx-revert-to" :revert-to)
|
|
|
|
(define-exported-binding "scx-revert-tos" revert-tos)
|
2002-02-08 12:09:43 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; get-input-focus returns the current focus window and the current focus
|
|
|
|
;; state (revert-to) as a pair. See XGetInputFocus.
|
2002-02-08 12:09:43 -05:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function get-input-focus (display)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Get_Input_Focus")
|
2001-10-09 11:32:54 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (get-input-focus-window display)
|
|
|
|
(car (get-input-focus display)))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** move pointer **************************************************
|
2001-10-09 11:32:54 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function general-warp-pointer
|
2003-03-10 21:47:38 -05:00
|
|
|
(display src dest src-x src-y src-width src-height
|
|
|
|
dest-x dest-y)
|
|
|
|
"scx_Warp_Pointer")
|
2001-10-09 11:32:54 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; warp-pointer calls general-warp-pointer with using None as the
|
|
|
|
;; source window, and therefor moving the pointer to the destination
|
|
|
|
;; window unconditionally
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (warp-pointer display dst-window dst-x dst-y)
|
|
|
|
(general-warp-pointer display none dst-window
|
|
|
|
0 0 0 0 dst-x dst-y))
|
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)
|
2003-03-10 21:47:38 -05:00
|
|
|
(general-warp-pointer display none
|
2002-03-17 10:41:56 -05:00
|
|
|
x-offset y-offset
|
2003-03-10 21:47:38 -05:00
|
|
|
none
|
2002-03-17 10:41:56 -05:00
|
|
|
0 0 0 0))
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** manipulate keyboard settings **********************************
|
|
|
|
|
|
|
|
;; XChangeKeyboardControl ?? TODO
|
|
|
|
|
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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function %bell (display percent)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Bell")
|
|
|
|
|
2001-07-31 10:53:49 -04:00
|
|
|
(define (bell display . percent)
|
2003-03-10 21:47:38 -05:00
|
|
|
(%bell display
|
2001-07-31 10:53:49 -04:00
|
|
|
(if (null? percent)
|
|
|
|
0
|
|
|
|
(car percent))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** control host access *******************************************
|
|
|
|
|
|
|
|
;; XAddHost etc. ?? TODO
|
2001-07-31 10:53:49 -04:00
|
|
|
|
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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function set-access-control (display enable?)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_Set_Access_Control")
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** change a client's save set ************************************
|
|
|
|
|
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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function change-save-set (display window mode)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Change_Save_Set")
|
2002-02-08 12:09:43 -05:00
|
|
|
|
|
|
|
(define-enumerated-type save-set :save-set
|
|
|
|
save-set? save-sets save-set-name save-set-index
|
|
|
|
(insert delete))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-exported-binding "scx-save-set" :save-set)
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** control clients ***********************************************
|
2001-07-31 10:53:49 -04:00
|
|
|
|
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.
|
|
|
|
|
2002-02-08 12:09:43 -05:00
|
|
|
(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))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-exported-binding "scx-close-down-mode" :close-down-mode)
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function set-close-down-mode (display mode)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_Set_Close_Down_Mode")
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function kill-client (display xid)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Kill_Client")
|
|
|
|
|
|
|
|
;; *** manipulate pointer settings ***********************************
|
|
|
|
|
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.
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function get-pointer-mapping (display)
|
2001-07-31 10:53:49 -04:00
|
|
|
"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
|
2003-03-10 21:47:38 -05:00
|
|
|
;; down state, then #f is returned and the mapping is not changed, #t
|
|
|
|
;; otherwise. See XSetPointerMapping.
|
2001-07-31 10:53:49 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function set-pointer-mapping (display mapping)
|
2001-07-31 10:53:49 -04:00
|
|
|
"scx_Set_Pointer_Mapping")
|
2002-04-26 04:28:40 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; TODO: there is a lot more...
|
2002-04-26 04:28:40 -04:00
|
|
|
;; WM_STATE property
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;(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))
|