Use x-drawable-width/height of *root* instead of xlib:screen-width/height to get...
authorPhilippe Brochard <pbrochard@common-lisp.net>
Wed, 31 Jul 2013 15:01:07 +0000 (31 17:01 +0200)
committerPhilippe Brochard <pbrochard@common-lisp.net>
Wed, 31 Jul 2013 15:01:07 +0000 (31 17:01 +0200)
src/clfswm-corner.lisp
src/clfswm-expose-mode.lisp
src/clfswm-fastswitch-mode.lisp
src/clfswm-info.lisp
src/clfswm-internal.lisp
src/clfswm-placement.lisp
src/clfswm-query.lisp
src/clfswm-util.lisp
src/clfswm.lisp
src/netwm-util.lisp
src/xlib-util.lisp

index 2ac28df..9c1597c 100644 (file)
@@ -27,8 +27,8 @@
 
 
 
-(symbol-macrolet ((sw (xlib:screen-width *screen*))
-                 (sh (xlib:screen-height *screen*))
+(symbol-macrolet ((sw (screen-width))
+                 (sh (screen-height))
                  (cs *corner-size*))
   (defun in-corner (corner x y)
     "Return t if (x, y) is in corner.
@@ -44,8 +44,8 @@ Corner is one of :bottom-right :bottom-left :top-right :top-left"
           (<= ymin y ymax)))))
 
 
