[clfswm-cvs] [clfswm-git]CLFSWM - A(nother) Common Lisp FullScreen Window Manager branch fix-type-error created. R-1106-10-g1990938

Philippe Brochard pbrochard at common-lisp.net
Thu Dec 22 21:34:24 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CLFSWM - A(nother) Common Lisp FullScreen Window Manager".

The branch, fix-type-error has been created
        at  1990938dd3f3e2c2574609341ce5d912adebbbe1 (commit)

- Log -----------------------------------------------------------------
commit 1990938dd3f3e2c2574609341ce5d912adebbbe1
Author: Philippe Brochard <pbrochard at common-lisp.net>
Date:   Thu Dec 22 22:32:46 2011 +0100

    src/xlib-util.lisp: add an xlib:drawable-* wrapper to prevent	and debug xlib type errors in some CLX versions.

diff --git a/ChangeLog b/ChangeLog
index 4ea4b32..f39750b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-22  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/xlib-util.lisp: add an xlib:drawable-* wrapper to prevent
+	and debug xlib type errors in some CLX versions.
+
 2011-12-14  Philippe Brochard  <pbrochard at common-lisp.net>
 
 	* src/clfswm-util.lisp (um-create-xdg-section-list): Add at least
diff --git a/src/clfswm-expose-mode.lisp b/src/clfswm-expose-mode.lisp
index 33c3e8f..5039b2d 100644
--- a/src/clfswm-expose-mode.lisp
+++ b/src/clfswm-expose-mode.lisp
@@ -89,7 +89,7 @@
 			 ,(format nil "Select child '~A' (~A)" (number->string n) n)
 			 (let ((child (nth ,n *expose-windows-list*)))
 			   (when child
-			     (xlib:warp-pointer *root* (xlib:drawable-x (first child)) (xlib:drawable-y (first child)))
+			     (xlib:warp-pointer *root* (x-drawable-x (first child)) (x-drawable-y (first child)))
 			     (setf *expose-selected-child* (fourth child))
 			     (when *expose-valid-on-key*
 			       (valid-expose-mode)))))
diff --git a/src/clfswm-info.lisp b/src/clfswm-info.lisp
index 438e4b3..0d0b36b 100644
--- a/src/clfswm-info.lisp
+++ b/src/clfswm-info.lisp
@@ -51,10 +51,10 @@
 
 
 (defun find-info-item-from-mouse (root-x root-y info)
-  (if (< (xlib:drawable-x (info-window info)) root-x
-	 (+ (xlib:drawable-x (info-window info))
-	    (xlib:drawable-width (info-window info))))
-      (truncate (/ (- (+ (- root-y (xlib:drawable-y (info-window info)))
+  (if (< (x-drawable-x (info-window info)) root-x
+	 (+ (x-drawable-x (info-window info))
+	    (x-drawable-width (info-window info))))
+      (truncate (/ (- (+ (- root-y (x-drawable-y (info-window info)))
 			 (xlib:max-char-ascent (info-font info))
 			 (info-y info)) (info-ilh info)) (info-ilh info)))
       nil))
@@ -135,8 +135,8 @@
 	"Move one line down"
 	(incf-info-selected-item info 1)
 	(when (> (info-y-display-coords info *info-selected-item*)
-		 (+ (xlib:drawable-y (info-window info))
-		    (xlib:drawable-height (info-window info))))
+		 (+ (x-drawable-y (info-window info))
+		    (x-drawable-height (info-window info))))
 	  (setf (info-y info) (min (+ (info-y info) (info-ilh info)) (info-max-y info))))
 	(draw-info-window info)))
   (define-info-key ("Up")
@@ -144,7 +144,7 @@
 	"Move one line up"
 	(decf-info-selected-item info 1)
 	(when (< (info-y-display-coords info *info-selected-item*)
-		 (+ (xlib:drawable-y (info-window info))
+		 (+ (x-drawable-y (info-window info))
 		    (info-ilh info)))
 	  (setf (info-y info) (max (- (info-y info) (info-ilh info)) 0)))
 	(draw-info-window info)))
@@ -169,7 +169,7 @@
       (defun info-end-line (info)
 	"Move to last line"
 	(setf (info-x info) 0
-	      (info-y info) (- (* (length (info-list info)) (info-ilh info)) (xlib:drawable-height (info-window info))))
+	      (info-y info) (- (* (length (info-list info)) (info-ilh info)) (x-drawable-height (info-window info))))
 	(setf *info-selected-item* (1- (or (length (info-list info)) 1)))
 	(draw-info-window info)))
   (define-info-key ("Page_Down")
@@ -177,8 +177,8 @@
 	"Move ten lines down"
 	(incf-info-selected-item info 10)
 	(when (> (info-y-display-coords info *info-selected-item*)
-		 (+ (xlib:drawable-y (info-window info))
-		    (xlib:drawable-height (info-window info))))
+		 (+ (x-drawable-y (info-window info))
+		    (x-drawable-height (info-window info))))
 	  (setf (info-y info) (min (+ (info-y info) (* (info-ilh info) 10)) (info-max-y info))))
 	(draw-info-window info)))
   (define-info-key ("Page_Up")
@@ -186,7 +186,7 @@
 	"Move ten lines up"
 	(decf-info-selected-item info 10)
 	(when (< (info-y-display-coords info *info-selected-item*)
-		 (+ (xlib:drawable-y (info-window info))
+		 (+ (x-drawable-y (info-window info))
 		    (info-ilh info)))
 	  (setf (info-y info) (max (- (info-y info) (* (info-ilh info) 10)) 0)))
 	(draw-info-window info))))
