[clfswm-cvs] r282 - in clfswm: . src

Philippe Brochard pbrochard at common-lisp.net
Wed Jul 21 13:06:42 UTC 2010


Author: pbrochard
Date: Wed Jul 21 09:06:42 2010
New Revision: 282

Log:
src/clfswm-internal.lisp (delete-child-and-children-in-all-frames): New function and binding: Second mode - Control+Delete delete the current child and its children in all frames (ie: close the current child and its children).

Modified:
   clfswm/ChangeLog
   clfswm/TODO
   clfswm/src/bindings-second-mode.lisp
   clfswm/src/clfswm-internal.lisp
   clfswm/src/clfswm-util.lisp
   clfswm/src/menu-def.lisp
   clfswm/src/package.lisp
   clfswm/src/xlib-util.lisp

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Wed Jul 21 09:06:42 2010
@@ -1,3 +1,11 @@
+2010-07-21  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/clfswm-internal.lisp
+	(delete-child-and-children-in-all-frames): New function and
+	binding: Second mode - Control+Delete delete the current child and
+	its children in all frames (ie: close the current child and its
+	children).
+
 2010-07-20  Philippe Brochard  <pbrochard at common-lisp.net>
 
 	* src/clfswm-internal.lisp (remove-child-in-frame): Do not destroy

Modified: clfswm/TODO
==============================================================================
--- clfswm/TODO	(original)
+++ clfswm/TODO	Wed Jul 21 09:06:42 2010
@@ -7,6 +7,8 @@
 ===============
 Should handle these soon.
 
+- Bind control+g to escape all actions like emacs.
+
 - Remote access to the clfswm REPL [Philippe]
    this can be done with net.lisp or via xprop (ie the Stumpwm way).
    Protocol:

