separated default options (config) and saved options (layout)

cleaned up a bit
This commit is contained in:
frese 2003-04-27 19:06:44 +00:00
parent c4b7b03879
commit 315a71013a
1 changed files with 15 additions and 12 deletions

View File

@ -91,6 +91,7 @@
(define (create-workspace-manager in-channel dpy parent options) (define (create-workspace-manager in-channel dpy parent options)
(let ((wm (create-switch-wm in-channel dpy parent (let ((wm (create-switch-wm in-channel dpy parent
'()
(cons (cons 'titlebar-height 0) (cons (cons 'titlebar-height 0)
(get-option-value options (get-option-value options
'workspace-options)))) 'workspace-options))))
@ -141,7 +142,8 @@
(let* ((window (unmap-event-window xevent)) (let* ((window (unmap-event-window xevent))
(wm (manager-of-window root-wm window))) (wm (manager-of-window root-wm window)))
(set-wm-state! dpy window (wm-state withdrawn) none) (set-wm-state! dpy window (wm-state withdrawn) none)
(wm-unmanage-window wm window))) (if wm
(wm-unmanage-window wm window))))
))) )))
(define (do-split root-wm orientation new-wm) (define (do-split root-wm orientation new-wm)
@ -153,14 +155,15 @@
(splitter (splitter
(create-split-wm in-channel dpy (create-split-wm in-channel dpy
(window-parent dpy (wm:window current)) (window-parent dpy (wm:window current))
(cons (cons 'orientation orientation) (list (cons 'orientation orientation))
(get-option-value options (get-option-value options
'default-split-options)))) 'default-split-options)))
(first current) (first current)
(creator (if (eq? new-wm 'switch-wm) (creator (if (eq? new-wm 'switch-wm)
create-switch-wm create-switch-wm
create-move-wm)) create-move-wm))
(second (creator in-channel dpy (wm:window splitter) (second (creator in-channel dpy (wm:window splitter)
'()
(get-option-value options (get-option-value options
(if (eq? new-wm 'switch-wm) (if (eq? new-wm 'switch-wm)
'default-switch-options 'default-switch-options
@ -206,6 +209,7 @@
(if (eq? (car msg) 'create-switch-wm) (if (eq? (car msg) 'create-switch-wm)
(manager-type switch) (manager-type switch)
(manager-type move)) (manager-type move))
'()
(get-option-value (root-wm:options root-wm) (get-option-value (root-wm:options root-wm)
(if (eq? (car msg) (if (eq? (car msg)
'create-switch-wm) 'create-switch-wm)
@ -225,6 +229,7 @@
(if (eq? type 'switch-wm) (if (eq? type 'switch-wm)
(manager-type switch) (manager-type switch)
(manager-type move)) (manager-type move))
'()
(get-option-value (root-wm:options root-wm) (get-option-value (root-wm:options root-wm)
(if (eq? type 'switch-wm) (if (eq? type 'switch-wm)
'default-switch-options 'default-switch-options
@ -242,9 +247,7 @@
(time (second msg))) (time (second msg)))
(if (not (null? l)) (if (not (null? l))
(let ((window (client:window (car l)))) (let ((window (client:window (car l))))
(mdisplay "kill-client: " window "\n") (delete-window dpy window time))
(delete-window dpy window time)
#t)
#f))))) #f)))))
(let loop ((window (get-input-focus-window dpy))) (let loop ((window (get-input-focus-window dpy)))
(if (and (window-exists? dpy window) (if (and (window-exists? dpy window)
@ -313,7 +316,7 @@
'(#\y #\Y #\n #\N) #f))) '(#\y #\Y #\n #\N) #f)))
(if (memq a '(#\y #\Y)) (if (memq a '(#\y #\Y))
(exit #t)))) (exit #t))))
(else (mdisplay "unknown root message: " msg "\n")))) (else (warn "unhandled root message" msg))))
(define (exec-complete str pos) (define (exec-complete str pos)
;; TODO ;; TODO
@ -423,7 +426,7 @@
(define (manager-of-window root-wm window) (define (manager-of-window root-wm window)
(or (get-manager-by-window root-wm window) (or (get-manager-by-window root-wm window)
(let ((w (window-parent (root-wm:dpy root-wm) window))) (let ((w (window-parent (root-wm:dpy root-wm) window)))
(and w (manager-of-window root-wm w))))) (and w (not (zero? w)) (manager-of-window root-wm w)))))
(define (get-manager-by-window root-wm window) (define (get-manager-by-window root-wm window)
(let ((l (filter (lambda (wm) (let ((l (filter (lambda (wm)
@ -434,17 +437,17 @@
(define (is-workspace-window? root-wm window) (define (is-workspace-window? root-wm window)
(let ((p (window-parent (root-wm:dpy root-wm) window))) (let ((p (window-parent (root-wm:dpy root-wm) window)))
(and p (and p (not (zero? p))
(let ((wm (manager-of-window root-wm p))) (let ((wm (manager-of-window root-wm p)))
(and wm (eq? wm (root-wm:initial-manager root-wm))))))) (and wm (eq? wm (root-wm:initial-manager root-wm)))))))
(define (create-new-manager root-wm type options parent) (define (create-new-manager root-wm type options defaults parent)
(let* ((creator (cond (let* ((creator (cond
((eq? type (manager-type split)) create-split-wm) ((eq? type (manager-type split)) create-split-wm)
((eq? type (manager-type switch)) create-switch-wm) ((eq? type (manager-type switch)) create-switch-wm)
((eq? type (manager-type move)) create-move-wm))) ((eq? type (manager-type move)) create-move-wm)))
(wm (creator (root-wm:in-channel root-wm) (root-wm:dpy root-wm) (wm (creator (root-wm:in-channel root-wm) (root-wm:dpy root-wm)
(wm:window parent) options))) (wm:window parent) options defaults)))
(wm-manage-window parent (wm:window wm)) (wm-manage-window parent (wm:window wm))
(add-manager! root-wm wm) (add-manager! root-wm wm)
(set-root-wm:current-manager! root-wm wm) (set-root-wm:current-manager! root-wm wm)