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

pbrochard at common-lisp.net pbrochard at common-lisp.net
Tue Apr 1 20:14:55 UTC 2008


Author: pbrochard
Date: Tue Apr  1 15:14:53 2008
New Revision: 64

Modified:
   clfswm/ChangeLog
   clfswm/TODO
   clfswm/src/bindings-second-mode.lisp
   clfswm/src/bindings.lisp
   clfswm/src/clfswm-util.lisp
Log:
Bind Alt+mouse-1/3 to move or resize a frame or the window's father.


Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Tue Apr  1 15:14:53 2008
@@ -1,7 +1,12 @@
-2008-04-01  Philippe Brochard  <hocwp at free.fr>
+2008-04-01  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/bindings.lisp: Bind Alt+mouse-1/3 to move or resize a frame
+	or the window's father.
 
 	* src/clfswm-util.lisp (mouse-click-to-focus-generic): Stop button
 	event only if there is a geometry change.
+	(mouse-focus-move/resize-generic): Generic function to move or
+	resize a frame or a window father frame.
 
 2008-04-01  Philippe Brochard  <pbrochard at common-lisp.net>
 

Modified: clfswm/TODO
==============================================================================
--- clfswm/TODO	(original)
+++ clfswm/TODO	Tue Apr  1 15:14:53 2008
@@ -40,8 +40,6 @@
   and redisplay only the wanted child).
   Split computation of geometry outside of show-all-children. [Philippe]
 
-- Bind Control+Alt+Mouse 1/2 to move and resize father frame in main mode [Philippe]
-  
 
 
 MAYBE

Modified: clfswm/src/bindings-second-mode.lisp
==============================================================================
--- clfswm/src/bindings-second-mode.lisp	(original)
+++ clfswm/src/bindings-second-mode.lisp	Tue Apr  1 15:14:53 2008
@@ -359,30 +359,15 @@
 
 
 ;;; Mouse action
-(defun sm-mouse-click-to-focus-generic (window root-x root-y mouse-fn)
-  (declare (ignore window))
-  (let* ((child (find-child-under-mouse root-x root-y))
-	 (father (find-father-frame child)))
-    (when (equal child *current-root*)
-      (setf child (create-frame)
-	    father *current-root*
-	    mouse-fn #'resize-frame)
-      (place-frame child father root-x root-y 10 10)
-	    (xlib:map-window (frame-window child))
-	    (pushnew child (frame-child *current-root*)))
-    (typecase child
-      (xlib:window (funcall mouse-fn father (find-father-frame father) root-x root-y))
-      (frame (funcall mouse-fn child father root-x root-y)))
-    (focus-all-children child father nil)
-    (show-all-children)))
-
 (defun sm-mouse-click-to-focus-and-move (window root-x root-y)
   "Move and focus the current child - Create a new frame on the root window"
-  (sm-mouse-click-to-focus-generic window root-x root-y #'move-frame))
+  (declare (ignore window))
+  (mouse-focus-move/resize-generic root-x root-y #'move-frame nil))
 
 (defun sm-mouse-click-to-focus-and-resize (window root-x root-y)
   "Resize and focus the current child - Create a new frame on the root window"
-  (sm-mouse-click-to-focus-generic window root-x root-y #'resize-frame))
+  (declare (ignore window))
+  (mouse-focus-move/resize-generic root-x root-y #'resize-frame nil))
 
 
 

Modified: clfswm/src/bindings.lisp
==============================================================================
--- clfswm/src/bindings.lisp	(original)
+++ clfswm/src/bindings.lisp	Tue Apr  1 15:14:53 2008
@@ -79,9 +79,25 @@
 
 
 ;;; Mouse actions
+(defun mouse-click-to-focus-and-move-window (window root-x root-y)
+  "Move and focus the current child - Create a new frame on the root window"
+  (declare (ignore window))
+  (mouse-focus-move/resize-generic root-x root-y #'move-frame t))
+
+(defun mouse-click-to-focus-and-resize-window (window root-x root-y)
+  "Resize and focus the current child - Create a new frame on the root window"
+  (declare (ignore window))
+  (mouse-focus-move/resize-generic root-x root-y #'resize-frame t))
+
+
+
+
 (define-main-mouse (1) 'mouse-click-to-focus-and-move)
 (define-main-mouse (3) 'mouse-click-to-focus-and-resize)
 
+(define-main-mouse (1 :mod-1) 'mouse-click-to-focus-and-move-window)
+(define-main-mouse (3 :mod-1) 'mouse-click-to-focus-and-resize-window)
+
 (define-main-mouse (4) 'mouse-select-next-level)
 (define-main-mouse (5) 'mouse-select-previous-level)
 

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Tue Apr  1 15:14:53 2008
@@ -589,6 +589,30 @@
 
 
 
+
+(defun mouse-focus-move/resize-generic (root-x root-y mouse-fn window-father)
+  "Focus the current frame or focus the current window father
+mouse-fun is #'move-frame or #'resize-frame.
+Focus child and its fathers -
+For window: set current child to window or its father according to window-father"
+  (let* ((child (find-child-under-mouse root-x root-y))
+	 (father (find-father-frame child)))
+    (when (equal child *current-root*)
+      (setf child (create-frame)
+	    father *current-root*
+	    mouse-fn #'resize-frame)
+      (place-frame child father root-x root-y 10 10)
+	    (xlib:map-window (frame-window child))
+	    (pushnew child (frame-child *current-root*)))
+    (typecase child
+      (xlib:window (funcall mouse-fn father (find-father-frame father) root-x root-y))
+      (frame (funcall mouse-fn child father root-x root-y)))
+    (focus-all-children child father window-father)
+    (show-all-children)))
+
+
+
+
 (defun test-mouse-binding (window root-x root-y)
   (dbg window root-x root-y)
   (replay-button-event))



More information about the clfswm-cvs mailing list