Skip to content

Commit

Permalink
Preserve value of icon field when changing WM_STATE property
Browse files Browse the repository at this point in the history
  • Loading branch information
mwitmer committed Feb 3, 2014
1 parent e328f32 commit f31cbe0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions module/guile-wm/icccm.scm
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,19 @@
(define-public (window-wm-hints win)
(window-struct-property win wm-hints (pre-defined-atom 'wm-hints)))

(define (wm-state-atom) (xref (reply-for intern-atom #f "WM_STATE") 'atom))
(define wm-state-atom
(let ((a #f))
(lambda ()
(cond (a a)
(else (set! a (xref (reply-for intern-atom #f "WM_STATE") 'atom))
a)))))

(define-public (window-state win)
(window-struct-property win wm-state (wm-state-atom)))

(define-public (set-window-state! win state)
(define new-win-wm-state (make-wm-state state 0))
(format #t "Setting window state on ~a to ~a\n" win state)
(define new-win-wm-state (or (window-state win) (make-wm-state 0 0)))
(xset! new-win-wm-state 'state state)
(let ((property-atom (wm-state-atom)))
(change-property
'replace win property-atom property-atom 8
Expand Down

0 comments on commit f31cbe0

Please sign in to comment.