clearified client creation process

fixed some more problems with immediately closed clients
fixed dead-lock problem with wm-select-client
This commit is contained in:
frese 2003-04-22 15:38:19 +00:00
parent 68e7a41372
commit d158788001
1 changed files with 80 additions and 67 deletions

View File

@ -152,16 +152,23 @@
(dpy (wm:dpy wm))) (dpy (wm:dpy wm)))
(case (car msg) (case (car msg)
((manage-window) ((manage-window)
(let* ((window (second msg)) (let ((window (second msg))
(client (create-client wm window))
(maybe-rect (third msg))) (maybe-rect (third msg)))
(let ((client (create-client wm window)))
(set-wm:clients! wm (append (wm:clients wm) (list client))) (set-wm:clients! wm (append (wm:clients wm) (list client)))
(if (window-exists? dpy window)
(map-window dpy window))
(send internal-out-channel (send internal-out-channel
(list 'init-client client maybe-rect)) (list 'init-client client maybe-rect))
(send internal-out-channel (list 'fit-client client)) ;;(send internal-out-channel (list 'fit-client client))
;; sync ?? ;;(send internal-out-channel (list 'update-client-state client))
(map-window dpy window) )))
(send internal-out-channel (list 'update-client-state client))))
((configure-window)
(let ((window (second msg))
(changes (third msg)))
(send internal-out-channel
(list 'configure-window window changes))))
((unmanage-window) ((unmanage-window)
(let* ((window (second msg)) (let* ((window (second msg))
@ -225,11 +232,15 @@
;; sync ?? ;; sync ??
) )
(define (wm-configure-window wm window changes)
(send (wm:in-channel wm) (list 'configure-window window changes)))
(define (wm-unmanage-window wm window) (define (wm-unmanage-window wm window)
(send (wm:in-channel wm) (list 'unmanage-window window))) (send (wm:in-channel wm) (list 'unmanage-window window)))
(define (wm-select-client wm client time) (define (wm-select-client wm client time)
(send (wm:in-channel wm) (list 'select-client client time))) (spawn (lambda ()
(send (wm:in-channel wm) (list 'select-client client time)))))
(define (destroy-wm wm) (define (destroy-wm wm)
(send (wm:in-channel wm) '(destroy-manager))) (send (wm:in-channel wm) '(destroy-manager)))
@ -344,8 +355,8 @@
(send internal-out-channel (send internal-out-channel
(list 'draw-client-window client)))) (list 'draw-client-window client))))
((configure-event? xevent) ((configure-event? xevent)
(send internal-out-channel (if (window-exists? dpy (client:window client))
(list 'fit-client client))) (send internal-out-channel (list 'fit-client client))))
((or (focus-change-event? xevent) (circulate-event? xevent)) ((or (focus-change-event? xevent) (circulate-event? xevent))
;; TODO: look at mode? or maybe only look at focus-in of the ;; TODO: look at mode? or maybe only look at focus-in of the
;; client, because the client-window never gets the focus ;; client, because the client-window never gets the focus
@ -370,8 +381,6 @@
(let ((type (any-event-type xevent)) (let ((type (any-event-type xevent))
(internal-out-channel (wm:internal-out-channel wm)) (internal-out-channel (wm:internal-out-channel wm))
(dpy (wm:dpy wm))) (dpy (wm:dpy wm)))
(if (or (destroy-window-event? xevent)
(window-exists? dpy (client:window client)))
(cond (cond
((eq? (event-type focus-out) type) ((eq? (event-type focus-out) type)
(let ((mode (focus-change-event-mode xevent)) (let ((mode (focus-change-event-mode xevent))
@ -416,16 +425,20 @@
(exit 'reparent)))) (exit 'reparent))))
((unmap-event? xevent) ((unmap-event? xevent)
;; might be the transition to withdrawn-state, wm-state ;; might be the transition to withdrawn-state, wm-state
;; change by root-manager ;; change by root-manager --> reparent to root ??
(if (or (not (window-exists? dpy (client:window client)))
(not (eq? (client:client-window client)
(window-parent dpy (client:window client)))))
(begin
(wm-deinit-client wm client) (wm-deinit-client wm client)
(exit 'unmap)) (exit 'unmap))))
((destroy-window-event? xevent) ((destroy-window-event? xevent)
(mdisplay "destroy-window-event client " wm " " client "\n") (mdisplay "destroy-window-event client " wm " " client "\n")
(if (eq? (client:window client) (destroy-window-event-event xevent)) (if (eq? (client:window client) (destroy-window-event-event xevent))
(begin (begin
(wm-deinit-client wm client) (wm-deinit-client wm client)
(exit 'destroy)))) (exit 'destroy))))
)))) )))
(define (transients-for-client wm client) (define (transients-for-client wm client)
(filter (lambda (c) (filter (lambda (c)