diff --git a/src/clfswm-internal.lisp b/src/clfswm-internal.lisp
index 86759f7..e3a6c03 100644
--- a/src/clfswm-internal.lisp
+++ b/src/clfswm-internal.lisp
@@ -91,8 +91,8 @@
 
 (defun in-window (window x y)
   (and (xlib:window-p window)
-       (<= (xlib:drawable-x window) x (+ (xlib:drawable-x window) (xlib:drawable-width window)))
-       (<= (xlib:drawable-y window) y (+ (xlib:drawable-y window) (xlib:drawable-height window)))))
+       (<= (x-drawable-x window) x (+ (x-drawable-x window) (x-drawable-width window)))
+       (<= (x-drawable-y window) y (+ (x-drawable-y window) (x-drawable-height window)))))
 
 (defgeneric in-child (child x y))
 
@@ -239,37 +239,37 @@
 
 (defgeneric child-x (child))
 (defmethod child-x ((child xlib:window))
-  (xlib:drawable-x child))
+  (x-drawable-x child))
 (defmethod child-x ((child frame))
   (frame-rx child))
 
 (defgeneric child-y (child))
 (defmethod child-y ((child xlib:window))
-  (xlib:drawable-y child))
+  (x-drawable-y child))
 (defmethod child-y ((child frame))
   (frame-ry child))
 
 (defgeneric child-width (child))
 (defmethod child-width ((child xlib:window))
-  (xlib:drawable-width child))
+  (x-drawable-width child))
 (defmethod child-width ((child frame))
   (frame-rw child))
 
 (defgeneric child-height (child))
 (defmethod child-height ((child xlib:window))
-  (xlib:drawable-height child))
+  (x-drawable-height child))
 (defmethod child-height ((child frame))
   (frame-rh child))
 
 (defgeneric child-x2 (child))
 (defmethod child-x2 ((child xlib:window))
-  (+ (xlib:drawable-x child) (xlib:drawable-width child)))
+  (+ (x-drawable-x child) (x-drawable-width child)))
 (defmethod child-x2 ((child frame))
   (+ (frame-rx child) (frame-rw child)))
 
 (defgeneric child-y2 (child))
 (defmethod child-y2 ((child xlib:window))
-  (+ (xlib:drawable-y child) (xlib:drawable-height child)))
+  (+ (x-drawable-y child) (x-drawable-height child)))
 (defmethod child-y2 ((child frame))
   (+ (frame-ry child) (frame-rh child)))
 
@@ -278,8 +278,8 @@
 (defgeneric child-center (child))
 
 (defmethod child-center ((child xlib:window))
-  (values (+ (xlib:drawable-x child) (/ (xlib:drawable-width child) 2))
-          (+ (xlib:drawable-y child) (/ (xlib:drawable-height child) 2))))
+  (values (+ (x-drawable-x child) (/ (x-drawable-width child) 2))
+          (+ (x-drawable-y child) (/ (x-drawable-height child) 2))))
 
 (defmethod child-center ((child frame))
   (values (+ (frame-rx child) (/ (frame-rw child) 2))
@@ -303,16 +303,16 @@
 (defgeneric adj-border-wh (value child))
 
 (defmethod adj-border-xy (v (child xlib:window))
-  (+ v (xlib:drawable-border-width child)))
+  (+ v (x-drawable-border-width child)))
 
 (defmethod adj-border-xy (v (child frame))
-  (+ v (xlib:drawable-border-width (frame-window child))))
+  (+ v (x-drawable-border-width (frame-window child))))
 
 (defmethod adj-border-wh (v (child xlib:window))
-  (- v (* (xlib:drawable-border-width child) 2)))
+  (- v (* (x-drawable-border-width child) 2)))
 
 (defmethod adj-border-wh (v (child frame))
-  (- v (* (xlib:drawable-border-width (frame-window child)) 2)))
+  (- v (* (x-drawable-border-width (frame-window child)) 2)))
 
 
 (declaim (inline anti-adj-border-xy anti-adj-border-wh))
