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