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

pbrochard at common-lisp.net pbrochard at common-lisp.net
Fri Apr 25 15:27:27 UTC 2008


Author: pbrochard
Date: Fri Apr 25 11:27:20 2008
New Revision: 84

Modified:
   clfswm/ChangeLog
   clfswm/TODO
   clfswm/src/bindings-second-mode.lisp
   clfswm/src/clfswm-internal.lisp
   clfswm/src/clfswm-nw-hooks.lisp
   clfswm/src/clfswm-util.lisp
   clfswm/src/config.lisp
   clfswm/src/package.lisp
   clfswm/src/tools.lisp
Log:
open-in-new-frame-in-parent-frame-nw-hook: New new window hook. adapt-current-frame-to-window-hints: New function. ensure-printable: Return always a string even with a null string.


Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Fri Apr 25 11:27:20 2008
@@ -1,3 +1,19 @@
+2008-04-25  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/clfswm-nw-hooks.lisp
+	(open-in-new-frame-in-parent-frame-nw-hook): New new window hook.
+
+	* src/clfswm-util.lisp (adapt-current-frame-to-window-hints): New
+	function.
+
+	* src/tools.lisp (ensure-printable): Return always a string even
+	with a null string.
+
+2008-04-24  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/config.lisp (*default-nw-hook*): New variable to change the
+	default new window hook.
+
 2008-04-22  Philippe Brochard  <pbrochard at common-lisp.net>
 
 	* clfswm.asd (clfswm): Add a dependency from

Modified: clfswm/TODO
==============================================================================
--- clfswm/TODO	(original)
+++ clfswm/TODO	Fri Apr 25 11:27:20 2008
@@ -9,22 +9,23 @@
 
 - Add a frame parameter to choose what window type to handle. [Philippe]
 
-- Hook to open next window in named/numbered frame [Philippe]
+- Move the autodoc in its own file (clfswm-autodoc.lisp) and make the autodoc
+  for the menu system.
 
-- Undo/redo (any idea to implement this is welcome)
+- Hook to open next window in named/numbered frame [Philippe]
 
 - Ensure-unique-number/name (new function) [Philippe]
 
 - Raise/lower frame - this can be done with children order [Philippe]
 
-- Adapt frame to window hints [Philippe]
-
 - Show config -> list and display documentation for all tweakable global variables. [Philippe]
 
 - A Gimp layout example [Philippe]
 
 - Add boundaries in the info window [Philippe]
 
+- Allow to move/resize transient windows [Philippe]
+
 
 MAYBE
 =====
@@ -54,3 +55,5 @@
 - cd/pwd a la shell to navigate throu frames. [Philippe] 
 
 - Hide/Unhide frame [Philippe]
+
+- Undo/redo (any idea to implement this is welcome)

Modified: clfswm/src/bindings-second-mode.lisp
==============================================================================
--- clfswm/src/bindings-second-mode.lisp	(original)
+++ clfswm/src/bindings-second-mode.lisp	Fri Apr 25 11:27:20 2008
@@ -133,6 +133,9 @@
 
 (add-menu-key 'window-menu "i" 'force-window-in-frame)
 (add-menu-key 'window-menu "c" 'force-window-center-in-frame)
+(add-menu-key 'window-menu "a" 'adapt-current-frame-to-window-hints)
+(add-menu-key 'window-menu "w" 'adapt-current-frame-to-window-width-hint)
+(add-menu-key 'window-menu "h" 'adapt-current-frame-to-window-height-hint)
 
 
 (add-menu-key 'selection-menu "x" 'cut-current-child)

Modified: clfswm/src/clfswm-internal.lisp
==============================================================================
--- clfswm/src/clfswm-internal.lisp	(original)
+++ clfswm/src/clfswm-internal.lisp	Fri Apr 25 11:27:20 2008
@@ -744,7 +744,7 @@
 						(t 1)))
     (grab-all-buttons window)
     (unless (do-all-frames-nw-hook window)
-      (default-frame-nw-hook nil window))
+      (call-hook *default-nw-hook* (list *root-frame* window)))
     (netwm-add-in-client-list window)))
 
 