@@ -320,16 +320,16 @@
 (defgeneric anti-adj-border-wh (value child))
 
 (defmethod anti-adj-border-xy (v (child xlib:window))
-  (- v (xlib:drawable-border-width child)))
+  (- v (x-drawable-border-width child)))
 
 (defmethod anti-adj-border-xy (v (child frame))
-  (- v (xlib:drawable-border-width (frame-window child))))
+  (- v (x-drawable-border-width (frame-window child))))
 
 (defmethod anti-adj-border-wh (v (child xlib:window))
-  (+ v (* (xlib:drawable-border-width child) 2)))
+  (+ v (* (x-drawable-border-width child) 2)))
 
 (defmethod anti-adj-border-wh (v (child frame))
-  (+ v (* (xlib:drawable-border-width (frame-window child)) 2)))
+  (+ v (* (x-drawable-border-width (frame-window child)) 2)))
 
 
 
@@ -514,10 +514,10 @@
   "Place a frame from real (pixel) coordinates"
   (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
+      (setf (x-drawable-x window) prx
+	    (x-drawable-y window) pry
+	    (x-drawable-width window) prw
+	    (x-drawable-height window) prh
 	    x (x-px->fl prx parent)
 	    y (y-px->fl pry parent)
 	    w (w-px->fl prw parent)
@@ -684,8 +684,8 @@
                    (funcall it child parent)
                    (no-layout child parent))
               (get-fullscreen-size))
-          (values (xlib:drawable-x child) (xlib:drawable-y child)
-                  (xlib:drawable-width child) (xlib:drawable-height child)))))
+          (values (x-drawable-x child) (x-drawable-y child)
+                  (x-drawable-width child) (x-drawable-height child)))))
 
 
 
@@ -698,30 +698,30 @@
     (multiple-value-bind (nx ny nw nh)
 	(get-parent-layout window parent)
       (setf nw (max nw 1)  nh (max nh 1))
-      (let ((change (or (/= (xlib:drawable-x window) nx)
-			(/= (xlib:drawable-y window) ny)
-			(/= (xlib:drawable-width window) nw)
-			(/= (xlib:drawable-height window) nh))))
+      (let ((change (or (/= (x-drawable-x window) nx)
+			(/= (x-drawable-y window) ny)
+			(/= (x-drawable-width window) nw)
+			(/= (x-drawable-height window) nh))))
         (when change
-          (setf (xlib:drawable-x window) nx
-                (xlib:drawable-y window) ny
-                (xlib:drawable-width window) nw
-                (xlib:drawable-height window) nh))
+          (setf (x-drawable-x window) nx
+                (x-drawable-y window) ny
+                (x-drawable-width window) nw
+                (x-drawable-height window) nh))
 	change))))
 
 
 (defmethod adapt-child-to-parent ((frame frame) parent)
   (declare (ignore parent))
     (with-slots (rx ry rw rh window) frame
-      (let ((change (or (/= (xlib:drawable-x window) rx)
-			(/= (xlib:drawable-y window) ry)
-			(/= (xlib:drawable-width window) rw)
-			(/= (xlib:drawable-height window) rh))))
+      (let ((change (or (/= (x-drawable-x window) rx)
+			(/= (x-drawable-y window) ry)
+			(/= (x-drawable-width window) rw)
+			(/= (x-drawable-height window) rh))))
         (when change
-          (setf (xlib:drawable-x window) rx
-                (xlib:drawable-y window) ry
-                (xlib:drawable-width window) rw
-                (xlib:drawable-height window) rh))
+          (setf (x-drawable-x window) rx
+                (x-drawable-y window) ry
+                (x-drawable-width window) rw
+                (x-drawable-height window) rh))
 	change)))
 
 (defmethod adapt-child-to-parent (child parent)
@@ -850,15 +850,15 @@
                                  (child-rect-child rect)))
                   (frame (frame-window (child-rect-child rect))))))
     (when window
-      (let ((change (or (/= (xlib:drawable-x window) (child-rect-x rect))
-			(/= (xlib:drawable-y window) (child-rect-y rect))
-			(/= (xlib:drawable-width window) (child-rect-w rect))
-			(/= (xlib:drawable-height window) (child-rect-h rect)))))
+      (let ((change (or (/= (x-drawable-x window) (child-rect-x rect))
+			(/= (x-drawable-y window) (child-rect-y rect))
+			(/= (x-drawable-width window) (child-rect-w rect))
+			(/= (x-drawable-height window) (child-rect-h rect)))))
         (when change
-          (setf (xlib:drawable-x window) (child-rect-x rect)
-                (xlib:drawable-y window) (child-rect-y rect)
-                (xlib:drawable-width window) (child-rect-w rect)
-                (xlib:drawable-height window) (child-rect-h rect)))
+          (setf (x-drawable-x window) (child-rect-x rect)
+                (x-drawable-y window) (child-rect-y rect)
+                (x-drawable-width window) (child-rect-w rect)
+                (x-drawable-height window) (child-rect-h rect)))
 	change))))
 
 
