[sawfish] Fixed gnome-pager/viewport bug.



commit 3266d046c58bc3bd976c2677d381c03e59c6fe71
Author: Jeremy Hankins <nowan nowan org>
Date:   Sun Jan 3 09:12:23 2010 -0600

    Fixed gnome-pager/viewport bug.
    
     * gnome-pager got confused when displaying multiple desktops about the
       viewport layout of non-active desktops; this should be fixed now.
    
     * The workspace-viewport-data variable in sawfish.wm.viewport now
       follows the x,y convention rather than y,x; hopefully preventing
       silly and hard-to-track-down screw-ups....

 ChangeLog                        |    6 ++++++
 lisp/sawfish/wm/state/wm-spec.jl |   21 ++++++++++++++++++---
 lisp/sawfish/wm/viewport.jl      |   32 ++++++++++++++++----------------
 3 files changed, 40 insertions(+), 19 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fcddb50..e26a973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,12 @@
 	* sawfish.ebuild.in: remove audiofile/esound
 	                     missing `fi' added
 
+2010-01-03  Jeremy Hankins <nowan nowan org>
+	* lisp/sawfish/wm/state/wm-spec.jl
+	* lisp/sawfish/wm/viewport.jl: Fixed bug where gnome-pager gets
+		  confused about the viewport when displaying all
+		  workspaces.
+
 2010-01-02  Christopher Bratusek <zanghar freenet de>
 	* po/Makefile.in: don't remove sawfish.pot upon distclean
 
diff --git a/lisp/sawfish/wm/state/wm-spec.jl b/lisp/sawfish/wm/state/wm-spec.jl
index 3ed1853..db9f101 100644
--- a/lisp/sawfish/wm/state/wm-spec.jl
+++ b/lisp/sawfish/wm/state/wm-spec.jl
@@ -170,7 +170,16 @@
   (define (update-workspace-hints)
     (let* ((limits (workspace-limits))
 	   (port (screen-viewport))
-	   (port-size viewport-dimensions)
+           ;; Since vp size can vary from workspace to workspace, use
+           ;; the maximum dimensions accross all workspaces.
+	   (port-size (let ((dims (cons viewport-dimensions
+                                        (mapcar (lambda (e)
+                                                  (unless (eq (car e)
+                                                              current-workspace)
+                                                    (nth 3 e)))
+                                                workspace-viewport-data))))
+                        (cons (apply max (mapcar car dims))
+                              (apply max (mapcar cdr dims)))))
 	   (total-workspaces (1+ (- (cdr limits) (car limits))))
 	   (workarea (make-vector (* 4 total-workspaces)))
 	   (showing-desktop (showing-desktop-p)))
@@ -211,8 +220,14 @@
                  (if (= i total-workspaces)
                      (set-x-property 'root '_NET_DESKTOP_VIEWPORT
                                      view 'CARDINAL 32)
-                   (aset view (* i 2) (* (car port) (screen-width)))
-                   (aset view (1+ (* i 2)) (* (cdr port) (screen-height)))
+                   (if (eq i current-workspace)
+                       (progn
+                         (aset view (* i 2) (* (car port) (screen-width)))
+                         (aset view (1+ (* i 2)) (* (cdr port)
+                                                    (screen-height))))
+                     (let ((vp-data (cdr (assoc i workspace-viewport-data))))
+                       (aset view (* i 2) (car vp-data))
+                       (aset view (1+ (* i 2)) (nth 1 vp-data))))
                    (loop (1+ i))))))
 
 	;; _NET_WORKAREA
diff --git a/lisp/sawfish/wm/viewport.jl b/lisp/sawfish/wm/viewport.jl
index 526efdc..41a9f76 100644
--- a/lisp/sawfish/wm/viewport.jl
+++ b/lisp/sawfish/wm/viewport.jl
@@ -246,8 +246,8 @@ well as any windows in the current workspace."
     "On leaving a workspace, store information about the viewport
 configuration so that it can be restored properly later.
 `WS' is the workspace to leave."
-    (let ((vp-data (list viewport-y-offset
-                         viewport-x-offset
+    (let ((vp-data (list viewport-x-offset
+                         viewport-y-offset
                          viewport-dimensions))
           (old-ent (assoc ws workspace-viewport-data)))
       (if old-ent
@@ -265,24 +265,24 @@ When `viewport-boundary-mode' is not `dynamic', make sure that the new
 viewport is within `viewport-dimensions'."
     (let ((vp-data (cdr (assoc ws workspace-viewport-data))))
       (if vp-data
-          (let ((maybe-y-offset (car vp-data))
-                (maybe-x-offset (nth 1 vp-data)))
+          (let ((maybe-x-offset (car vp-data))
+                (maybe-y-offset (nth 1 vp-data)))
             (if (eq viewport-boundary-mode 'dynamic)
                 (setq viewport-dimensions (nth 2 vp-data)
-                      viewport-y-offset maybe-y-offset
-                      viewport-x-offset maybe-x-offset)
+                      viewport-x-offset maybe-x-offset
+                      viewport-y-offset maybe-y-offset)
               ;; Do maybe-y-offset and maybe-x-offset fit within
               ;; current viewport-dimensions?
-              (if (and (<= maybe-y-offset
-                           (* (1- (car viewport-dimensions)) (screen-height)))
-                       (<= maybe-x-offset
-                           (* (1- (cdr viewport-dimensions)) (screen-width))))
-                  (setq viewport-y-offset maybe-y-offset
-                        viewport-x-offset maybe-x-offset)
-                (setq viewport-y-offset 0
-                      viewport-x-offset 0))))
-        (setq viewport-y-offset 0
-              viewport-x-offset 0))
+              (if (and (<= maybe-x-offset
+                           (* (1- (cdr viewport-dimensions)) (screen-width)))
+                       (<= maybe-y-offset
+                           (* (1- (car viewport-dimensions)) (screen-height))))
+                  (setq viewport-x-offset maybe-x-offset
+                        viewport-y-offset maybe-y-offset)
+                (setq viewport-x-offset 0
+                      viewport-y-offset 0))))
+        (setq viewport-x-offset 0
+              viewport-y-offset 0))
       (viewport-size-changed)))
 
   (add-hook 'enter-workspace-hook



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]