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
(list 'init-client client maybe-rect))
;;(send internal-out-channel (list 'fit-client client))
;;(send internal-out-channel (list 'update-client-state client))
)))
((configure-window)
(let ((window (second msg))
(changes (third msg)))
(send internal-out-channel (send internal-out-channel
(list 'init-client client maybe-rect)) (list 'configure-window window changes))))
(send internal-out-channel (list 'fit-client client))
;; sync ??
(map-window dpy window)
(send internal-out-channel (list 'update-client-state client))))
((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,62 +381,64 @@
(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) (cond
(window-exists? dpy (client:window client))) ((eq? (event-type focus-out) type)
(cond (let ((mode (focus-change-event-mode xevent))
((eq? (event-type focus-out) type) (detail (focus-change-event-detail xevent)))
(let ((mode (focus-change-event-mode xevent)) (if (and (eq? mode (notify-mode normal))
(detail (focus-change-event-detail xevent))) (memq detail (list (notify-detail nonlinear)
(if (and (eq? mode (notify-mode normal)) (notify-detail nonlinear-virtual)
(memq detail (list (notify-detail nonlinear) (notify-detail ancestor))))
(notify-detail nonlinear-virtual) ;; focus lost -- if window-exists?
(notify-detail ancestor)))) (uninstall-colormaps dpy (client:window client)))))
;; focus lost -- if window-exists? ((eq? (event-type focus-in) type)
(uninstall-colormaps dpy (client:window client))))) (let ((mode (focus-change-event-mode xevent))
((eq? (event-type focus-in) type) (detail (focus-change-event-detail xevent)))
(let ((mode (focus-change-event-mode xevent)) (if (and (eq? mode (notify-mode normal))
(detail (focus-change-event-detail xevent))) (memq detail (list (notify-detail nonlinear)
(if (and (eq? mode (notify-mode normal)) (notify-detail nonlinear-virtual)
(memq detail (list (notify-detail nonlinear) (notify-detail ancestor))))
(notify-detail nonlinear-virtual) ;; focus taken -- if window-exists?
(notify-detail ancestor)))) (install-colormaps dpy (client:window client)))))
;; focus taken -- if window-exists?
(install-colormaps dpy (client:window client)))))
((property-event? xevent) ((property-event? xevent)
(let ((name (get-atom-name (property-event-display xevent) (let ((name (get-atom-name (property-event-display xevent)
(property-event-atom xevent)))) (property-event-atom xevent))))
(cond (cond
((equal? "WM_NAME" name) ((equal? "WM_NAME" name)
(send internal-out-channel (send internal-out-channel
(list 'update-client-state client))) (list 'update-client-state client)))
;; TODO: respect NORMAL_HINTS change ;; TODO: respect NORMAL_HINTS change
))) )))
((configure-event? xevent) ((configure-event? xevent)
;; TODO: we have to prevent this event if changed the size on our own. ;; TODO: we have to prevent this event if changed the size on our own.
;; --> XReconfigureWMWindow ?? ;; --> XReconfigureWMWindow ??
(send internal-out-channel (list 'fit-client-window client)) (send internal-out-channel (list 'fit-client-window client))
) )
((reparent-event? xevent) ((reparent-event? xevent)
(if (or (not (window-exists? dpy (client:window client))) (if (or (not (window-exists? dpy (client:window client)))
(not (eq? (client:client-window client) (not (eq? (client:client-window client)
(window-parent dpy (client:window client))))) (window-parent dpy (client:window client)))))
(begin (begin
(mdisplay "manager " (wm:type wm) " reparented client\n") (mdisplay "manager " (wm:type wm) " reparented client\n")
(wm-deinit-client wm client) (wm-deinit-client wm client)
(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 ??
(wm-deinit-client wm client) (if (or (not (window-exists? dpy (client:window client)))
(exit 'unmap)) (not (eq? (client:client-window client)
((destroy-window-event? xevent) (window-parent dpy (client:window client)))))
(mdisplay "destroy-window-event client " wm " " client "\n") (begin
(if (eq? (client:window client) (destroy-window-event-event xevent)) (wm-deinit-client wm client)
(begin (exit 'unmap))))
(wm-deinit-client wm client) ((destroy-window-event? xevent)
(exit 'destroy)))) (mdisplay "destroy-window-event client " wm " " client "\n")
)))) (if (eq? (client:window client) (destroy-window-event-event xevent))
(begin
(wm-deinit-client wm client)
(exit 'destroy))))
)))
(define (transients-for-client wm client) (define (transients-for-client wm client)
(filter (lambda (c) (filter (lambda (c)