@@ -1197,17 +1197,17 @@ Warning:frame window and gc are freeed."
   (let* ((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)) (xlib:drawable-width *root*)))
-	 (max-height (or (and hints (xlib:wm-size-hints-max-height hints)) (xlib:drawable-height *root*)))
+	 (max-width (or (and hints (xlib:wm-size-hints-max-width hints)) (x-drawable-width *root*)))
+	 (max-height (or (and hints (xlib:wm-size-hints-max-height hints)) (x-drawable-height *root*)))
 	 (rwidth (or (and hints (or (xlib:wm-size-hints-width hints) (xlib:wm-size-hints-base-width hints)))
-		     (xlib:drawable-width window)))
+		     (x-drawable-width window)))
 	 (rheight (or (and hints (or (xlib:wm-size-hints-height hints) (xlib:wm-size-hints-base-height hints)))
-		      (xlib:drawable-height window))))
-    (setf (xlib:drawable-width window) (min (max min-width rwidth *default-window-width*) max-width)
-	  (xlib:drawable-height window) (min (max min-height rheight *default-window-height*) max-height))
-    (with-placement (*unmanaged-window-placement* x y (xlib:drawable-width window) (xlib:drawable-height window))
-      (setf (xlib:drawable-x window) x
-            (xlib:drawable-y window) y))
+		      (x-drawable-height window))))
+    (setf (x-drawable-width window) (min (max min-width rwidth *default-window-width*) max-width)
+	  (x-drawable-height window) (min (max min-height rheight *default-window-height*) max-height))
+    (with-placement (*unmanaged-window-placement* x y (x-drawable-width window) (x-drawable-height window))
+      (setf (x-drawable-x window) x
+            (x-drawable-y window) y))
     (xlib:display-finish-output *display*)))
 
 
@@ -1229,7 +1229,7 @@ windows), this function dresses the window up and gets it ready to be
 managed."
   (setf (xlib:window-event-mask window) *window-events*)
   (set-window-state window +normal-state+)
