Advertisement
Guest User

stumpwm patch

a guest
Feb 25th, 2013
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.54 KB | None | 0 0
  1. diff --git a/primitives.lisp b/primitives.lisp
  2. index 50d062e..96ffa58 100644
  3. --- a/primitives.lisp
  4. +++ b/primitives.lisp
  5. @@ -40,6 +40,7 @@
  6.            *focus-window-hook*
  7.            *place-window-hook*
  8.            *start-hook*
  9. +          *quit-hook*
  10.            *internal-loop-hook*
  11.            *focus-frame-hook*
  12.            *new-frame-hook*
  13. @@ -190,6 +191,9 @@ window group and frame")
  14.  (defvar *start-hook* '()
  15.    "A hook called when stumpwm starts.")
  16.  
  17. +(defvar *quit-hook* '()
  18. +  "A hook called when stumpwm quits.")
  19. +
  20.  (defvar *internal-loop-hook* '()
  21.    "A hook called inside stumpwm's inner loop.")
  22.  
  23. diff --git a/stumpwm.lisp b/stumpwm.lisp
  24. index 845c745..65d4ba7 100644
  25. --- a/stumpwm.lisp
  26. +++ b/stumpwm.lisp
  27. @@ -267,4 +267,5 @@ of those expired."
  28.               ((eq ret :restart))
  29.               (t
  30.                ;; the number is the unix return code
  31. +              (run-hook *quit-hook*)
  32.                (return-from stumpwm 0))))))
  33. diff --git a/window.lisp b/window.lisp
  34. index 81be639..8b3f6f3 100644
  35. --- a/window.lisp
  36. +++ b/window.lisp
  37. @@ -315,16 +315,37 @@ _NET_WM_STATE_DEMANDS_ATTENTION set"
  38.     (xwin-net-wm-name win)
  39.     (xlib:wm-name win)))
  40.  
  41. +(defun maxmin-equal-p (win)
  42. +  (let* ((xwin (window-xwin win))
  43. +         (hints (xlib:wm-normal-hints xwin)))
  44. +    
  45. +    (with-accessors
  46. +     ((min-width xlib:wm-size-hints-min-width)
  47. +      (max-width xlib:wm-size-hints-max-width)
  48. +      (min-height xlib:wm-size-hints-min-height)
  49. +      (max-height xlib:wm-size-hints-max-height)) hints
  50. +      
  51. +      (and
  52. +       hints
  53. +       max-height
  54. +       min-height
  55. +       max-width
  56. +       min-width
  57. +       (= min-height max-height)
  58. +       (= min-width max-width)))))
  59. +
  60.  ;; FIXME: should we raise the winodw or its parent?
  61.  (defmethod raise-window (win)
  62.    "Map the window if needed and bring it to the top of the stack. Does not affect focus."
  63. -  (when (window-urgent-p win)
  64. -    (window-clear-urgency win))
  65. -  (when (window-hidden-p win)
  66. -    (unhide-window win)
  67. -    (update-configuration win))
  68. -  (when (window-in-current-group-p win)
  69. -    (setf (xlib:window-priority (window-parent win)) :top-if)))
  70. +  (let ((maxmin-notequal (not (maxmin-equal-p win))))
  71. +    (when (window-urgent-p win)
  72. +      (window-clear-urgency win))
  73. +    (when (window-hidden-p win)
  74. +      (unhide-window win)
  75. +      (if maxmin-notequal
  76. +          (update-configuration win)))
  77. +    (when (and maxmin-notequal (window-in-current-group-p win))
  78. +      (setf (xlib:window-priority (window-parent win)) :top-if))))
  79.  
  80.  ;; some handy wrappers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement