[clfswm-cvs] [clfswm-git]CLFSWM - A(nother) Common Lisp FullScreen Window Manager branch test updated. R-1106-36-gbf200cb

Philippe Brochard pbrochard at common-lisp.net
Tue May 8 22:36:40 UTC 2012


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, test has been updated
       via  bf200cb2092db5bfa72076914fdc9d3a8ceb07c0 (commit)
      from  9ef2d64b8604f31de5f629eafb870502ee9f493a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bf200cb2092db5bfa72076914fdc9d3a8ceb07c0
Author: Philippe Brochard <pbrochard at common-lisp.net>
Date:   Wed May 9 00:36:30 2012 +0200

    src/clfswm-internal.lisp: Use xdpyinfo/xinerama informations instead of xrandr informations.

diff --git a/ChangeLog b/ChangeLog
index dfbca59..9d0f0d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-09  Philippe Brochard  <pbrochard at common-lisp.net>
+
+	* src/clfswm-internal.lisp: Use xdpyinfo/xinerama informations
+	instead of xrandr informations.
+
 2012-05-06  Philippe Brochard  <pbrochard at common-lisp.net>
 
 	* src/clfswm-internal.lisp : Use only one list for root
diff --git a/src/clfswm-internal.lisp b/src/clfswm-internal.lisp
index e8b380a..f270463 100644
--- a/src/clfswm-internal.lisp
+++ b/src/clfswm-internal.lisp
@@ -624,6 +624,11 @@
   (defun define-as-root (child x y width height)
     (push (make-root :child child :original child :current-child nil :x x :y y :w width :h height) root-list))
 
+  (defun unsure-at-least-one-root ()
+    (unless root-list
+      (define-as-root *root-frame* (- *border-size*) (- *border-size*)
+                      (xlib:screen-width *screen*) (xlib:screen-height *screen*))))
+
   (defun find-root-by-coordinates (x y)
     (dolist (root root-list)
       (when (in-rect x y (root-x root) (root-y root) (root-w root) (root-h root))
@@ -663,35 +668,36 @@
 
 
 ;;; Multiple physical screen helper
-(defun get-xrandr-connected-size ()
-  (let ((output (do-shell "xrandr"))
-        (sizes '()))
-    (loop for line = (read-line output nil nil)
-       while line
-       do
-         (awhen (search " connected " line)
-           (incf it (length " connected "))
-           (destructuring-bind (w h x y)
-               (mapcar #'parse-integer
-                       (split-string (substitute #\space #\x
-                                                 (substitute #\space #\+
-                                                             (subseq line it (position #\space line :start it))))))
-             (push (list (- x *border-size*) (- y *border-size*) w h) sizes))))
-    (dbg sizes)
-    sizes))
-    ;;'((10 10 500 300) (520 20 480 300) (310 330 600 250))))  ;;; For test
-
-(defun add-placed-frame-tmp (frame n)
+(defun add-placed-frame-tmp (frame n)   ;; For test
   (add-frame (create-frame :x 0.01 :y 0.01 :w 0.4 :h 0.4) frame)
   (add-frame (create-frame :x 0.55 :y 0.01 :w 0.4 :h 0.4) frame)
   (add-frame (create-frame :x 0.03 :y 0.5 :w 0.64 :h 0.44) frame)
   (when (plusp n)
     (add-placed-frame-tmp (first (frame-child frame)) (1- n))))
 
-
-(defun place-frames-from-xrandr ()
-  "Place frames according to xrandr informations"
-  (let ((sizes (get-xrandr-connected-size))
+(defun parse-xinerama-info (line)
+  (remove nil
+          (mapcar (lambda (string)
+                    (parse-integer string :junk-allowed t))
+                  (split-string (substitute #\space #\x (substitute #\space #\, line))))))
+
+(defun get-connected-heads-size ()
+  (when (xlib:query-extension *display* "XINERAMA")
+    (let ((output (do-shell "xdpyinfo -ext XINERAMA"))
+          (sizes '()))
+      (loop for line = (read-line output nil nil)
+         while line
+         do (when (search " head " line)
+              (destructuring-bind (w h x y)
+                  (parse-xinerama-info line)
+                (push (list (- x *border-size*) (- y *border-size*) w h) sizes))))
+      (remove-duplicates sizes :test #'equal))))
+  ;;'((10 10 500 300) (520 20 480 300) (310 330 600 250))))  ;;; For test
+
+
+(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*)))
     ;;(add-placed-frame-tmp (first (frame-child *root-frame*)) 2)
@@ -700,9 +706,8 @@
         (progn
           (loop while (< (length (frame-child *root-frame*)) (length sizes))
              do (let ((frame (create-frame)))
-                  (add-frame frame *root-frame*)
                   ;;(add-placed-frame-tmp frame 2)))
-                  ))
+                  (add-frame frame *root-frame*)))
           (loop for size in sizes
              for frame in (frame-child *root-frame*)
              do (destructuring-bind (x y w h) size
diff --git a/src/clfswm.lisp b/src/clfswm.lisp
index ff978fd..acb0a47 100644
--- a/src/clfswm.lisp
+++ b/src/clfswm.lisp
@@ -218,6 +218,7 @@
         *current-root* *root-frame*  ;;; PHIL: TO REMOVE
 	*current-child* *root-frame*)
   (call-hook *init-hook*)
+  (unsure-at-least-one-root)
   (process-existing-windows *screen*)
   (show-all-children)
   (grab-main-keys)
diff --git a/src/config.lisp b/src/config.lisp
index 253b037..1db5f51 100644
--- a/src/config.lisp
+++ b/src/config.lisp
@@ -159,7 +159,9 @@ This command must set the window title to *clfswm-terminal-name*")
 ;;;
 ;;; See clfswm.lisp for hooks examples.
 
-(defconfig *init-hook* '(default-init-hook place-frames-from-xrandr display-hello-window)
+(defconfig *init-hook* '(default-init-hook
+                         place-frames-from-xinerama-infos
+                         display-hello-window)
   'Hook "Init hook. This hook is run just after the first root frame is created")
 
 (defconfig *close-hook* '(close-notify-window close-clfswm-terminal close-virtual-keyboard)

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

Summary of changes:
 ChangeLog                |    5 ++++
 src/clfswm-internal.lisp |   55 +++++++++++++++++++++++++---------------------
 src/clfswm.lisp          |    1 +
 src/config.lisp          |    4 ++-
 4 files changed, 39 insertions(+), 26 deletions(-)


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




More information about the clfswm-cvs mailing list