-  (setf (xlib:drawable-border-width window) (case (window-type window)
+  (setf (x-drawable-border-width window) (case (window-type window)
 					      (:normal *border-size*)
 					      (:maxsize *border-size*)
 					      (:transient *border-size*)
diff --git a/src/clfswm-pack.lisp b/src/clfswm-pack.lisp
index e635809..16434b7 100644
--- a/src/clfswm-pack.lisp
+++ b/src/clfswm-pack.lisp
@@ -235,10 +235,10 @@
 (labels ((readjust-all-frames-fl-size (parent)
            (dolist (child (frame-child parent))
              (when (frame-p child)
-               (setf (frame-x child) (x-px->fl (xlib:drawable-x (frame-window child)) parent)
-                     (frame-y child) (y-px->fl (xlib:drawable-y (frame-window child)) parent)
-                     (frame-w child) (w-px->fl (anti-adj-border-wh (xlib:drawable-width (frame-window child)) parent) parent)
-                     (frame-h child) (h-px->fl (anti-adj-border-wh (xlib:drawable-height (frame-window child)) parent) parent))))))
+               (setf (frame-x child) (x-px->fl (x-drawable-x (frame-window child)) parent)
+                     (frame-y child) (y-px->fl (x-drawable-y (frame-window child)) parent)
+                     (frame-w child) (w-px->fl (anti-adj-border-wh (x-drawable-width (frame-window child)) parent) parent)
+                     (frame-h child) (h-px->fl (anti-adj-border-wh (x-drawable-height (frame-window child)) parent) parent))))))
   (defun move-frame-constrained (frame parent orig-x orig-y)
     (when (and frame parent (not (child-equal-p frame *current-root*)))
       (hide-all-children frame)
@@ -250,32 +250,32 @@
                        (lambda ()
                          (let ((move-x t)
                                (move-y t))
-                           (setf (frame-x frame) (x-px->fl (xlib:drawable-x window) parent)
-                                 (frame-y frame) (y-px->fl (xlib:drawable-y window) parent))
+                           (setf (frame-x frame) (x-px->fl (x-drawable-x window) parent)
+                                 (frame-y frame) (y-px->fl (x-drawable-y window) parent))
                            (multiple-value-bind (x y) (xlib:query-pointer *root*)
                              (when (> x lx)
                                (let ((x-found (x-fl->px (find-edge-right frame parent) parent)))
                                  (when (< (abs (- x-found (window-x2 window))) *snap-size*)
-                                   (setf (xlib:drawable-x window) (- x-found (adj-border-xy (xlib:drawable-width window) window))
-                                         (frame-x frame) (x-px->fl (xlib:drawable-x window) parent)
+                                   (setf (x-drawable-x window) (- x-found (adj-border-xy (x-drawable-width window) window))
+                                         (frame-x frame) (x-px->fl (x-drawable-x window) parent)
                                          move-x nil))))
                              (when (< x lx)
                                (let ((x-found (x-fl->px (find-edge-left frame parent) parent)))
-                                 (when (< (abs (- x-found (xlib:drawable-x window))) *snap-size*)
-                                   (setf (xlib:drawable-x window) (adj-border-xy x-found window)
-                                         (frame-x frame) (x-px->fl (xlib:drawable-x window) parent)
+                                 (when (< (abs (- x-found (x-drawable-x window))) *snap-size*)
+                                   (setf (x-drawable-x window) (adj-border-xy x-found window)
+                                         (frame-x frame) (x-px->fl (x-drawable-x window) parent)
                                          move-x nil))))
                              (when (> y ly)
                                (let ((y-found (y-fl->px (find-edge-down frame parent) parent)))
                                  (when (< (abs (- y-found (window-y2 window))) *snap-size*)
-                                   (setf (xlib:drawable-y window) (- y-found (adj-border-xy (xlib:drawable-height window) window))
-                                         (frame-y frame) (y-px->fl (xlib:drawable-y window) parent)
+                                   (setf (x-drawable-y window) (- y-found (adj-border-xy (x-drawable-height window) window))
+                                         (frame-y frame) (y-px->fl (x-drawable-y window) parent)
                                          move-y nil))))
                              (when (< y ly)
                                (let ((y-found (y-fl->px (find-edge-up frame parent) parent)))
-                                 (when (< (abs (- y-found (xlib:drawable-y window))) *snap-size*)
-                                   (setf (xlib:drawable-y window) (adj-border-xy y-found window)
-                                         (frame-y frame) (y-px->fl (xlib:drawable-y window) parent)
+                                 (when (< (abs (- y-found (x-drawable-y window))) *snap-size*)
+                                   (setf (x-drawable-y window) (adj-border-xy y-found window)
+                                         (frame-y frame) (y-px->fl (x-drawable-y window) parent)
                                          move-y nil))))
                              (display-frame-info frame)
                              (when move-x (setf lx x))
@@ -296,21 +296,21 @@
                            (let ((resize-w t)
                                  (resize-h t))
                              (multiple-value-bind (x y) (xlib:query-pointer *root*)
-                               (setf (frame-w frame) (w-px->fl (anti-adj-border-wh (xlib:drawable-width window) parent) parent)
-                                     (frame-h frame) (h-px->fl (anti-adj-border-wh (xlib:drawable-height window) parent) parent))
+                               (setf (frame-w frame) (w-px->fl (anti-adj-border-wh (x-drawable-width window) parent) parent)
+                                     (frame-h frame) (h-px->fl (anti-adj-border-wh (x-drawable-height window) parent) parent))
                                (when (> x lx)
                                  (let ((x-found (x-fl->px (find-edge-right frame parent) parent)))
                                    (when (< (abs (- x-found (window-x2 window))) *snap-size*)
-                                     (setf (xlib:drawable-width window) (+ (xlib:drawable-width window)
+                                     (setf (x-drawable-width window) (+ (x-drawable-width window)
                                                                            (- x-found (adj-border-xy (window-x2 window) parent)))
-                                           (frame-w frame) (w-px->fl (anti-adj-border-wh (xlib:drawable-width window) parent) parent)
+                                           (frame-w frame) (w-px->fl (anti-adj-border-wh (x-drawable-width window) parent) parent)
                                            resize-w nil))))
                                (when (> y ly)
                                  (let ((y-found (y-fl->px (find-edge-down frame parent) parent)))
                                    (when (< (abs (- y-found (window-y2 window))) *snap-size*)
-                                     (setf (xlib:drawable-height window) (+ (xlib:drawable-height window)
+                                     (setf (x-drawable-height window) (+ (x-drawable-height window)
                                                                             (- y-found (adj-border-xy (window-y2 window) parent)))
-                                           (frame-h frame) (h-px->fl (anti-adj-border-wh (xlib:drawable-height window) parent) parent)
+                                           (frame-h frame) (h-px->fl (anti-adj-border-wh (x-drawable-height window) parent) parent)
                                            resize-h nil))))
                                (display-frame-info frame)
                                (when resize-w (setf lx x))
diff --git a/src/clfswm-placement.lisp b/src/clfswm-placement.lisp
index c4167a5..4c4ccb0 100644
--- a/src/clfswm-placement.lisp
+++ b/src/clfswm-placement.lisp
@@ -107,10 +107,10 @@
 ;;;
 (defun current-child-coord ()
   (typecase *current-child*
-    (xlib:window (values (xlib:drawable-x *current-child*)
-			 (xlib:drawable-y *current-child*)
-			 (xlib:drawable-width *current-child*)
-			 (xlib:drawable-height *current-child*)))
+    (xlib:window (values (x-drawable-x *current-child*)
+			 (x-drawable-y *current-child*)
+			 (x-drawable-width *current-child*)
+			 (x-drawable-height *current-child*)))
     (frame (values (frame-rx *current-child*)
 		   (frame-ry *current-child*)
 		   (frame-rw *current-child*)
diff --git a/src/clfswm-query.lisp b/src/clfswm-query.lisp
index 4be8394..281a547 100644
--- a/src/clfswm-query.lisp
+++ b/src/clfswm-query.lisp
@@ -102,7 +102,7 @@
 
 
 (defun query-print-string ()
-  (let ((dec (min 0 (- (- (xlib:drawable-width *query-window*) 10)
+  (let ((dec (min 0 (- (- (x-drawable-width *query-window*) 10)
 		       (+ 10 (* *query-pos* (xlib:max-char-width *query-font*)))))))
     (clear-pixmap-buffer *query-window* *query-gc*)
     (setf (xlib:gcontext-foreground *query-gc*) (get-color *query-message-color*))
diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp
index 280f733..e24f7f6 100644
--- a/src/clfswm-util.lisp
+++ b/src/clfswm-util.lisp
@@ -568,8 +568,8 @@
     (hide-all-children frame)
     (with-slots (window) frame
       (move-window window orig-x orig-y #'display-frame-info (list frame))
-      (setf (frame-x frame) (x-px->fl (xlib:drawable-x window) parent)
-	    (frame-y frame) (y-px->fl (xlib:drawable-y window) parent)))
+      (setf (frame-x frame) (x-px->fl (x-drawable-x window) parent)
+	    (frame-y frame) (y-px->fl (x-drawable-y window) parent)))
     (show-all-children)))
 
 (defun resize-frame (frame parent orig-x orig-y)
@@ -577,8 +577,8 @@
     (hide-all-children frame)
     (with-slots (window) frame
       (resize-window window orig-x orig-y #'display-frame-info (list frame))
-      (setf (frame-w frame) (w-px->fl (xlib:drawable-width window) parent)
-	    (frame-h frame) (h-px->fl (xlib:drawable-height window) parent)))
+      (setf (frame-w frame) (w-px->fl (x-drawable-width window) parent)
+	    (frame-h frame) (h-px->fl (x-drawable-height window) parent)))
     (show-all-children)))
 
 
@@ -982,8 +982,8 @@ For window: set current child to window or its parent according to window-parent
   "Force the current window to move in the frame (Useful only for unmanaged windows)"
   (with-current-window
     (let ((parent (find-parent-frame window)))
-      (setf (xlib:drawable-x window) (frame-rx parent)
-	    (xlib:drawable-y window) (frame-ry parent))
+      (setf (x-drawable-x window) (frame-rx parent)
+	    (x-drawable-y window) (frame-ry parent))
       (xlib:display-finish-output *display*)))
   (leave-second-mode))
 
@@ -992,12 +992,12 @@ For window: set current child to window or its parent according to window-parent
   "Force the current window to move in the center of the frame (Useful only for unmanaged windows)"
   (with-current-window
     (let ((parent (find-parent-frame window)))
-      (setf (xlib:drawable-x window) (truncate (+ (frame-rx parent)
+      (setf (x-drawable-x window) (truncate (+ (frame-rx parent)
 						  (/ (- (frame-rw parent)
-							(xlib:drawable-width window)) 2)))
-	    (xlib:drawable-y window) (truncate (+ (frame-ry parent)
+							(x-drawable-width window)) 2)))
+	    (x-drawable-y window) (truncate (+ (frame-ry parent)
 						  (/ (- (frame-rh parent)
-							(xlib:drawable-height window)) 2))))
+							(x-drawable-height window)) 2))))
       (xlib:display-finish-output *display*)))
   (leave-second-mode))
 
diff --git a/src/clfswm.lisp b/src/clfswm.lisp
index 4e42f2e..fe5c68b 100644
--- a/src/clfswm.lisp
+++ b/src/clfswm.lisp
@@ -51,22 +51,22 @@
 	   (has-bw (mask) (= 16 (logand mask 16)))
 	   (has-stackmode (mask) (= 64 (logand mask 64)))
 	   (adjust-from-request ()
-	     (when (has-x value-mask) (setf (xlib:drawable-x window) x))
-	     (when (has-y value-mask) (setf (xlib:drawable-y window) y))
-	     (when (has-h value-mask) (setf (xlib:drawable-height window) height))
-	     (when (has-w value-mask) (setf (xlib:drawable-width window) width))))
+	     (when (has-x value-mask) (setf (x-drawable-x window) x))
+	     (when (has-y value-mask) (setf (x-drawable-y window) y))
+	     (when (has-h value-mask) (setf (x-drawable-height window) height))
+	     (when (has-w value-mask) (setf (x-drawable-width window) width))))
     (xlib:with-state (window)
       (when (has-bw value-mask)
-	(setf (xlib:drawable-border-width window) border-width))
+	(setf (x-drawable-border-width window) border-width))
       (if (find-child window *current-root*)
 	  (let ((parent (find-parent-frame window *current-root*)))
 	    (if (and parent (managed-window-p window parent))
 		(adapt-child-to-parent window parent)
 		(adjust-from-request)))
 	  (adjust-from-request))
-      (send-configuration-notify window (xlib:drawable-x window) (xlib:drawable-y window)
-				 (xlib:drawable-width window) (xlib:drawable-height window)
-				 (xlib:drawable-border-width window))
+      (send-configuration-notify window (x-drawable-x window) (x-drawable-y window)
+				 (x-drawable-width window) (x-drawable-height window)
+				 (x-drawable-border-width window))
       (when (has-stackmode value-mask)
 	(case stack-mode
 	  (:above
@@ -139,7 +139,7 @@
   (cond
     ;; ignore asynchronous window errors
     ((and asynchronous
-          (find error-key '(xlib:window-error xlib:drawable-error xlib:match-error)))
+          (find error-key '(xlib:window-error x-drawable-error xlib:match-error)))
      (format t "Ignoring XLib asynchronous error: ~s~%" error-key))
     ((eq error-key 'xlib:access-error)
      (write-line "Another window manager is running.")
diff --git a/src/xlib-util.lisp b/src/xlib-util.lisp
index e93ca16..eb1b04c 100644
--- a/src/xlib-util.lisp
+++ b/src/xlib-util.lisp
@@ -86,10 +86,10 @@ Window types are in +WINDOW-TYPES+.")
 
 (declaim (inline window-x2 window-y2))
 (defun window-x2 (window)
-  (+ (xlib:drawable-x window) (xlib:drawable-width window)))
+  (+ (x-drawable-x window) (x-drawable-width window)))
 
 (defun window-y2 (window)
-  (+ (xlib:drawable-y window) (xlib:drawable-height window)))
+  (+ (x-drawable-y window) (x-drawable-height window)))
 
 
 
@@ -216,7 +216,6 @@ Expand in handle-event-fun-main-mode-key-press"
 (defsetf window-state set-window-state)
 
 
-
 (defun window-hidden-p (window)
   (eql (window-state window) +iconic-state+))
 
@@ -320,7 +319,7 @@ Expand in handle-event-fun-main-mode-key-press"
 ;;  (xlib:get-property window property-atom
 ;;		     :transform (when atom-list-p
 ;;				  (lambda (id)
-;;				    (xlib:atom-name (xlib:drawable-display window) id)))))
+;;				    (xlib:atom-name (x-drawable-display window) id)))))
 ;;
 ;;(defun set-atoms-property (window atoms property-atom &key (mode :replace))
 ;;  "Sets the property designates by `property-atom'. ATOMS is a list of atom-id
@@ -329,7 +328,7 @@ Expand in handle-event-fun-main-mode-key-press"
 ;;			:mode mode
 ;;			:transform (unless (integerp (car atoms))
 ;;				     (lambda (atom-key)
-;;				       (xlib:find-atom (xlib:drawable-display window) atom-key)))))
+;;				       (xlib:find-atom (x-drawable-display window) atom-key)))))
 ;;
 ;;
 ;;
@@ -537,11 +536,11 @@ Expand in handle-event-fun-main-mode-key-press"
           (multiple-value-bind (move-x move-y)
               (apply add-fn add-arg)
             (when move-x
-              (setf (xlib:drawable-x window) (+ root-x dx)))
+              (setf (x-drawable-x window) (+ root-x dx)))
             (when move-y
-              (setf (xlib:drawable-y window) (+ root-y dy))))
-          (setf (xlib:drawable-x window) (+ root-x dx)
-                (xlib:drawable-y window) (+ root-y dy)))))
+              (setf (x-drawable-y window) (+ root-y dy))))
+          (setf (x-drawable-x window) (+ root-x dx)
+                (x-drawable-y window) (+ root-y dy)))))
 
   (define-handler move-window-mode :key-release ()
     (throw 'exit-move-window-mode nil))
@@ -553,8 +552,8 @@ Expand in handle-event-fun-main-mode-key-press"
     (setf window orig-window
 	  add-fn additional-fn
 	  add-arg additional-arg
-	  dx (- (xlib:drawable-x window) orig-x)
-	  dy (- (xlib:drawable-y window) orig-y)
+	  dx (- (x-drawable-x window) orig-x)
+	  dy (- (x-drawable-y window) orig-y)
 	  (xlib:window-border window) (get-color *color-move-window*))
     (raise-window window)
     (let ((pointer-grabbed-p (xgrab-pointer-p)))
@@ -579,11 +578,11 @@ Expand in handle-event-fun-main-mode-key-press"
           (multiple-value-bind (resize-w resize-h)
               (apply add-fn add-arg)
             (when resize-w
-              (setf (xlib:drawable-width window) (min (max (+ orig-width (- root-x o-x)) 10 min-width) max-width)))
+              (setf (x-drawable-width window) (min (max (+ orig-width (- root-x o-x)) 10 min-width) max-width)))
             (when resize-h
-              (setf (xlib:drawable-height window) (min (max (+ orig-height (- root-y o-y)) 10 min-height) max-height))))
-          (setf (xlib:drawable-width window) (min (max (+ orig-width (- root-x o-x)) 10 min-width) max-width)
-                (xlib:drawable-height window) (min (max (+ orig-height (- root-y o-y)) 10 min-height) max-height)))))
+              (setf (x-drawable-height window) (min (max (+ orig-height (- root-y o-y)) 10 min-height) max-height))))
+          (setf (x-drawable-width window) (min (max (+ orig-width (- root-x o-x)) 10 min-width) max-width)
+                (x-drawable-height window) (min (max (+ orig-height (- root-y o-y)) 10 min-height) max-height)))))
 
   (define-handler resize-window-mode :key-release ()
     (throw 'exit-resize-window-mode nil))
@@ -599,8 +598,8 @@ Expand in handle-event-fun-main-mode-key-press"
 	    add-arg additional-arg
 	    o-x orig-x
 	    o-y orig-y
-	    orig-width (xlib:drawable-width window)
-	    orig-height (xlib:drawable-height window)
+	    orig-width (x-drawable-width window)
+	    orig-height (x-drawable-height 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)
@@ -820,13 +819,13 @@ Expand in handle-event-fun-main-mode-key-press"
 (defun clear-pixmap-buffer (window gc)
   (rotatef (xlib:gcontext-foreground gc) (xlib:gcontext-background gc))
   (xlib:draw-rectangle *pixmap-buffer* gc
-		       0 0 (xlib:drawable-width window) (xlib:drawable-height window)
+		       0 0 (x-drawable-width window) (x-drawable-height window)
 		       t)
   (rotatef (xlib:gcontext-foreground gc) (xlib:gcontext-background gc)))
 
 (defun copy-pixmap-buffer (window gc)
   (xlib:copy-area *pixmap-buffer* gc
-		  0 0 (xlib:drawable-width window) (xlib:drawable-height window)
+		  0 0 (x-drawable-width window) (x-drawable-height window)
 		  window 0 0))
 
 
@@ -845,3 +844,68 @@ Expand in handle-event-fun-main-mode-key-press"
   `(defun ,symbol (window)
      (when (xlib:window-p window)
        (string-equal (xlib:wm-name window) ,name))))
+
+
+;;; Drawable wrapper to prevent type error in some CLX versions
+(declaim (inline x-drawable-x x-drawable-y
+                 x-drawable-width x-drawable-height
+                 x-drawable-border-width))
+
+;; X
+(defun x-drawable-x (window)
+  (xlib:drawable-x window))
+
+(defun set-x-drawable-x (window x)
+  (if (typep x '(signed-byte 16))
+      (setf (xlib:drawable-x window) x)
+      (dbg 'x-type-error window x (xlib:wm-name window))))
+
+(defsetf x-drawable-x set-x-drawable-x)
+
+;; Y
+(defun x-drawable-y (window)
+  (xlib:drawable-y window))
+
+(defun set-x-drawable-y (window y)
+  (if (typep y '(signed-byte 16))
+      (setf (xlib:drawable-y window) y)
+      (dbg 'y-type-error window y (xlib:wm-name window))))
+
+(defsetf x-drawable-y set-x-drawable-y)
+
+;; Width
+(defun x-drawable-width (window)
+  (xlib:drawable-width window))
+
+(defun set-x-drawable-width (window width)
+  (if (typep width '(unsigned-byte 16))
+      (setf (xlib:drawable-width window) width)
+      (dbg 'width-type-error window width (xlib:wm-name window))))
+
+(defsetf x-drawable-width set-x-drawable-width)
+
+;; Height
+(defun x-drawable-height (window)
+  (xlib:drawable-height window))
+
+(defun set-x-drawable-height (window height)
+  (if (typep height '(unsigned-byte 16))
+      (setf (xlib:drawable-height window) height)
+      (dbg 'height-type-error window height (xlib:wm-name window))))
+
+(defsetf x-drawable-height set-x-drawable-height)
+
+;; Border
+(defun x-drawable-border-width (window)
+  (xlib:drawable-border-width window))
+
+(defun set-x-drawable-border-width (window border-width)
+  (if (typep border-width '(unsigned-byte 16))
+      (setf (xlib:drawable-border-width window) border-width)
+      (dbg 'border-width-type-error window border-width (xlib:wm-name window))))
+
+(defsetf x-drawable-border-width set-x-drawable-border-width)
+
+
+
+

-----------------------------------------------------------------------


hooks/post-receive
-- 
CLFSWM - A(nother) Common Lisp FullScreen Window Manager




More information about the clfswm-cvs mailing list