Modified: clfswm/src/clfswm-nw-hooks.lisp
==============================================================================
--- clfswm/src/clfswm-nw-hooks.lisp	(original)
+++ clfswm/src/clfswm-nw-hooks.lisp	Fri Apr 25 11:27:20 2008
@@ -133,6 +133,28 @@
 (register-nw-hook 'set-open-in-new-frame-in-root-frame-nw-hook)
 
 
+;;; Open new window in a new frame in the parent frame hook
+(defun open-in-new-frame-in-parent-frame-nw-hook (frame window)
+  "Open the next window in a new frame in the parent frame"
+  (let ((new-frame (create-frame))
+	(parent (find-father-frame frame)))
+    (when parent
+      (pushnew new-frame (frame-child parent))
+      (pushnew window (frame-child new-frame))
+      (hide-all *current-root*)
+      (setf *current-root* parent)
+      (setf *current-child* new-frame)
+      (default-window-placement new-frame window)
+      (show-all-children *current-root*)))
+  (setf (frame-nw-hook frame) nil))
+
+(defun set-open-in-new-frame-in-parent-frame-nw-hook ()
+  "Open the next window in a new frame in the parent frame"
+  (set-nw-hook #'open-in-new-frame-in-parent-frame-nw-hook))
+
+(register-nw-hook 'set-open-in-new-frame-in-parent-frame-nw-hook)
+
+
 
 ;;; Open a new window but leave the focus on the current child
 (defun leave-focus-frame-nw-hook (frame window)

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Fri Apr 25 11:27:20 2008
@@ -40,6 +40,7 @@
   (let ((name (query-string (format nil "New child name: (last: ~A)" (child-name *current-child*))
 			    (child-name *current-child*))))
     (rename-child *current-child* name)
+    (display-frame-info *current-child*)
     (leave-second-mode)))
 
 
@@ -739,9 +740,9 @@
 
 
 
-
-;;; Useful function for the second mode
-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Useful function for the second mode ;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defmacro with-movement (&body body)
   `(when (frame-p *current-child*)
      , at body
@@ -837,3 +838,33 @@
 (defun current-frame-resize-all-dir-minimal ()
   "Resize down the current frame to its minimal size"
   (with-movement (resize-minimal-frame *current-child*)))
+
+
+
+;;; Adapt frame functions
+(defun adapt-current-frame-to-window-hints-generic (width-p height-p)
+  "Adapt the current frame to the current window minimal size hints"
+  (when (frame-p *current-child*)
+    (let ((window (first (frame-child *current-child*))))
+      (when (xlib:window-p window)
+	(let* ((hints (xlib:wm-normal-hints window))
+	       (min-width (and hints (xlib:wm-size-hints-min-width hints)))
+	       (min-height (and hints (xlib:wm-size-hints-min-height hints))))
+	  (when (and width-p min-width)
+	    (setf (frame-rw *current-child*) min-width))
+	  (when (and height-p min-height)
+	    (setf (frame-rh *current-child*) min-height))
+	  (fixe-real-size *current-child* (find-father-frame *current-child*))
+	  (leave-second-mode))))))
+
+(defun adapt-current-frame-to-window-hints ()
+  "Adapt the current frame to the current window minimal size hints"
+  (adapt-current-frame-to-window-hints-generic t t))
+
+(defun adapt-current-frame-to-window-width-hint ()
+  "Adapt the current frame to the current window minimal width hint"
+  (adapt-current-frame-to-window-hints-generic t nil))
+
+(defun adapt-current-frame-to-window-height-hint ()
+  "Adapt the current frame to the current window minimal height hint"
+  (adapt-current-frame-to-window-hints-generic nil t))

Modified: clfswm/src/config.lisp
==============================================================================
--- clfswm/src/config.lisp	(original)
+++ clfswm/src/config.lisp	Fri Apr 25 11:27:20 2008
@@ -47,10 +47,35 @@
 ;;  (values 100 100 800 600))
 
 
+;;; Hook definitions
+;;;
+;;; A hook is a function, a symbol or a list of functions with a rest
+;;; arguments.
+;;;
+;;; This hooks are set in clfswm.lisp, you can overwrite them or extend
+;;; them with a hook list.
+;;;
+;;; See clfswm.lisp for hooks examples.
+
+(defun default-init-hook ()
+  (let ((frame (add-frame (create-frame :name "Default"
+                                        :layout nil :x 0.05 :y 0.05
+                                        :w 0.9 :h 0.9) *root-frame*)))
+    (setf *current-child* frame)))
+
+(defparameter *init-hook* 'default-init-hook
+  "Init hook. This hook is run just after the first root frame is created")
+
+(defparameter *default-nw-hook* 'default-frame-nw-hook
+  "Default action to do on newly created windows")
+
+
+
+
 ;;; CONFIG
 (defparameter *create-frame-on-root* nil
   "Set this variable to true if you want to allow to create a new frame
-on root window in the main mode")
+on the root window in the main mode with the mouse")
 
 
 ;;; CONFIG: Main mode colors

Modified: clfswm/src/package.lisp
==============================================================================
--- clfswm/src/package.lisp	(original)
+++ clfswm/src/package.lisp	Fri Apr 25 11:27:20 2008
@@ -117,27 +117,6 @@
   "Arrow action in the second mode")
 
 
-
-;;; Hook definitions
-;;;
-;;; A hook is a function, a symbol or a list of functions with a rest
-;;; arguments.
-;;;
-;;; This hooks are set in clfswm.lisp, you can overwrite them or extend
-;;; them with a hook list.
-;;;
-;;; See clfswm.lisp for hooks examples.
-
-;;; Init hook. This hook is run just after the first root frame is created
-(defun default-init-hook ()
-  (let ((frame (add-frame (create-frame :name "Default"
-                                        :layout nil :x 0.05 :y 0.05
-                                        :w 0.9 :h 0.9) *root-frame*)))
-    (setf *current-child* frame)))
-
-(defparameter *init-hook* #'default-init-hook)
-
-
 ;;; Main mode hooks (set in clfswm.lisp)
 (defparameter *button-press-hook* nil)
 (defparameter *button-release-hook* nil)

Modified: clfswm/src/tools.lisp
==============================================================================
--- clfswm/src/tools.lisp	(original)
+++ clfswm/src/tools.lisp	Fri Apr 25 11:27:20 2008
@@ -198,7 +198,7 @@
 
 (defun ensure-printable (string &optional (new #\?))
   "Ensure a string is printable in ascii"
-  (substitute-if-not new #'standard-char-p string))
+  (or (substitute-if-not new #'standard-char-p (or string "")) ""))
 
 
 (defun ensure-n-elems (list n)



More information about the clfswm-cvs mailing list