[clfswm-cvs] r162 - in clfswm: . doc src

pbrochard at common-lisp.net pbrochard at common-lisp.net
Fri Sep 12 21:12:12 UTC 2008


Author: pbrochard
Date: Fri Sep 12 17:12:11 2008
New Revision: 162

Modified:
   clfswm/ChangeLog
   clfswm/doc/menu.html
   clfswm/doc/menu.txt
   clfswm/src/clfswm-internal.lisp
   clfswm/src/clfswm-util.lisp
   clfswm/src/clfswm.lisp
   clfswm/src/menu-def.lisp
   clfswm/src/package.lisp
Log:
handle-enter-notify: sloppy-select mode. Select a child and its parents on mouse over. Add a menu entry to set a focus policy for all frames.

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Fri Sep 12 17:12:11 2008
@@ -1,3 +1,15 @@
+2008-09-12  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/menu-def.lisp: Add a menu to set a focus policy for all
+	frames.
+
+	* src/clfswm-util.lisp (set-focus-policy-generic-for-all)
+	(all-frames-set-*-focus-policy): Set a focus policy for all
+	frames.
+
+	* src/clfswm.lisp (handle-enter-notify): sloppy-select
+	mode. Select a child and its parents on mouse over.
+
 2008-09-03  Philippe Brochard  <pbrochard at common-lisp.net>
 
 	* src/clfswm.lisp (handle-enter-notify): Add a sloppy strict focus

Modified: clfswm/doc/menu.html
==============================================================================
--- clfswm/doc/menu.html	(original)
+++ clfswm/doc/menu.html	Fri Sep 12 17:12:11 2008
@@ -352,13 +352,34 @@
       <a name="FRAME-FOCUS-POLICY"></a><a href="#FRAME-MENU">Frame-Focus-Policy</a>
     </h3>
     <p>
-      c: Set a click focus policy for the current frame.
+      -=- For the current frame -=-
     </p>
     <p>
-      s: Set a sloppy focus policy for the current frame.
+      a: Set a click focus policy for the current frame.
     </p>
     <p>
-      t: Set a (strict) sloppy focus policy only for windows in the current frame.
+      b: Set a sloppy focus policy for the current frame.
+    </p>
+    <p>
+      c: Set a (strict) sloppy focus policy only for windows in the current frame.
+    </p>
+    <p>
+      d: Set a sloppy select policy for the current frame.
+    </p>
+    <p>
+      -=- For all frames -=-
+    </p>
+    <p>
+      e: Set a click focus policy for all frames.
+    </p>
+    <p>
+      f: Set a sloppy focus policy for all frames.
+    </p>
+    <p>
+      g: Set a (strict) sloppy focus policy for all frames.
+    </p>
+    <p>
+      h: Set a sloppy select policy for all frames.
     </p>
     <hr>
     <h3>

Modified: clfswm/doc/menu.txt
==============================================================================
--- clfswm/doc/menu.txt	(original)
+++ clfswm/doc/menu.txt	Fri Sep 12 17:12:11 2008
@@ -124,9 +124,16 @@
 a: Resize down the current frame to its minimal size
 
 Frame-Focus-Policy
-c: Set a click focus policy for the current frame.
-s: Set a sloppy focus policy for the current frame.
-t: Set a (strict) sloppy focus policy only for windows in the current frame.
+-=- For the current frame -=-
+a: Set a click focus policy for the current frame.
+b: Set a sloppy focus policy for the current frame.
+c: Set a (strict) sloppy focus policy only for windows in the current frame.
+d: Set a sloppy select policy for the current frame.
+-=- For all frames -=-
+e: Set a click focus policy for all frames.
+f: Set a sloppy focus policy for all frames.
+g: Set a (strict) sloppy focus policy for all frames.
+h: Set a sloppy select policy for all frames.
 
 Frame-Managed-Window-Menu
 m: Change window types to be managed by a frame

Modified: clfswm/src/clfswm-internal.lisp
==============================================================================
--- clfswm/src/clfswm-internal.lisp	(original)
+++ clfswm/src/clfswm-internal.lisp	Fri Sep 12 17:12:11 2008
@@ -252,7 +252,7 @@
 				     :colormap (xlib:screen-default-colormap *screen*)
 				     :border-width 1
 				     :border (get-color "Red")
