From e1c7bb92ff3bf56c83544b36f4e424040563f63c Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Sat, 16 Feb 2013 23:23:12 +0100 Subject: [PATCH] Ensure window type for leader --- src/clfswm-circulate-mode.lisp | 4 ++-- src/clfswm.lisp | 4 ++-- src/xlib-util.lisp | 35 ++++++++++++++++++----------------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/clfswm-circulate-mode.lisp b/src/clfswm-circulate-mode.lisp index bc8ea8b..fd8ca93 100644 --- a/src/clfswm-circulate-mode.lisp +++ b/src/clfswm-circulate-mode.lisp @@ -177,10 +177,10 @@ (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) diff --git a/src/clfswm.lisp b/src/clfswm.lisp index 730d5d8..62cdf76 100644 --- a/src/clfswm.lisp +++ b/src/clfswm.lisp @@ -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. diff --git a/src/xlib-util.lisp b/src/xlib-util.lisp index 3fef7cf..8748db3 100644 --- a/src/xlib-util.lisp +++ b/src/xlib-util.lisp @@ -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))) -- 2.11.4.GIT