anchor.diff:    (setf (window-event-mask *root*) '(:substructure-notify))
   
     (unwind-protect
  -       (loop do
  -         (event-case (*display* :discard-p t)
  -                     (:key-press (code state)
  -                                 (when (eql (key-press code state) 'quit)
  -                                   (loop-finish)))
  -                     (:button-press (code state child) (button-press code state child))
  -                     (:motion-notify (event-window root-x root-y time)
  -                                     (motion-notify event-window root-x root-y time))
  -                     (:button-release () (ungrab-pointer *display*))
  -                     (:configure-request
  -                      (window x y width height)
  -                      (setf (drawable-x window) x (drawable-y window) y
  -                            (drawable-width window) width (drawable-height window) height))
  -                     (:map-notify (window override-redirect-p)
  -                                  (unless override-redirect-p
  -                                    (focus (plus window))))
  -                     (:unmap-notify (window) (focus (minus window)))))
  -    (ungrab-button *root* (code *move*) :modifiers (state *move*))
  -    (ungrab-button *root* (code *resize*) :modifiers (state *resize*))
  -    (ungrab-button *root* (code *close*) :modifiers (state *close*))
  +       (do () ((eql (process-event *display* :handler *handlers* :discard-p t) 'quit)))
  +    (dolist (b (list *move* *resize* *close*))
  +      (ungrab-button *root* (code b) :modifiers (state b)))
       (ungrab-key *root* (code *prefix*) :modifiers (state *prefix*))
       (close-display *display*)))
   
  
positive.code:                    (drawable-height event-window) new-h))
             (setf last-resize time)))))
  
  ;;; Main
  (defun main ()
    ;; Grab prefix and mouse buttons on root
  
negative.code: 
  (defvar *display* (open-default-display))
  (defvar *root* (screen-root (display-default-screen *display*)))
  (defparameter *handlers* (make-list (length xlib::*event-key-vector*)
                                      :initial-element
                                      #'(lambda (&rest slots)
                                          (format t "~A ~A~%"
                                                  (getf slots :event-key)
                                                  (getf slots :window)))))
  (defparameter *windows* nil "List of managed and mapped windows.")
  (defparameter *hidden* nil "List of hidden windows.")
  (defparameter *last* nil "Last focused window.")
  (defparameter *curr* nil "Current focused window.")
  
  (defmacro defhandler (event keys &body body)
    (let ((fn-name (gensym))
          (event-slots (gensym)))
      `(labels ((,fn-name (&rest ,event-slots &key ,@keys &allow-other-keys)
                  (declare (ignore ,event-slots))
                  ,@body))
         (setf (elt *handlers* (position ,event xlib::*event-key-vector*)) #',fn-name))))
  
  (defun mods (l) (butlast l))
  (defun kchar (l) (car (last l)))
  