Modified: clfswm/src/bindings-second-mode.lisp
==============================================================================
--- clfswm/src/bindings-second-mode.lisp	(original)
+++ clfswm/src/bindings-second-mode.lisp	Wed Jul 21 09:06:42 2010
@@ -127,6 +127,7 @@
   (define-second-key ("v" :control) 'paste-selection)
   (define-second-key ("v" :control :shift) 'paste-selection-no-clear)
   (define-second-key ("Delete") 'remove-current-child)
+  (define-second-key ("Delete" :control) 'delete-current-child)
   (define-shell (#\c) b-start-xterm "start an xterm" "exec xterm")
   (define-shell (#\e) b-start-emacs "start emacs" "exec emacs")
   (define-shell (#\e :control) b-start-emacsremote

Modified: clfswm/src/clfswm-internal.lisp
==============================================================================
--- clfswm/src/clfswm-internal.lisp	(original)
+++ clfswm/src/clfswm-internal.lisp	Wed Jul 21 09:06:42 2010
@@ -853,6 +853,23 @@
   (delete-child-in-frames child *root-frame*))
 
 
+(defun delete-child-and-children-in-frames (child root &optional (close-methode 'delete-window))
+  "Delete child and its children in the frame root and in all its children
+Warning:frame window and gc are freeed."
+  (when (and (frame-p child) (frame-child child))
+    (dolist (ch (frame-child child))
+      (delete-child-and-children-in-frames ch root close-methode)))
+  (delete-child-in-frames child root)
+  (when (xlib:window-p child)
+    (funcall close-methode child)))
+
+(defun delete-child-and-children-in-all-frames (child &optional (close-methode 'delete-window))
+  "Delete child and its children in all frames from *root-frame*"
+  (when (equal child *current-root*)
+    (setf *current-root* (find-parent-frame child)))
+  (when (equal child *current-child*)
+    (setf *current-child* *current-root*))
+  (delete-child-and-children-in-frames child *root-frame* close-methode))
 
 
 

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Wed Jul 21 09:06:42 2010
@@ -105,30 +105,22 @@
 
 
 
-(defun delete-focus-window ()
-  "Close focus window: Delete the focus window in all frames and workspaces"
+(defun delete-focus-window-generic (close-fun)
   (let ((window (xlib:input-focus *display*)))
     (when (and window (not (xlib:window-equal window *no-focus-window*)))
       (when (equal window *current-child*)
 	(setf *current-child* *current-root*))
       (hide-child window)
-      (remove-child-in-frame window (find-parent-frame window))
-      (send-client-message window :WM_PROTOCOLS
-			   (xlib:intern-atom *display* "WM_DELETE_WINDOW"))
-      (xlib:display-finish-output *display*)
+      (delete-child-and-children-in-all-frames window)
       (show-all-children))))
 
+(defun delete-focus-window ()
+  "Close focus window: Delete the focus window in all frames and workspaces"
+  (delete-focus-window-generic 'delete-window))
+
 (defun destroy-focus-window ()
   "Kill focus window: Destroy the focus window in all frames and workspaces"
-  (let ((window (xlib:input-focus *display*)))
-    (when (and window (not (xlib:window-equal window *no-focus-window*)))
-      (when (equal window *current-child*)
-	(setf *current-child* *current-root*))
-      (hide-child window)
-      (remove-child-in-frame window (find-parent-frame window))
-      (xlib:kill-client *display* (xlib:window-id window))
-      (xlib:display-finish-output *display*)
-      (show-all-children))))
+  (delete-focus-window-generic 'destroy-window))
 
 (defun remove-focus-window ()
   "Remove the focus window from the current frame"
@@ -213,15 +205,13 @@
   (setf *current-child* *current-root*)
   (leave-second-mode))
 
-
-(defun remove-current-child-from-tree ()
-  "Remove the current child from the CLFSWM tree"
-  (remove-child-in-frame *current-child* (find-parent-frame *current-child* *current-root*))
-  (setf *current-child* *current-root*)
+(defun delete-current-child ()
+  "Delete the current child and its children"
+  (hide-all *current-child*)
+  (delete-child-and-children-in-all-frames *current-child*)
   (leave-second-mode))
 
 
-
 (defun paste-selection-no-clear ()
   "Paste the selection in the current frame - Do not clear the selection after paste"
   (let ((frame-dest (typecase *current-child*

Modified: clfswm/src/menu-def.lisp
==============================================================================
--- clfswm/src/menu-def.lisp	(original)
+++ clfswm/src/menu-def.lisp	Wed Jul 21 09:06:42 2010
@@ -78,8 +78,8 @@
 (add-menu-key 'child-menu "r" 'rename-current-child)
 (add-menu-key 'child-menu "e" 'ensure-unique-name)
 (add-menu-key 'child-menu "n" 'ensure-unique-number)
-(add-menu-key 'child-menu "x" 'remove-current-child-from-tree)
 (add-menu-key 'child-menu "Delete" 'remove-current-child)
+(add-menu-key 'child-menu "X" 'delete-current-child)
 (add-menu-key 'child-menu "h" 'hide-current-child)
 (add-menu-key 'child-menu "u" 'unhide-a-child)
 (add-menu-key 'child-menu "f" 'unhide-a-child-from-all-frames)

Modified: clfswm/src/package.lisp
==============================================================================
--- clfswm/src/package.lisp	(original)
+++ clfswm/src/package.lisp	Wed Jul 21 09:06:42 2010
@@ -262,11 +262,11 @@
 ;;; middle-left  middle-middle  middle-right
 ;;; bottom-left  bottom-middle  bottom-right
 ;;;
-(defparameter *banish-pointer-placement* 'bottom-right-child-placement)
-(defparameter *second-mode-placement* 'top-middle-child-placement)
-(defparameter *info-mode-placement* 'top-left-child-placement)
-(defparameter *query-mode-placement* 'top-left-child-placement)
-(defparameter *circulate-mode-placement* 'bottom-middle-child-placement)
+(defparameter *banish-pointer-placement* 'bottom-right-placement)
+(defparameter *second-mode-placement* 'top-middle-placement)
+(defparameter *info-mode-placement* 'top-left-placement)
+(defparameter *query-mode-placement* 'top-left-placement)
+(defparameter *circulate-mode-placement* 'bottom-middle-placement)
 
 
 

Modified: clfswm/src/xlib-util.lisp
==============================================================================
--- clfswm/src/xlib-util.lisp	(original)
+++ clfswm/src/xlib-util.lisp	Wed Jul 21 09:06:42 2010
@@ -143,11 +143,14 @@
       (xlib:map-window window)
       (xlib:display-finish-output *display*))))
 
+(defun delete-window (window)
+  (send-client-message window :WM_PROTOCOLS
+		       (xlib:intern-atom *display* "WM_DELETE_WINDOW"))
+  (xlib:display-finish-output *display*))
 
-
-
-
-
+(defun destroy-window (window)
+  (xlib:kill-client *display* (xlib:window-id window))
+  (xlib:display-finish-output *display*))
 
 
 




More information about the clfswm-cvs mailing list