added general manager options

This commit is contained in:
frese 2003-03-30 01:42:48 +00:00
parent 2f654441c4
commit 1ef21b5897
1 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,9 @@
(define-options-spec manager-options-spec
(focus-policy symbol-list '(enter)) ;; enter, click
)
;; TODO: focus-policy click does not work yet
(define-record-type wm :wm (define-record-type wm :wm
(make-wm type in-channel out-channel internal-out-channel (make-wm type in-channel out-channel internal-out-channel
dpy window colormap options dpy window colormap options
@ -27,8 +33,6 @@
((eq? type (manager-type switch)) "switch-wm") ((eq? type (manager-type switch)) "switch-wm")
((eq? type (manager-type move)) "move-wm"))) ((eq? type (manager-type move)) "move-wm")))
(define focus-policy '(enter click)) ;; TODO: -> options
(define (create-wm dpy parent options children (define (create-wm dpy parent options children
type options-spec out-channel fun) type options-spec out-channel fun)
(let* ((wa (get-window-attributes dpy parent)) (let* ((wa (get-window-attributes dpy parent))
@ -43,7 +47,10 @@
(internal-out-channel (make-channel)) (internal-out-channel (make-channel))
(wm (make-wm type in-channel out-channel internal-out-channel (wm (make-wm type in-channel out-channel internal-out-channel
dpy main-window colormap dpy main-window colormap
(create-options dpy colormap options-spec options) (create-options dpy colormap
(options-spec-union options-spec
manager-options-spec)
options)
'() #f))) '() #f)))
;; set properties ************************************************ ;; set properties ************************************************
@ -94,7 +101,8 @@
(type (any-event-type xevent))) (type (any-event-type xevent)))
(cond (cond
((expose-event? xevent) ((expose-event? xevent)
(send internal-out-channel '(draw-main-window))) (if (= 0 (expose-event-count xevent))
(send internal-out-channel '(draw-main-window))))
((configure-event? xevent) ((configure-event? xevent)
(send internal-out-channel '(fit-windows))) (send internal-out-channel '(fit-windows)))
@ -261,8 +269,9 @@
(dpy (wm:dpy wm))) (dpy (wm:dpy wm)))
(cond (cond
((expose-event? xevent) ((expose-event? xevent)
(send internal-out-channel (if (= 0 (expose-event-count xevent))
(list 'draw-client-window client))) (send internal-out-channel
(list 'draw-client-window client))))
((configure-event? xevent) ((configure-event? xevent)
(send internal-out-channel (send internal-out-channel
(list 'fit-client client))) (list 'fit-client client)))
@ -275,11 +284,11 @@
(list 'update-client-state client)))) (list 'update-client-state client))))
((eq? (event-type enter-notify) type) ((eq? (event-type enter-notify) type)
(if (memq 'enter focus-policy) (if (memq 'enter (get-option-value (wm:options wm) 'focus-policy))
(wm-select-client wm client (crossing-event-time xevent)))) (wm-select-client wm client (crossing-event-time xevent))))
((eq? (event-type button-press) type) ((eq? (event-type button-press) type)
(if (memq 'click focus-policy) (if (memq 'click (get-option-value (wm:options wm) 'focus-policy))
(wm-select-client wm client (button-event-time xevent)))) (wm-select-client wm client (button-event-time xevent))))
((destroy-window-event? xevent) ((destroy-window-event? xevent)