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

pbrochard at common-lisp.net pbrochard at common-lisp.net
Sat May 3 21:38:43 UTC 2008


Author: pbrochard
Date: Sat May  3 17:38:42 2008
New Revision: 114

Modified:
   clfswm/ChangeLog
   clfswm/src/clfswm-internal.lisp
   clfswm/src/clfswm-util.lisp
Log:
 For different mouse actions: Ensure that the current child is a frame.

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Sat May  3 17:38:42 2008
@@ -1,5 +1,13 @@
 2008-05-03  Philippe Brochard  <pbrochard at common-lisp.net>
 
+	* src/clfswm-util.lisp
+	(mouse-click-to-focus-generic,mouse-focus-move/resize-generic):
+	Check if child is a frame.
+
+	* src/clfswm-internal.lisp (managed-window-p): Handle the case
+	where frame is null.
+	(place-frame): Check if frame and parent are frames.
+
 	* src/clfswm-info.lisp (info-mode): display all frame info before
 	leaving.
 

Modified: clfswm/src/clfswm-internal.lisp
==============================================================================
--- clfswm/src/clfswm-internal.lisp	(original)
+++ clfswm/src/clfswm-internal.lisp	Sat May  3 17:38:42 2008
@@ -96,14 +96,16 @@
 
 (defun managed-window-p (window frame)
   "Return t only if window is managed by frame"
-  (with-slots ((managed forced-managed-window)
-	       (unmanaged forced-unmanaged-window)) frame
-    (and (not (member window unmanaged))
-	 (not (member (xlib:wm-name window) unmanaged :test #'string-equal-p))
-	 (or (member :all (frame-managed-type frame))
-	     (member (window-type window) (frame-managed-type frame))
-	     (member window managed)
-	     (member (xlib:wm-name window) managed :test #'string-equal-p)))))
+  (if (frame-p frame)
+      (with-slots ((managed forced-managed-window)
+		   (unmanaged forced-unmanaged-window)) frame
+	(and (not (member window unmanaged))
+	     (not (member (xlib:wm-name window) unmanaged :test #'string-equal-p))
+	     (or (member :all (frame-managed-type frame))
+		 (member (window-type window) (frame-managed-type frame))
+		 (member window managed)
+		 (member (xlib:wm-name window) managed :test #'string-equal-p))))
+      t))
 
 
 
@@ -238,15 +240,16 @@
 
 (defun place-frame (frame parent prx pry prw prh)
   "Place a frame from real (pixel) coordinates"
-  (with-slots (window x y w h) frame
-    (setf (xlib:drawable-x window) prx
-	  (xlib:drawable-y window) pry
-	  (xlib:drawable-width window) prw
-	  (xlib:drawable-height window) prh
-	  x (x-px->fl prx parent)
-	  y (y-px->fl pry parent)
-	  w (w-px->fl prw parent)
-	  h (h-px->fl prh parent))))
+  (when (and (frame-p frame) (frame-p parent))
+    (with-slots (window x y w h) frame
+      (setf (xlib:drawable-x window) prx
+	    (xlib:drawable-y window) pry
+	    (xlib:drawable-width window) prw
+	    (xlib:drawable-height window) prh
+	    x (x-px->fl prx parent)
+	    y (y-px->fl pry parent)
+	    w (w-px->fl prw parent)
+	    h (h-px->fl prh parent)))))
 
 (defun fixe-real-size (frame parent)
   "Fixe real (pixel) coordinates in float coordinates"

Modified: clfswm/src/clfswm-util.lisp
==============================================================================
--- clfswm/src/clfswm-util.lisp	(original)
+++ clfswm/src/clfswm-util.lisp	Sat May  3 17:38:42 2008
@@ -496,11 +496,12 @@
 (defun mouse-click-to-focus-generic (window root-x root-y mouse-fn)
   "Focus the current frame or focus the current window parent
 mouse-fun is #'move-frame or #'resize-frame"
-  (let ((to-replay t)
-	(child window)
-	(parent (find-parent-frame window *current-root*))
-	(root-p (or (equal window *root*)
-		    (equal window (frame-window *current-root*)))))
+  (let* ((to-replay t)
+	 (child window)
+	 (parent (find-parent-frame child *current-root*))
+	 (root-p (or (equal window *root*)
+		     (and (frame-p child)
+			  (equal child (frame-window *current-root*))))))
     (when (or (not root-p) *create-frame-on-root*)
       (unless parent
 	(if root-p
@@ -540,7 +541,8 @@
 For window: set current child to window or its parent according to window-parent"
   (let* ((child (find-child-under-mouse root-x root-y))
 	 (parent (find-parent-frame child)))
-    (when (equal child *current-root*)
+    (when (and (equal child *current-root*)
+	       (frame-p *current-root*))
       (setf child (create-frame)
 	    parent *current-root*
 	    mouse-fn #'resize-frame)



More information about the clfswm-cvs mailing list