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

pbrochard at common-lisp.net pbrochard at common-lisp.net
Mon Sep 22 20:02:44 UTC 2008


Author: pbrochard
Date: Mon Sep 22 16:02:42 2008
New Revision: 168

Modified:
   clfswm/ChangeLog
   clfswm/TODO
   clfswm/src/clfswm-nw-hooks.lisp
   clfswm/src/clfswm-query.lisp
   clfswm/src/clfswm-util.lisp
Log:
named-frame-nw-hook/numbered-frame-nw-hook: open the next window in a named/numbered frame.

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Mon Sep 22 16:02:42 2008
@@ -1,5 +1,13 @@
 2008-09-22  Philippe Brochard  <pbrochard at common-lisp.net>
 
+	* src/clfswm-nw-hooks.lisp (named-frame-nw-hook): New new window
+	hook: open the next window in a named frame.
+	(numbered-frame-nw-hook): New new window hook: open the next
+	window in a numbered frame.
+
+	* src/clfswm-query.lisp (query-string): Grab the keyboard in all
+	cases. So query-string can be called even in the main mode.
+
 	* src/clfswm-internal.lisp (show-all-children): Do not raise a
 	child by default => far less flickering.
 

Modified: clfswm/TODO
==============================================================================
--- clfswm/TODO	(original)
+++ clfswm/TODO	Mon Sep 22 16:02:42 2008
@@ -7,10 +7,12 @@
 ===============
 Should handle these soon.
 
-- Hook to open next window in named/numbered frame [Philippe]
-
 - Ensure-unique-number/name (new function) [Philippe]
 
+
+MAYBE
+=====
+
 - Show config -> list and display documentation for all tweakable global variables. [Philippe]
    TODO :
    In ~/.clfswmrc:
@@ -20,9 +22,6 @@
       ;;;; AUTO-CONFIG End : You can add your configurations below this line.
 
 
-MAYBE
-=====
-
 - cd/pwd a la shell to navigate throw frames. [Philippe]
 
 - Zoom

Modified: clfswm/src/clfswm-nw-hooks.lisp
==============================================================================
--- clfswm/src/clfswm-nw-hooks.lisp	(original)
+++ clfswm/src/clfswm-nw-hooks.lisp	Mon Sep 22 16:02:42 2008
@@ -185,3 +185,45 @@
   (set-nw-hook #'leave-focus-frame-nw-hook))
 
 (register-nw-hook 'set-leave-focus-frame-nw-hook)
+
+
+
+
+
+(defun nw-hook-open-in-frame (window frame)
+  (when (frame-p frame)
+    (pushnew window (frame-child frame))
+    (unless (find-child frame *current-root*)
+      (hide-all *current-root*)
+      (setf *current-root* frame))
+    (setf *current-child* frame)
+    (focus-all-children window frame)
+    (default-window-placement frame window)
+    (show-all-children *current-root*)))
+
+;;; Open a new window in a named frame
+(defun named-frame-nw-hook (frame window)
+  (clear-nw-hook frame)
+  (let* ((frame-name (ask-frame-name "Open the next window in frame named:"))
+	 (new-frame (find-frame-by-name frame-name)))
+    (nw-hook-open-in-frame window new-frame)))
+
+(defun set-named-frame-nw-hook ()
+  "Open the next window in a named frame"
+  (set-nw-hook #'named-frame-nw-hook))
+
+(register-nw-hook 'set-named-frame-nw-hook)
+
+
+;;; Open a new window in a numbered frame
+(defun numbered-frame-nw-hook (frame window)
+  (clear-nw-hook frame)
+  (let ((new-frame (find-frame-by-number (query-number "Open a new frame in the group numbered:"))))
+    (nw-hook-open-in-frame window new-frame)))
+
+(defun set-numbered-frame-nw-hook ()
+  "Open the next window in a numbered frame"
+  (set-nw-hook #'numbered-frame-nw-hook))
+
+(register-nw-hook 'set-numbered-frame-nw-hook)
+

Modified: clfswm/src/clfswm-query.lisp
==============================================================================
--- clfswm/src/clfswm-query.lisp	(original)
+++ clfswm/src/clfswm-query.lisp	Mon Sep 22 16:02:42 2008
@@ -80,7 +80,9 @@
 				     :line-style :solid))
 	   (result-string default)
 	   (pos (length default))
-	   (local-history history))
+	   (local-history history)
+	   (grab-keyboard-p (xgrab-keyboard-p))
+	   (grab-pointer-p (xgrab-pointer-p)))
       (labels ((add-cursor (string)
 		 (concatenate 'string (subseq string 0 pos) "|" (subseq string pos)))
 	       (print-string ()
@@ -168,6 +170,9 @@
 		   (:exposure (print-string)))
 		 t))
 	(xgrab-pointer *root* 92 93)
+	(unless grab-keyboard-p
+	  (ungrab-main-keys)
+	  (xgrab-keyboard *root*))
 	(xlib:map-window window)
 	(print-string)
 	(wait-no-key-or-button-press)
@@ -177,7 +182,11 @@
 		  (xlib:process-event *display* :handler #'handle-query))
 	  (xlib:destroy-window window)
 	  (xlib:close-font font)
-	  (xgrab-pointer *root* 66 67)))
+	  (xungrab-keyboard)
+	  (grab-main-keys)
+	  (if grab-pointer-p
+	      (xgrab-pointer *root* 66 67)
+	      (xungrab-pointer))))
       (values (when (member done '(:Return :Complet))
 		(push result-string history)
 		result-string)

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Mon Sep 22 16:02:42 2008
@@ -321,9 +321,6 @@
 
 
 ;;; Frame name actions
-;;;(loop :for str :in '("The Gimp" "The klm" "klm" "abc")  ;; Test
-;;;   :when (zerop (or (search "ThE" str :test #'string-equal) -1))
-;;;   :collect str)
 (defun ask-frame-name (msg)
   "Ask a frame name"
   (let ((all-frame-name nil)



More information about the clfswm-cvs mailing list