diff --git a/src/root-manager.scm b/src/root-manager.scm index b0886aa..13f4db6 100644 --- a/src/root-manager.scm +++ b/src/root-manager.scm @@ -444,7 +444,7 @@ (define (manager-parent root-wm manager) (let loop ((parent-window (window-parent (root-wm:dpy root-wm) (wm:window manager)))) - (if (zero? parent-window) + (if (or (not parent-window) (zero? parent-window)) #f (let ((l (filter (lambda (m) (equal? (wm:window m) parent-window)) diff --git a/src/utils.scm b/src/utils.scm index 148f99f..b70e359 100644 --- a/src/utils.scm +++ b/src/utils.scm @@ -48,7 +48,7 @@ (let ((res (fun (lambda () (sync-point-release sp))))) ;;(mdisplay "thread " id " returned: " res "\n") res) - )))) + ))) id) (sync-point-wait sp)))) (define (with-lock lock thunk) @@ -299,8 +299,11 @@ (map-state is-viewable))) (define (window-mapped? dpy window) - (not (eq? (window-attribute:map-state (get-window-attributes dpy window)) - (map-state is-unmapped)))) + (and window + (let ((attrs (get-window-attributes dpy window))) + (and attrs + (not (eq? (window-attribute:map-state attrs) + (map-state is-unmapped))))))) (define (window-focused? dpy window) (eq? (get-input-focus-window dpy) window)) @@ -594,8 +597,9 @@ (property:data p) '()))))) (map (lambda (win) - (window-attribute:colormap (get-window-attributes dpy win))) - wins))) + (window-attribute:colormap + (get-window-attributes dpy win))) + (filter (lambda (x) x) wins)))) (define (install-colormaps dpy window) (for-each (lambda (c)