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

pbrochard at common-lisp.net pbrochard at common-lisp.net
Sun Apr 27 21:43:59 UTC 2008


Author: pbrochard
Date: Sun Apr 27 17:43:59 2008
New Revision: 99

Modified:
   clfswm/ChangeLog
   clfswm/src/xlib-util.lisp
Log:
resize-window: Take care of window size hints.

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Sun Apr 27 17:43:59 2008
@@ -1,5 +1,8 @@
 2008-04-27  Philippe Brochard  <pbrochard at common-lisp.net>
 
+	* src/xlib-util.lisp (resize-window): Take care of window size
+	hints.
+
 	* src/clfswm-util.lisp (mouse-focus-move/resize-generic): Allow to
 	move/resize unmanaged windows.
 

Modified: clfswm/src/xlib-util.lisp
==============================================================================
--- clfswm/src/xlib-util.lisp	(original)
+++ clfswm/src/xlib-util.lisp	Sun Apr 27 17:43:59 2008
@@ -487,16 +487,21 @@
 
 (defun resize-window (window orig-x orig-y &optional additional-fn additional-arg)
   (raise-window window)
-  (let ((done nil)
-	(dx (- (xlib:drawable-x window) orig-x))
-	(dy (- (xlib:drawable-y window) orig-y))
-	(lx orig-x)
-	(ly orig-y)
-	(pointer-grabbed-p (xgrab-pointer-p)))
+  (let* ((done nil)
+	 (dx (- (xlib:drawable-x window) orig-x))
+	 (dy (- (xlib:drawable-y window) orig-y))
+	 (lx orig-x)
+	 (ly orig-y)
+	 (pointer-grabbed-p (xgrab-pointer-p))
+	 (hints (xlib:wm-normal-hints window))
+	 (min-width (or (and hints (xlib:wm-size-hints-min-width hints)) 0))
+	 (min-height (or (and hints (xlib:wm-size-hints-min-height hints)) 0))
+	 (max-width (or (and hints (xlib:wm-size-hints-max-width hints)) most-positive-fixnum))
+	 (max-height (or (and hints (xlib:wm-size-hints-max-height hints)) most-positive-fixnum)))
     (labels ((motion-notify (&rest event-slots &key root-x root-y &allow-other-keys)
 	       (declare (ignore event-slots))
-	       (setf (xlib:drawable-width window) (max (+ (xlib:drawable-width window) (- root-x lx)) 10)
-		     (xlib:drawable-height window) (max (+ (xlib:drawable-height window) (- root-y ly)) 10)
+	       (setf (xlib:drawable-width window) (min (max (+ (xlib:drawable-width window) (- root-x lx)) 10 min-width) max-width)
+		     (xlib:drawable-height window) (min (max (+ (xlib:drawable-height window) (- root-y ly)) 10 min-height) max-height)
 		     dx (- dx (- root-x lx))
 		     dy (- dy (- root-y ly))
 		     lx root-x ly root-y)



More information about the clfswm-cvs mailing list