diff --git a/src/manager.scm b/src/manager.scm index 65ce92d..b61bfa6 100644 --- a/src/manager.scm +++ b/src/manager.scm @@ -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 (make-wm type in-channel out-channel internal-out-channel dpy window colormap options @@ -27,8 +33,6 @@ ((eq? type (manager-type switch)) "switch-wm") ((eq? type (manager-type move)) "move-wm"))) -(define focus-policy '(enter click)) ;; TODO: -> options - (define (create-wm dpy parent options children type options-spec out-channel fun) (let* ((wa (get-window-attributes dpy parent)) @@ -43,7 +47,10 @@ (internal-out-channel (make-channel)) (wm (make-wm type in-channel out-channel internal-out-channel 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))) ;; set properties ************************************************ @@ -94,7 +101,8 @@ (type (any-event-type xevent))) (cond ((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) (send internal-out-channel '(fit-windows))) @@ -261,8 +269,9 @@ (dpy (wm:dpy wm))) (cond ((expose-event? xevent) - (send internal-out-channel - (list 'draw-client-window client))) + (if (= 0 (expose-event-count xevent)) + (send internal-out-channel + (list 'draw-client-window client)))) ((configure-event? xevent) (send internal-out-channel (list 'fit-client client))) @@ -275,11 +284,11 @@ (list 'update-client-state client)))) ((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)))) ((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)))) ((destroy-window-event? xevent)