Remove unnecessary raise-window and the not needed any more null-size-* functions.
authorPhilippe Brochard <pbrochard@common-lisp.net>
Sat, 22 Dec 2012 21:57:12 +0000 (22 22:57 +0100)
committerPhilippe Brochard <pbrochard@common-lisp.net>
Sat, 22 Dec 2012 21:57:12 +0000 (22 22:57 +0100)
src/clfswm-internal.lisp
src/clfswm.lisp
src/xlib-util.lisp

index d529b3d..e0be9f6 100644 (file)
 
 
 
-(defun null-size-window-in-frame (frame)
-  (let ((null-size-window-p nil))
-    (with-all-windows (frame window)
-      (when (null-size-window-p window)
-        (setf null-size-window-p t)))
-    null-size-window-p))
-
-
-
 (defun create-frame-window ()
   (let ((win (xlib:create-window :parent *root*
                                  :x 0
@@ -1079,8 +1070,7 @@ XINERAMA version 1.1 opcode: 150
   (lower-window window (frame-window child)))
 
 (defmethod set-child-stack-order (window child)
-  (declare (ignore child))
-  (raise-window window))
+  (declare (ignore window child)))
 
 
 
@@ -1195,10 +1185,10 @@ XINERAMA version 1.1 opcode: 150
                        (/= (x-drawable-width window) (child-rect-w rect))
                        (/= (x-drawable-height window) (child-rect-h rect)))))
         (when change
-          (setf (x-drawable-x window) (child-rect-x rect)
-                (x-drawable-y window) (child-rect-y rect)
-                (x-drawable-width window) (child-rect-w rect)
-                (x-drawable-height window) (child-rect-h rect)))
+          (setf (x-drawable-width window) (child-rect-w rect)
+                (x-drawable-height window) (child-rect-h rect)
+                (x-drawable-x window) (child-rect-x rect)
+                (x-drawable-y window) (child-rect-y rect)))
        change))))
 
 
index 826f0fc..730d5d8 100644 (file)
           (when (has-stackmode value-mask)
             (case stack-mode
               (:above
-               (unless (null-size-window-p window)
-                 (when (or (child-equal-p window (current-child))
-                           (is-in-current-child-p window))
-                   (setf change (or change :moved))
-                   (show-all-children)
-                   (raise-window window)
-                   (focus-window window)
-                   (focus-all-children window (find-parent-frame window (find-current-root)))))))))
+               (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))))))))
         (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.
       (unhide-window window)
       (process-new-window window)
       (map-window window)
-      (unless (null-size-window-p window)
-        (multiple-value-bind (never-managed raise)
-            (never-managed-window-p window)
-          (unless (and never-managed raise)
-            (show-all-children)))))))
+      (multiple-value-bind (never-managed raise)
+          (never-managed-window-p window)
+        (unless (and never-managed raise)
+          (show-all-children))))))
 
 
 
       (setf (window-state window) +withdrawn-state+)
       (xlib:unmap-window window)
       (remove-child-in-all-frames window)
-      (unless (null-size-window-in-frame *root-frame*)
-        (show-all-children)))))
-
-
-
+      (show-all-children))))
 
 
 (define-handler main-mode :destroy-notify (send-event-p event-window window)
              (xlib:window-equal window event-window))
     (when (find-child window *root-frame*)
       (delete-child-in-all-frames window)
-      (unless (null-size-window-in-frame *root-frame*)
-        (show-all-children))
+      (show-all-children)
       (xlib:destroy-window window))))
 
+
 (define-handler main-mode :enter-notify  (window root-x root-y)
   (unless (and (> root-x (- (xlib:screen-width *screen*) 3))
               (> root-y (- (xlib:screen-height *screen*) 3)))
 
 (define-handler main-mode :configure-notify (window)
   (when (child-equal-p window *root*)
-    (unless (null-size-window-in-frame *root-frame*)
-      (unless (eql (place-frames-from-xinerama-infos) :update)
-        (finish-configuring-root))
-      (show-all-children)
-      (call-hook *root-size-change-hook*))))
+    (unless (eql (place-frames-from-xinerama-infos) :update)
+      (finish-configuring-root))
+    (show-all-children)
+    (call-hook *root-size-change-hook*)))
 
 
 (defun error-handler (display error-key &rest key-vals &key asynchronous &allow-other-keys)
index e72438d..dcb552f 100644 (file)
@@ -349,17 +349,6 @@ they should be windows. So use this function to make a window out of them."
   (eql (window-state window) +iconic-state+))
 
 
-(defun null-size-window-p (window)
-  (let ((hints (xlib:wm-normal-hints window)))
-    (and hints
-        (not (or (xlib:wm-size-hints-width hints)
-                 (xlib:wm-size-hints-height hints)
-                 (xlib:wm-size-hints-win-gravity hints)))
-        (xlib:wm-size-hints-user-specified-position-p hints))))
-
-
-
-
 
 
 (defun unhide-window (window)
@@ -533,8 +522,14 @@ they should be windows. So use this function to make a window out of them."
       (unhide-window window))
     (setf (xlib:window-priority window) :above)))
 
+
+(defun no-focus ()
+  "don't focus any window but still read keyboard events."
+  (xlib:set-input-focus *display* *no-focus-window* :pointer-root))
+
 (defun focus-window (window)
   "Give the window focus."
+  (no-focus)
   (when (xlib:window-p window)
     (xlib:set-input-focus *display* window :parent)))
 
@@ -543,10 +538,6 @@ they should be windows. So use this function to make a window out of them."
   (raise-window window)
   (focus-window window))
 
-(defun no-focus ()
-  "don't focus any window but still read keyboard events."
-  (xlib:set-input-focus *display* *no-focus-window* :pointer-root))
-
 
 (defun lower-window (window sibling)
   "Map the window if needed and bring it just above sibling. Does not affect focus."