-				     :event-mask '(:exposure :button-press :button-release :pointer-motion)))
+				     :event-mask '(:exposure :button-press :button-release :pointer-motion :enter-window)))
 	 (gc (xlib:create-gcontext :drawable window
 				   :foreground (get-color "Green")
 				   :background (get-color "Black")
@@ -369,6 +369,22 @@
 
 
 
+;;; Current window utilities
+(defun get-current-window ()
+  (typecase *current-child*
+    (xlib:window  *current-child*)
+    (frame (frame-selected-child *current-child*))))
+
+(defmacro with-current-window (&body body)
+  "Bind 'window' to the current window"
+  `(let ((window (get-current-window)))
+      (when (xlib:window-p window)
+	, at body)))
+
+
+
+
+
 (defun display-frame-info (frame)
   (let ((dy (+ (xlib:max-char-ascent *default-font*) (xlib:max-char-descent *default-font*))))
     (with-slots (name number gc window child hidden-children) frame

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Fri Sep 12 17:12:11 2008
@@ -864,21 +864,6 @@
 
 
 
-;;; Current window utilities
-(defun get-current-window ()
-  (typecase *current-child*
-    (xlib:window  *current-child*)
-    (frame (frame-selected-child *current-child*))))
-
-(defmacro with-current-window (&body body)
-  "Bind 'window' to the current window"
-  `(let ((window (get-current-window)))
-      (when (xlib:window-p window)
-	, at body)))
-
-
-
-
 
 ;;; Force window functions
 (defun force-window-in-frame ()
@@ -1090,5 +1075,33 @@
 
 (defun current-frame-set-sloppy-strict-focus-policy ()
   "Set a (strict) sloppy focus policy only for windows in the current frame."
-    (set-focus-policy-generic :sloppy-strict))
+  (set-focus-policy-generic :sloppy-strict))
+
+(defun current-frame-set-sloppy-select-policy ()
+  "Set a sloppy select policy for the current frame."
+    (set-focus-policy-generic :sloppy-select))
+
+
+
+(defun set-focus-policy-generic-for-all (focus-policy)
+  (with-all-frames (*root-frame* frame)
+    (setf (frame-focus-policy frame) focus-policy))
+  (leave-second-mode))
+  
+
+(defun all-frames-set-click-focus-policy ()
+  "Set a click focus policy for all frames."
+  (set-focus-policy-generic-for-all :click))
+  
+(defun all-frames-set-sloppy-focus-policy ()
+  "Set a sloppy focus policy for all frames."
+  (set-focus-policy-generic-for-all :sloppy))
+
+(defun all-frames-set-sloppy-strict-focus-policy ()
+  "Set a (strict) sloppy focus policy for all frames."
+  (set-focus-policy-generic-for-all :sloppy-strict))
+
+(defun all-frames-set-sloppy-select-policy ()
+  "Set a sloppy select policy for all frames."
+    (set-focus-policy-generic-for-all :sloppy-select))
 

Modified: clfswm/src/clfswm.lisp
==============================================================================
--- clfswm/src/clfswm.lisp	(original)
+++ clfswm/src/clfswm.lisp	Fri Sep 12 17:12:11 2008
@@ -121,17 +121,24 @@
 
 (defun handle-enter-notify  (&rest event-slots &key window root-x root-y &allow-other-keys)
   (declare (ignore event-slots))
-  (case (if (frame-p *current-child*)
-	    (frame-focus-policy *current-child*)
-	    *default-focus-policy*)
-    (:sloppy (unless (and (> root-x (- (xlib:screen-width *screen*) 3))
-			  (> root-y (- (xlib:screen-height *screen*) 3)))
-	       (focus-window window)))
-    (:sloppy-strict (unless (and (> root-x (- (xlib:screen-width *screen*) 3))
-				 (> root-y (- (xlib:screen-height *screen*) 3)))
-		      (when (and (frame-p *current-child*)
+  (unless (and (> root-x (- (xlib:screen-width *screen*) 3))
+	       (> root-y (- (xlib:screen-height *screen*) 3)))
+    (case (if (frame-p *current-child*)
+	      (frame-focus-policy *current-child*)
+	      *default-focus-policy*)
+      (:sloppy (focus-window window))
+      (:sloppy-strict (when (and (frame-p *current-child*)
 				 (member window (frame-child *current-child*)))
-			(focus-window window))))))
+			(focus-window window)))
+      (:sloppy-select (let* ((child (find-child-under-mouse root-x root-y))
+			     (parent (find-parent-frame child)))
+			(unless (or (equal child *current-root*)
+				    (equal (typecase child
+				    	     (xlib:window parent)
+					     (t child))
+					   *current-child*))
+			    (focus-all-children child parent)
+			    (show-all-children)))))))
 
 
 

Modified: clfswm/src/menu-def.lisp
==============================================================================
--- clfswm/src/menu-def.lisp	(original)
+++ clfswm/src/menu-def.lisp	Fri Sep 12 17:12:11 2008
@@ -112,9 +112,18 @@
 (add-menu-key 'frame-resize-menu #\a 'current-frame-resize-all-dir-minimal)
 
 
-(add-menu-key 'frame-focus-policy "c" 'current-frame-set-click-focus-policy)
-(add-menu-key 'frame-focus-policy "s" 'current-frame-set-sloppy-focus-policy)
-(add-menu-key 'frame-focus-policy "t" 'current-frame-set-sloppy-strict-focus-policy)
+(add-menu-comment 'frame-focus-policy "-=- For the current frame -=-")
+(add-menu-key 'frame-focus-policy "a" 'current-frame-set-click-focus-policy)
+(add-menu-key 'frame-focus-policy "b" 'current-frame-set-sloppy-focus-policy)
+(add-menu-key 'frame-focus-policy "c" 'current-frame-set-sloppy-strict-focus-policy)
+(add-menu-key 'frame-focus-policy "d" 'current-frame-set-sloppy-select-policy)
+(add-menu-comment 'frame-focus-policy "-=- For all frames -=-")
+(add-menu-key 'frame-focus-policy "e" 'all-frames-set-click-focus-policy)
+(add-menu-key 'frame-focus-policy "f" 'all-frames-set-sloppy-focus-policy)
+(add-menu-key 'frame-focus-policy "g" 'all-frames-set-sloppy-strict-focus-policy)
+(add-menu-key 'frame-focus-policy "h" 'all-frames-set-sloppy-select-policy)
+
+
 
 
 (add-menu-key 'frame-managed-window-menu "m" 'current-frame-manage-window-type)

Modified: clfswm/src/package.lisp
==============================================================================
--- clfswm/src/package.lisp	(original)
+++ clfswm/src/package.lisp	Fri Sep 12 17:12:11 2008
@@ -85,7 +85,7 @@
 
 ;;; CONFIG - Default focus policy
 (defparameter *default-focus-policy* :click
-  "Config(): Default mouse focus policy. One of :click, :sloppy or :sloppy-strict.")
+  "Config(): Default mouse focus policy. One of :click, :sloppy, :sloppy-strict or :sloppy-select.")
 
 
 



More information about the clfswm-cvs mailing list