-(symbol-macrolet ((sw (xlib:screen-width *screen*))
-                 (sh (xlib:screen-height *screen*))
+(symbol-macrolet ((sw (screen-width))
+                 (sh (screen-height))
                  (cs *corner-size*))
   (defun find-corner (x y)
     (cond ((and (< cs x (- sw cs)) (< cs y (- sh cs))) nil)
index f4354ba..22c52f8 100644 (file)
        *expose-child-list* (expose-associate-keys)
        *expose-selected-child* nil
         *query-string* "")
-  (xlib:warp-pointer *root* (truncate (/ (xlib:screen-width *screen*) 2))
-                    (truncate (/ (xlib:screen-height *screen*) 2)))
+  (xlib:warp-pointer *root* (truncate (/ (screen-width) 2))
+                    (truncate (/ (screen-height) 2)))
   (add-hook *query-key-press-hook* 'expose-query-key-press-hook)
   (add-hook *query-button-press-hook* 'expose-query-button-press-hook))
 
index ea1eb37..c74d2d5 100644 (file)
                                        (child-fullname (expose-child-child ex-child)))
                      (incf posx (1+ (length (child-fullname (expose-child-child ex-child))))))
                    (when (> (* posx (xlib:max-char-width *fastswitch-font*))
-                            (xlib:drawable-width *fastswitch-window*))
+                            (x-drawable-width *fastswitch-window*))
                      (if *fastswitch-adjust-window-p*
                          (setf posx 1
                                posy (1+ posy))
                          (return)))))))
            (adjust-window ()
-             (setf (xlib:drawable-height *fastswitch-window*) (* (xlib:font-ascent *fastswitch-font*) 3))
+             (setf (x-drawable-height *fastswitch-window*) (* (xlib:font-ascent *fastswitch-font*) 3))
              (let ((posx 1))
                (dolist (ex-child *fastswitch-match-child*)
                  (when (or *fastswitch-show-frame-p* (not (frame-p (expose-child-child ex-child))))
@@ -85,9 +85,9 @@
                    (incf posx)
                    (incf posx (1+ (length (child-fullname (expose-child-child ex-child)))))
                    (when (> (* posx (xlib:max-char-width *fastswitch-font*))
-                            (xlib:drawable-width *fastswitch-window*))
+                            (x-drawable-width *fastswitch-window*))
                      (setf posx 1)
-                     (incf (xlib:drawable-height *fastswitch-window*) (xlib:font-ascent *fastswitch-font*))))))))
+                     (incf (x-drawable-height *fastswitch-window*) (xlib:font-ascent *fastswitch-font*))))))))
     (when *fastswitch-adjust-window-p*
       (adjust-window))
     (clear-pixmap-buffer *fastswitch-window* *fastswitch-gc*)
   (setf *fastswitch-font* (xlib:open-font *display* *fastswitch-font-string*)
         *fastswitch-string* ""
         *fastswitch-match-child* (string-match *fastswitch-string* *expose-child-list* #'expose-child-key))
-  (let* ((width (- (xlib:screen-width *screen*) 2))
+  (let* ((width (- (screen-width) 2))
          (height (* (xlib:font-ascent *fastswitch-font*) 3)))
     (with-placement (*fastswitch-mode-placement* x y width height)
       (setf *fastswitch-window* (xlib:create-window :parent *root*
index 46be718..836ce43 100644 (file)
@@ -317,10 +317,10 @@ Or ((1_word color) (2_word color) 3_word (4_word color)...)"
               (ilh (+ (xlib:max-char-ascent font) (xlib:max-char-descent font) 1))
               (width (or width
                          (min (* (+ (loop for l in info-list maximize (compute-size l)) 2) ilw)
-                              (xlib:screen-width *screen*))))
+                              (screen-width))))
               (height (or height
                           (min (round (+ (* (length info-list) ilh) (/ ilh 2)))
-                               (xlib:screen-height *screen*)))))
+                               (screen-height)))))
          (with-placement (*info-mode-placement* x y width height)
            (let* ((window (xlib:create-window :parent *root*
                                               :x x :y y
index f56de6b..73dbcd8 100644 (file)
@@ -1,4 +1,4 @@
-;; --------------------------------------------------------------------------
+;;; --------------------------------------------------------------------------
 ;;; CLFSWM - FullScreen Window Manager
 ;;;
 ;;; --------------------------------------------------------------------------
   (unless (get-root-list)
     (let ((frame (create-frame)))
       (add-frame frame *root-frame*)
-      (define-as-root frame 0 0 (xlib:screen-width *screen*) (xlib:screen-height *screen*))
+      (define-as-root frame 0 0 (screen-width) (screen-height))
       (add-frame (create-frame) frame))))
 
 
@@ -850,9 +850,9 @@ XINERAMA version 1.1 opcode: 150
 
   (defun place-frames-from-xinerama-infos ()
     "Place frames according to xdpyinfo/xinerama informations"
-    (let ((sizes (get-connected-heads-size))
-          (width (xlib:screen-width *screen*))
-          (height (xlib:screen-height *screen*)))
+    (let ((sizes (get-connected-heads-size t)) ;;; PHIL: remove here
+          (width (screen-width))
+          (height (screen-height)))
       (labels ((update-root-geometry ()
                  (loop for size in sizes
                     for root in (get-root-list)
@@ -1020,8 +1020,8 @@ XINERAMA version 1.1 opcode: 150
                     (funcall it child parent)
                     (no-layout child parent))
                (values (- (child-border-size child)) (- (child-border-size child))
-                       (xlib:screen-width *screen*)
-                       (xlib:screen-height *screen*)))
+                       (screen-width)
+                       (screen-height)))
            (values (x-drawable-x child) (x-drawable-y child)
                    (x-drawable-width child) (x-drawable-height child)))))
 
@@ -1625,8 +1625,8 @@ managed."
 
 (defun store-root-background ()
   (with-all-mapped-windows *screen* #'hide-window)
-  (setf *background-image* (xlib:create-pixmap :width (xlib:screen-width *screen*)
-                                               :height (xlib:screen-height *screen*)
+  (setf *background-image* (xlib:create-pixmap :width (screen-width)
+                                               :height (screen-height)
                                                :depth (xlib:screen-root-depth *screen*)
                                                :drawable *root*)
         *background-gc* (xlib:create-gcontext :drawable *background-image*
@@ -1635,7 +1635,7 @@ managed."
                                               :font *default-font*
                                               :line-style :solid))
   (xlib:copy-area *root* *background-gc*
-                  0 0 (xlib:screen-width *screen*) (xlib:screen-height *screen*)
+                  0 0 (screen-width) (screen-height)
                   *background-image* 0 0)
   (with-all-mapped-windows *screen* #'unhide-window))
 
index cb8efb8..d777d66 100644 (file)
@@ -61,8 +61,8 @@
 ;;; Absolute placement
 ;;;
 (defun root-screen-coord (border-size)
-  (values (- (xlib:screen-width *screen*) (* 2 border-size))
-          (- (xlib:screen-height *screen*) (* 2 border-size))))
+  (values (- (screen-width) (* 2 border-size))
+          (- (screen-height) (* 2 border-size))))
 
 (defmacro with-root-screen-coord ((border-size w h) &body body)
   `(multiple-value-bind (,w ,h)
index e250ee7..091eda5 100644 (file)
 
 (defun query-enter-function ()
   (setf *query-font* (xlib:open-font *display* *query-font-string*))
-  (let ((width (- (xlib:screen-width *screen*) 2))
+  (let ((width (- (screen-width) 2))
        (height (* 3 (+ (xlib:max-char-ascent *query-font*) (xlib:max-char-descent *query-font*)))))
     (with-placement (*query-mode-placement* x y width height)
       (setf *query-window* (xlib:create-window :parent *root*
index 4521c0c..2d24a98 100644 (file)
@@ -493,7 +493,7 @@ Write (defparameter *contrib-dir* \"/usr/local/lib/clfswm/\") in ~A.~%"
         (font (xlib:open-font *display* *identify-font-string*))
         (window (xlib:create-window :parent *root*
                                     :x 0 :y 0
-                                    :width (- (xlib:screen-width *screen*) (* *border-size* 2))
+                                    :width (- (screen-width) (* *border-size* 2))
                                     :height (* 5 (+ (xlib:max-char-ascent font) (xlib:max-char-descent font)))
                                     :background (get-color *identify-background*)
                                     :border-width *border-size*
@@ -577,7 +577,7 @@ Write (defparameter *contrib-dir* \"/usr/local/lib/clfswm/\") in ~A.~%"
           (let ((ret (info-mode (expand-newline (append (ensure-list (format nil "> ~A" form))
                                                         (ensure-list printed-result)
                                                         (ensure-list result)))
-                                :width (- (xlib:screen-width *screen*) 2))))
+                                :width (- (screen-width) 2))))
             (when (or (search "defparameter" form :test #'string-equal)
                       (search "defvar" form :test #'string-equal))
               (let ((elem (split-string form)))
@@ -1662,7 +1662,7 @@ For window: set current child to window or its parent according to window-parent
        (reset-if-moved x y)
        (setf minx x)
        (add-in-history x y)
-       (setf lx (middle minx (or maxx (xlib:screen-width *screen*))))
+       (setf lx (middle minx (or maxx (screen-width))))
        (xlib:warp-pointer *root* lx y)))
     (defun speed-mouse-up ()
       "Speed move mouse to up"
@@ -1678,7 +1678,7 @@ For window: set current child to window or its parent according to window-parent
        (reset-if-moved x y)
        (setf miny y)
        (add-in-history x y)
-       (setf ly (middle miny (or maxy (xlib:screen-height *screen*))))
+       (setf ly (middle miny (or maxy (screen-height))))
        (xlib:warp-pointer *root* x ly)))
     (defun speed-mouse-undo ()
       "Undo last speed mouse move"
index 090decd..ba8314b 100644 (file)
 
 
 (define-handler main-mode :enter-notify  (window root-x root-y)
-  (unless (and (> root-x (- (xlib:screen-width *screen*) 3))
-              (> root-y (- (xlib:screen-height *screen*) 3)))
+  (unless (and (> root-x (- (screen-width) 3))
+              (> root-y (- (screen-height) 3)))
     (manage-focus window root-x root-y)))
 
 
        *root* (xlib:screen-root *screen*)
        *no-focus-window* (xlib:create-window :parent *root* :x 0 :y 0 :width 1 :height 1)
        *default-font* (xlib:open-font *display* *default-font-string*)
-       *pixmap-buffer* (xlib:create-pixmap :width (xlib:screen-width *screen*)
-                                           :height (xlib:screen-height *screen*)
+       *pixmap-buffer* (xlib:create-pixmap :width (screen-width)
+                                           :height (screen-height)
                                            :depth (xlib:screen-root-depth *screen*)
                                            :drawable *root*)
        *in-second-mode* nil
index 71689c2..ff747f3 100644 (file)
@@ -49,8 +49,8 @@
   ;;  (xlib:change-property *root* :_NET_NUMBER_OF_DESKTOPS
   ;;              (list (length *workspace-list*)) :cardinal 32)
   ;;  (xlib:change-property *root* :_NET_DESKTOP_GEOMETRY
-  ;;              (list (xlib:screen-width *screen*)
-  ;;                    (xlib:screen-height *screen*))
+  ;;              (list (screen-width)
+  ;;                    (screen-height))
   ;;              :cardinal 32)
   ;;  (xlib:change-property *root* :_NET_DESKTOP_VIEWPORT
   ;;              (list 0 0) :cardinal 32)
index 1e305ba..b70f654 100644 (file)
@@ -103,6 +103,14 @@ Features: ~A"
 ;;  `(progn
 ;;     ,@body))
 
+(defun screen-width ()
+  ;;(xlib:screen-width *screen*))
+  (x-drawable-width *root*))
+
+(defun screen-height ()
+  ;;(xlib:screen-height *screen*))
+  (x-drawable-height *root*))
+
 
 
 (defmacro with-x-pointer (&body body)