From 1ebf6e9d43fc995dfc0392c5dd91d4c23335c717 Mon Sep 17 00:00:00 2001 From: Philippe Brochard Date: Sat, 22 Dec 2012 22:57:12 +0100 Subject: [PATCH] Remove unnecessary raise-window and the not needed any more null-size-* functions. --- src/clfswm-internal.lisp | 20 +++++--------------- src/clfswm.lisp | 42 +++++++++++++++++------------------------- src/xlib-util.lisp | 21 ++++++--------------- 3 files changed, 28 insertions(+), 55 deletions(-) diff --git a/src/clfswm-internal.lisp b/src/clfswm-internal.lisp index d529b3d..e0be9f6 100644 --- a/src/clfswm-internal.lisp +++ b/src/clfswm-internal.lisp @@ -490,15 +490,6 @@ -(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)))) diff --git a/src/clfswm.lisp b/src/clfswm.lisp index 826f0fc..730d5d8 100644 --- a/src/clfswm.lisp +++ b/src/clfswm.lisp @@ -76,14 +76,12 @@ (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. @@ -98,11 +96,10 @@ (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)))))) @@ -113,11 +110,7 @@ (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) @@ -125,10 +118,10 @@ (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))) @@ -156,11 +149,10 @@ (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) diff --git a/src/xlib-util.lisp b/src/xlib-util.lisp index e72438d..dcb552f 100644 --- a/src/xlib-util.lisp +++ b/src/xlib-util.lisp @@ -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." -- 2.11.4.GIT