2003-03-10 21:47:38 -05:00
|
|
|
;; Copyright (c) 2001-2003 by Norbert Freudemann, David Frese
|
|
|
|
|
|
|
|
(define-enumerated-type bit-gravity :bit-gravity
|
|
|
|
bit-gravity? bit-gravities bit-gravity-name bit-gravity-index
|
|
|
|
(forget north-west north north-east west center east south-west
|
|
|
|
south south-east static))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-bit-gravity" :bit-gravity)
|
|
|
|
(define-exported-binding "scx-bit-gravities" bit-gravities)
|
|
|
|
|
|
|
|
(define-enumerated-type win-gravity :win-gravity
|
|
|
|
win-gravity? win-gravities win-gravity-name win-gravity-index
|
|
|
|
(unmap north-west north north-east west center east south-west
|
|
|
|
south south-east static))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-win-gravity" :win-gravity)
|
|
|
|
(define-exported-binding "scx-win-gravities" win-gravities)
|
|
|
|
|
|
|
|
(define-enumerated-type backing-store :backing-store
|
|
|
|
backing-store? backing-stores backing-store-name backing-store-index
|
|
|
|
(not-useful when-mapped always))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-backing-store" :backing-store)
|
|
|
|
(define-exported-binding "scx-backing-stores" backing-stores)
|
|
|
|
|
|
|
|
(define-enumerated-type set-window-attribute :set-window-attribute
|
|
|
|
set-window-attribute?
|
|
|
|
set-window-attributes
|
|
|
|
set-window-attribute-name
|
|
|
|
set-window-attribute-index
|
|
|
|
;; don't change the order of the attributes! background-pixmap can
|
|
|
|
;; be a pixmap including (special-pixmap:none dpy) and
|
|
|
|
;; (special-pixmap:parent-relative dpy) border-pixmap can be a
|
|
|
|
;; pixmap or (special-pixmap:copy-from-parent dpy)
|
|
|
|
(background-pixmap background-pixel border-pixmap border-pixel
|
|
|
|
bit-gravity gravity backing-store backing-planes backing-pixel
|
|
|
|
override-redirect save-under event-mask do-not-propagate-mask colormap
|
|
|
|
cursor))
|
|
|
|
|
|
|
|
(define-syntax make-set-window-attribute-alist
|
|
|
|
(syntax-rules
|
|
|
|
()
|
|
|
|
((make-set-window-attribute-alist (attr arg) rest ...)
|
|
|
|
(cons (cons (set-window-attribute attr) arg)
|
|
|
|
(make-set-window-attribute-alist rest ...)))
|
|
|
|
((make-set-window-attribute-alist)
|
|
|
|
'())))
|
|
|
|
|
|
|
|
;; *** create windows ************************************************
|
|
|
|
|
|
|
|
(import-lambda-definition create-window
|
|
|
|
(display parent x y width height border_width depth class visual attribs)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition create-simple-window
|
|
|
|
(display parent x y width height border_width border background)
|
|
|
|
"scx_Create_Simple_Window")
|
|
|
|
|
|
|
|
;; *** change window attributes **************************************
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition change-window-attributes (display window attribs)
|
|
|
|
"scx_Change_Window_Attributes")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
(define (make-win-attr-setter attribute)
|
2003-03-10 21:47:38 -05:00
|
|
|
(lambda (display window value)
|
|
|
|
(change-window-attributes display window (list (cons attribute value)))))
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
|
|
|
(define set-window-background-pixmap!
|
|
|
|
(make-win-attr-setter (set-window-attribute background-pixmap)))
|
|
|
|
(define set-window-background-pixel!
|
|
|
|
(make-win-attr-setter (set-window-attribute background-pixel)))
|
|
|
|
(define set-window-border-pixmap!
|
|
|
|
(make-win-attr-setter (set-window-attribute border-pixmap)))
|
|
|
|
(define set-window-border-pixel!
|
|
|
|
(make-win-attr-setter (set-window-attribute border-pixel)))
|
|
|
|
(define set-window-bit-gravity!
|
|
|
|
(make-win-attr-setter (set-window-attribute bit-gravity)))
|
|
|
|
(define set-window-gravity!
|
|
|
|
(make-win-attr-setter (set-window-attribute gravity)))
|
|
|
|
(define set-window-backing-store!
|
|
|
|
(make-win-attr-setter (set-window-attribute backing-store)))
|
|
|
|
(define set-window-backing-planes!
|
|
|
|
(make-win-attr-setter (set-window-attribute backing-planes)))
|
|
|
|
(define set-window-backing-pixel!
|
|
|
|
(make-win-attr-setter (set-window-attribute backing-pixel)))
|
|
|
|
(define set-window-save-under!
|
|
|
|
(make-win-attr-setter (set-window-attribute save-under)))
|
|
|
|
(define set-window-event-mask!
|
|
|
|
(make-win-attr-setter (set-window-attribute event-mask)))
|
2001-06-11 11:28:32 -04:00
|
|
|
(define set-window-do-not-propagate-mask!
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
(make-win-attr-setter (set-window-attribute do-not-propagate-mask)))
|
|
|
|
(define set-window-override-redirect!
|
|
|
|
(make-win-attr-setter (set-window-attribute override-redirect)))
|
|
|
|
(define set-window-colormap!
|
|
|
|
(make-win-attr-setter (set-window-attribute colormap)))
|
|
|
|
(define set-window-cursor!
|
|
|
|
(make-win-attr-setter (set-window-attribute cursor)))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** configure windows *********************************************
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-enumerated-type stack-mode :stack-mode
|
|
|
|
stack-mode? stack-modes stack-mode-name stack-mode-index
|
|
|
|
(above below top-if buttom-if opposite))
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-exported-binding "scx-stack-mode" :stack-mode)
|
|
|
|
(define-exported-binding "scx-stack-modes" stack-modes)
|
|
|
|
|
|
|
|
;; an enumerated type for XWindowChange. Used in configure-window
|
|
|
|
|
|
|
|
(define-enumerated-type window-change :window-change
|
|
|
|
window-change? window-changes window-change-name window-change-index
|
|
|
|
(x y width height border-width sibling stack-mode))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-window-change" :window-change)
|
|
|
|
(define-exported-binding "scx-window-changes" window-changes)
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-syntax make-window-change-alist
|
|
|
|
(syntax-rules
|
|
|
|
()
|
|
|
|
((make-window-change-alist (attr arg) rest ...)
|
|
|
|
(cons (cons (window-change attr) arg)
|
|
|
|
(make-window-change-alist rest ...)))
|
|
|
|
((make-window-change-alist)
|
|
|
|
'())))
|
|
|
|
|
|
|
|
(import-lambda-definition configure-window (display window changes)
|
|
|
|
"scx_Configure_Window")
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
|
|
|
(define (make-win-configurer change)
|
|
|
|
(lambda (window value)
|
|
|
|
(configure-window window (list (cons change value)))))
|
|
|
|
|
|
|
|
(define set-window-x! (make-win-configurer (window-change x)))
|
|
|
|
(define set-window-y! (make-win-configurer (window-change y)))
|
|
|
|
(define set-window-width! (make-win-configurer (window-change width)))
|
|
|
|
(define set-window-height! (make-win-configurer (window-change height)))
|
|
|
|
(define set-window-border-width!
|
|
|
|
(make-win-configurer (window-change border-width)))
|
|
|
|
(define set-window-sibling! (make-win-configurer (window-change sibling)))
|
|
|
|
(define set-window-stack-mode!
|
|
|
|
(make-win-configurer (window-change stack-mode)))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (move-window display window x y)
|
|
|
|
(configure-window display window
|
|
|
|
(make-window-change-alist (x x) (y y))))
|
|
|
|
|
|
|
|
(define (resize-window display window width height)
|
|
|
|
(configure-window display window
|
|
|
|
(make-window-change-alist (width width)
|
|
|
|
(height height))))
|
|
|
|
|
|
|
|
(define (move-resize-window display window x y width height)
|
|
|
|
(configure-window display window
|
|
|
|
(make-window-change-alist (x x) (y y)
|
|
|
|
(width width)
|
|
|
|
(height height))))
|
|
|
|
|
|
|
|
;; *** get current window attribute or geometry **********************
|
|
|
|
|
|
|
|
(define-enumerated-type map-state :map-state
|
|
|
|
map-state? map-states map-state-name map-state-index
|
|
|
|
(is-unmapped is-unviewable is-viewable))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-map-state" :map-state)
|
|
|
|
(define-exported-binding "scx-map-states" map-states)
|
|
|
|
|
|
|
|
(define-enumerated-type window-class :window-class
|
|
|
|
window-class? window-classes window-class-name window-class-index
|
|
|
|
(copy-from-parent input-output input-only))
|
|
|
|
|
|
|
|
(define-exported-binding "scx-window-class" :window-class)
|
|
|
|
(define-exported-binding "scx-window-classes" window-classes)
|
|
|
|
|
|
|
|
(define-record-type window-attributes :window-attributes
|
|
|
|
(make-window-attributes x y width height border-width depth visual root
|
|
|
|
class bit-gravity gravity backing-store
|
|
|
|
backing-planes backing-pixel save-under
|
|
|
|
colormap map-installed map-state all-event-masks
|
|
|
|
your-event-mask do-not-propagate-mask
|
|
|
|
override-redirect screen)
|
|
|
|
window-attributes?
|
|
|
|
(x window-attribute:x)
|
|
|
|
(y window-attribute:y)
|
|
|
|
(width window-attribute:width)
|
|
|
|
(height window-attribute:height)
|
|
|
|
(border-width window-attribute:border-width)
|
|
|
|
(depth window-attribute:depth)
|
|
|
|
(visual window-attribute:visual)
|
|
|
|
(root window-attribute:root)
|
|
|
|
(class window-attribute:class)
|
|
|
|
(bit-gravity window-attribute:bit-gravity)
|
|
|
|
(gravity window-attribute:gravity)
|
|
|
|
(backing-store window-attribute:backing-store)
|
|
|
|
(backing-planes window-attribute:backing-planes)
|
|
|
|
(backing-pixel window-attribute:backing-pixel)
|
|
|
|
(save-under window-attribute:save-under)
|
|
|
|
(colormap window-attribute:colormap)
|
|
|
|
(map-installed window-attribute:map-installed)
|
|
|
|
(map-state window-attribute:map-state)
|
|
|
|
(all-event-masks window-attribute:all-event-masks)
|
|
|
|
(your-event-mask window-attribute:your-event-mask)
|
|
|
|
(do-not-propagate-mask window-attribute:do-not-propagate-mask)
|
|
|
|
(override-redirect window-attribute:override-redirect)
|
|
|
|
(screen window-attribute:screen))
|
|
|
|
|
|
|
|
(import-lambda-definition get-window-attributes (display window)
|
|
|
|
"scx_Get_Window_Attributes")
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns a vector #(root-window x y width height border-width depth) or #f
|
|
|
|
(import-lambda-definition get-geometry (display drawable)
|
|
|
|
"scx_Get_Geometry")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (make-geometry-getter i)
|
|
|
|
(lambda (display window)
|
|
|
|
(let ((a (get-geometry display window)))
|
|
|
|
(and a (vector-ref a i)))))
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;;(define window-root (make-geometry-getter 0))
|
|
|
|
(define window-x (make-geometry-getter 1))
|
|
|
|
(define window-y (make-geometry-getter 2))
|
|
|
|
(define window-width (make-geometry-getter 3))
|
|
|
|
(define window-height (make-geometry-getter 4))
|
|
|
|
(define window-border-width (make-geometry-getter 5))
|
|
|
|
(define window-depth (make-geometry-getter 6))
|
|
|
|
|
|
|
|
;; *** map windows ***************************************************
|
|
|
|
|
|
|
|
(import-lambda-definition map-window (display window)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Map_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition map-raised (display window)
|
|
|
|
"scx_Map_Raised")
|
|
|
|
|
|
|
|
(import-lambda-definition map-subwindows (display window)
|
|
|
|
"scx_Map_Subwindows")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** unmap windows *************************************************
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition unmap-window (display window)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Unmap_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition unmap-subwindows (display window)
|
|
|
|
"scx_Unmap_Subwindows")
|
|
|
|
|
|
|
|
;; *** destroy windows ***********************************************
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition destroy-window (display window)
|
|
|
|
"scx_Destroy_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition destroy-subwindows (display window)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Destroy_Subwindows")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** change window stacking order **********************************
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition raise-window (display window)
|
|
|
|
"scx_Raise_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition lower-window (display window)
|
|
|
|
"scx_Lower_Window")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-enumerated-type circulate-direction :circulate-direction
|
|
|
|
circulate-direction? circulate-directions circulate-direction-name
|
|
|
|
circulate-direction-index
|
|
|
|
(raise-lowest lower-highest))
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define-exported-binding "scx-circulate-direction" :circulate-direction)
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition circulate-subwindows (display window direction)
|
|
|
|
"scx_Circulate_Subwindows")
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (circulate-subwindows-up display window)
|
|
|
|
(circulate-subwindows display window (circulate-direction raise-lowest)))
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (circulate-subwindows-down display window)
|
|
|
|
(circulate-subwindows display window (circulate-direction lower-highest)))
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition restack-windows (display windows)
|
|
|
|
"scx_Restack_Windows")
|
|
|
|
|
|
|
|
;; *** clear area or window ******************************************
|
2001-06-11 11:28:32 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition clear-area
|
|
|
|
(display window x y width height exposures?)
|
|
|
|
"scx_Clear_Area")
|
|
|
|
|
|
|
|
(import-lambda-definition clear-window (display window)
|
|
|
|
"scx_Clear_Window")
|
|
|
|
|
|
|
|
;; *** query window tree information *********************************
|
|
|
|
|
|
|
|
;; returns a list (root-window parent-window children) or #f
|
|
|
|
(import-lambda-definition query-tree (display window)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Query_Tree")
|
2001-07-09 09:49:38 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (window-root display window)
|
|
|
|
(let ((t (query-tree display window)))
|
2002-03-17 10:54:09 -05:00
|
|
|
(and t (car t))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (window-parent display window)
|
|
|
|
(let ((t (query-tree display window)))
|
2002-03-17 10:54:09 -05:00
|
|
|
(and t (cadr t))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (window-children display window)
|
|
|
|
(let ((t (query-tree display window)))
|
2002-03-17 10:54:09 -05:00
|
|
|
(and t (caddr t))))
|
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** translate window coordinates **********************************
|
2001-07-09 09:49:38 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; returns a list (dest-x dest-y child) or #f
|
|
|
|
(import-lambda-definition translate-coordinates
|
|
|
|
(display src-w dest-w src-x src-y)
|
|
|
|
"scx_Translate_Coordinates")
|
2001-07-09 09:49:38 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** get pointer coordinates ***************************************
|
2001-07-09 09:49:38 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(import-lambda-definition %query-pointer (display window)
|
- changed variable arguments and return values in set-wm-hints!,
get-wm-hints, set-wm-normal-hints!, get-wm-normal-hints,
create-gcontext, change-gcontext, get-visual-info,
change-window-attributes, get-window-attributes, configure-window,
create-window to use an enumerated type instead of symbols.
- renamed functions in xlib-client (e.g. wm-hints to get-wm-hints).
2002-01-06 11:53:13 -05:00
|
|
|
"scx_Query_Pointer")
|
2003-03-10 21:47:38 -05:00
|
|
|
|
|
|
|
(define (query-pointer-root display)
|
|
|
|
(let ((q (%query-pointer display (default-root-window display))))
|
|
|
|
(and q (list (vector-ref q 0) ;; the root-window that the pointer is on
|
|
|
|
(vector-ref q 2) ;; x and
|
|
|
|
(vector-ref q 3))))) ;; y coordinates on that root-window
|
|
|
|
|
|
|
|
(define (query-pointer-state display)
|
|
|
|
(let ((q (%query-pointer display (default-root-window display))))
|
|
|
|
(and q (vector-ref q 6))))
|
|
|
|
|
|
|
|
(define (query-pointer display window)
|
|
|
|
(let ((q (%query-pointer display window)))
|
|
|
|
(and q (vector-ref q 7)
|
|
|
|
(list (vector-ref q 1) ;; child of window that contains
|
|
|
|
;; the pointer or None
|
|
|
|
(vector-ref q 4) ;; x and y coordinates
|
|
|
|
(vector-ref q 5))))) ;; relative to window
|