Skip to content

Commit

Permalink
Fix procedure to list top level windows; add corresponding window pre…
Browse files Browse the repository at this point in the history
…dicate
  • Loading branch information
mwitmer committed Feb 3, 2014
1 parent 9757b05 commit e328f32
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions module/guile-wm/icccm.scm
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,20 @@
(window-property-value (get-window-property win wm-name-atom)))

(define-public (top-level-windows)
(define query-tree (reply-for query-tree (current-root)))
(define wins (vector->list (xref query-tree 'children)))
(define query (reply-for query-tree (current-root)))
(define wins (vector->list (xref query 'children)))
(define attribute-alist (map cons wins (window-attributes wins)))
(define (is-top-level? attr-pair)
(and (eq? (xref (cdr attr-pair) 'map-state) 'viewable)
(not (xref (cdr attr-pair) 'override-redirect))))
(map car (filter is-top-level? attribute-alist)))

(define-public (top-level-window? win)
(let lp ((wins (top-level-windows)))
(cond ((null? wins) #f)
((xid= (car wins) win) #t)
(else (lp (cdr wins))))))

(define-xcb-struct wm-size-hints
(make-wm-size-hints
flags min-width min-height max-width max-height
Expand Down

0 comments on commit e328f32

Please sign in to comment.