Skip to content

Commit

Permalink
normalize the wm-normal-hints structure whenever it is requested from…
Browse files Browse the repository at this point in the history
… the x server

skype's profile window was setting the max-height hint to 0 which was breaking stumpwm, as seen here:

#S(XLIB:WM-SIZE-HINTS :USER-SPECIFIED-POSITION-P NIL :USER-SPECIFIED-SIZE-P T
   :X NIL :Y NIL :WIDTH 300 :HEIGHT 386 :MIN-WIDTH 300 :MIN-HEIGHT 386
   :MAX-WIDTH 300
   :MAX-HEIGHT 0
   :WIDTH-INC NIL :HEIGHT-INC NIL :MIN-ASPECT NIL
   :MAX-ASPECT NIL :BASE-WIDTH NIL :BASE-HEIGHT NIL :WIN-GRAVITY :NORTH-WEST
   :PROGRAM-SPECIFIED-POSITION-P NIL :PROGRAM-SPECIFIED-SIZE-P T)
  • Loading branch information
Shawn committed Oct 19, 2008
1 parent 19bdb63 commit 9155760
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion events.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ converted to an atom is removed."
;; Let the mode line know about the new name.
(update-all-mode-lines))
(:wm_normal_hints
(setf (window-normal-hints window) (xlib:wm-normal-hints (window-xwin window))
(setf (window-normal-hints window) (get-normalized-normal-hints (window-xwin window))
(window-type window) (xwin-type (window-xwin window)))
(dformat 4 "new hints: ~s~%" (window-normal-hints window))
(maximize-window window))
Expand Down
26 changes: 23 additions & 3 deletions window.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,26 @@ _NET_WM_STATE_DEMANDS_ATTENTION set"
;; 0 0 300 200 t)
;; (xlib:clear-area (window-parent window)))))

(defun get-normalized-normal-hints (xwin)
(macrolet ((validate-hint (fn)
(setf fn (intern (concatenate 'string (string :wm-size-hints-) (string fn)) :xlib))
`(setf (,fn hints) (and (,fn hints)
(plusp (,fn hints))
(,fn hints)))))
(let ((hints (xlib:wm-normal-hints xwin)))
(when hints
(validate-hint :min-width)
(validate-hint :min-height)
(validate-hint :max-width)
(validate-hint :max-height)
(validate-hint :base-width)
(validate-hint :base-height)
(validate-hint :width-inc)
(validate-hint :height-inc)
(validate-hint :min-aspect)
(validate-hint :max-aspect))
hints)))

(defun xwin-net-wm-name (win)
"Return the netwm wm name"
(let ((name (xlib:get-property win :_NET_WM_NAME)))
Expand Down Expand Up @@ -427,7 +447,7 @@ _NET_WM_STATE_DEMANDS_ATTENTION set"

(defun xwin-maxsize-p (win)
"Returns T if WIN specifies maximum dimensions."
(let ((hints (xlib:wm-normal-hints win)))
(let ((hints (get-normalized-normal-hints win)))
(and hints (or (xlib:wm-size-hints-max-width hints)
(xlib:wm-size-hints-max-height hints)
(xlib:wm-size-hints-min-aspect hints)
Expand Down Expand Up @@ -782,7 +802,7 @@ than the root window's width and height."
:res (xwin-res-name xwin)
:role (xwin-role xwin)
:type (xwin-type xwin)
:normal-hints (xlib:wm-normal-hints xwin)
:normal-hints (get-normalized-normal-hints xwin)
:state +iconic-state+
:plist (make-hash-table)
:unmap-ignores 0))
Expand Down Expand Up @@ -1001,7 +1021,7 @@ needed."
(window-res window) (xwin-res-name (window-xwin window))
(window-role window) (xwin-role (window-xwin window))
(window-type window) (xwin-type (window-xwin window))
(window-normal-hints window) (xlib:wm-normal-hints (window-xwin window))
(window-normal-hints window) (get-normalized-normal-hints (window-xwin window))
(window-number window) (find-free-window-number (window-group window))
(window-state window) +iconic-state+
(xwin-state (window-xwin window)) +iconic-state+
Expand Down

0 comments on commit 9155760

Please sign in to comment.