Ensure window type for leader
authorPhilippe Brochard <pbrochard@common-lisp.net>
Sat, 16 Feb 2013 22:23:12 +0000 (16 23:23 +0100)
committerPhilippe Brochard <pbrochard@common-lisp.net>
Sat, 16 Feb 2013 22:23:12 +0000 (16 23:23 +0100)
src/clfswm-circulate-mode.lisp
src/clfswm.lisp
src/xlib-util.lisp

index bc8ea8b..fd8ca93 100644 (file)
     (xlib:destroy-window *circulate-window*))
   (when *circulate-font*
     (xlib:close-font *circulate-font*))
-  (xlib:display-finish-output *display*)
   (setf *circulate-window* nil
        *circulate-gc* nil
-       *circulate-font* nil))
+       *circulate-font* nil)
+  (xlib:display-finish-output *display*))
 
 (defun circulate-loop-function ()
   (unless (is-a-key-pressed-p)
index 730d5d8..62cdf76 100644 (file)
@@ -79,9 +79,9 @@
                (when (or (child-equal-p window (current-child))
                          (is-in-current-child-p window))
                  (setf change (or change :moved))
-                 (show-all-children)
                  (focus-window window)
-                 (focus-all-children window (find-parent-frame window (find-current-root))))))))
+                 (focus-all-children window (find-parent-frame window (find-current-root)))
+                 (show-all-children))))))
         (unless (eq change :resized)
           ;; To be ICCCM compliant, send a fake configuration notify event only when
           ;; the window has moved and not when it has been resized or the border width has changed.
index 3fef7cf..8748db3 100644 (file)
@@ -378,7 +378,7 @@ they should be windows. So use this function to make a window out of them."
   (first (xlib:get-property window :WM_TRANSIENT_FOR)))
 
 (defun window-leader (window)
-  (when window
+  (when (xlib:window-p window)
     (or (first (xlib:get-property window :WM_CLIENT_LEADER))
         (let ((id (window-transient-for window)))
           (when id
@@ -505,22 +505,23 @@ they should be windows. So use this function to make a window out of them."
 (defun window-type (window)
   "Return one of :desktop, :dock, :toolbar, :utility, :splash,
 :dialog, :transient, :maxsize and :normal."
-  (or (and (let ((hints (xlib:wm-normal-hints window)))
-             (and hints (or (and (xlib:wm-size-hints-max-width hints)
-                                 (< (xlib:wm-size-hints-max-width hints) (x-drawable-width *root*)))
-                            (and (xlib:wm-size-hints-max-height hints)
-                                 (< (xlib:wm-size-hints-max-height hints) (x-drawable-height *root*)))
-                            (xlib:wm-size-hints-min-aspect hints)
-                            (xlib:wm-size-hints-max-aspect hints))))
-           :maxsize)
-      (let ((net-wm-window-type (xlib:get-property window :_NET_WM_WINDOW_TYPE)))
-        (when net-wm-window-type
-          (dolist (type-atom net-wm-window-type)
-            (when (assoc (xlib:atom-name *display* type-atom) +netwm-window-types+)
-              (return (cdr (assoc (xlib:atom-name *display* type-atom) +netwm-window-types+)))))))
-      (and (xlib:get-property window :WM_TRANSIENT_FOR)
-           :transient)
-      :normal))
+  (when (xlib:window-p window)
+    (or (and (let ((hints (xlib:wm-normal-hints window)))
+               (and hints (or (and (xlib:wm-size-hints-max-width hints)
+                                   (< (xlib:wm-size-hints-max-width hints) (x-drawable-width *root*)))
+                              (and (xlib:wm-size-hints-max-height hints)
+                                   (< (xlib:wm-size-hints-max-height hints) (x-drawable-height *root*)))
+                              (xlib:wm-size-hints-min-aspect hints)
+                              (xlib:wm-size-hints-max-aspect hints))))
+             :maxsize)
+        (let ((net-wm-window-type (xlib:get-property window :_NET_WM_WINDOW_TYPE)))
+          (when net-wm-window-type
+            (dolist (type-atom net-wm-window-type)
+              (when (assoc (xlib:atom-name *display* type-atom) +netwm-window-types+)
+                (return (cdr (assoc (xlib:atom-name *display* type-atom) +netwm-window-types+)))))))
+        (and (xlib:get-property window :WM_TRANSIENT_FOR)
+             :transient)
+        :normal)))