[sawfish: 2/9] `viewport-offset' is renamed to `viewport-offset-pixel'.



commit c0a60f6c6b381a2e5c1abd05ee66b5e5b12eedab
Author: Teika kazura <teika lavabit com>
Date:   Sun Nov 15 18:21:50 2009 +0900

    `viewport-offset' is renamed to `viewport-offset-pixel'.

 lisp/sawfish/wm/ext/match-window.jl |    2 +-
 lisp/sawfish/wm/state/maximize.jl   |    6 +++---
 lisp/sawfish/wm/util/edges.jl       |    2 +-
 lisp/sawfish/wm/viewport.jl         |   26 ++++++++++++--------------
 man/sawfish.texi                    |   19 +++++++++----------
 5 files changed, 26 insertions(+), 29 deletions(-)
---
diff --git a/lisp/sawfish/wm/ext/match-window.jl b/lisp/sawfish/wm/ext/match-window.jl
index a03a2d1..8230930 100644
--- a/lisp/sawfish/wm/ext/match-window.jl
+++ b/lisp/sawfish/wm/ext/match-window.jl
@@ -352,7 +352,7 @@
     (lambda (w prop value)
       (declare (unused prop))
       (let* ((size (window-frame-dimensions w))
-             (vp-offset (viewport-offset (window-viewport w)))
+             (vp-offset (viewport-offset-pixel (window-viewport w)))
              (x (if (symbolp value)
                     (cond ((memq value '(east south-east north-east))
                            (- (screen-width) (car size)))
diff --git a/lisp/sawfish/wm/state/maximize.jl b/lisp/sawfish/wm/state/maximize.jl
index abf5c44..7341347 100644
--- a/lisp/sawfish/wm/state/maximize.jl
+++ b/lisp/sawfish/wm/state/maximize.jl
@@ -383,7 +383,7 @@ that dimension.")
   ;; does all unmaximizing except for changing the window properties and
   ;; calling the hooks
   (define (unmaximize-window-1 w #!optional direction before)
-    (let ((vp-offset (viewport-offset (window-viewport w)))
+    (let ((vp-offset (viewport-offset-pixel (window-viewport w)))
           (geom (unmaximized-geometry w))
 	  (coords (window-position w))
 	  (dims (window-dimensions w)))
@@ -519,7 +519,7 @@ unmaximized."
     (cond ((and state (not (window-maximized-fullscreen-p w)))
 	   (when (window-maximizable-p w)
              (let* ((viewport (window-viewport w))
-                    (vp-offset (viewport-offset viewport))
+                    (vp-offset (viewport-offset-pixel viewport))
                     (head (window-head-any-viewport w))
                     (head-offset (head-offset head))
                     (head-dims (head-dimensions head)))
@@ -558,7 +558,7 @@ t")
     (cond ((and state (not (window-maximized-fullscreen-p w)))
 	   (when (window-maximizable-p w)
 	     (let ((screen-dims (screen-dimensions))
-                   (vp-offset (viewport-offset (window-viewport w))))
+                   (vp-offset (viewport-offset-pixel (window-viewport w))))
 	       (save-unmaximized-geometry w)
 	       (window-put w 'unmaximized-type (window-type w))
 	       (push-window-type w 'unframed 'sawfish.wm.state.maximize)
diff --git a/lisp/sawfish/wm/util/edges.jl b/lisp/sawfish/wm/util/edges.jl
index 8d01e77..218fac7 100644
--- a/lisp/sawfish/wm/util/edges.jl
+++ b/lisp/sawfish/wm/util/edges.jl
@@ -51,7 +51,7 @@ The returned lists may contain duplicates, and are unsorted."
 
     (let* ((width (screen-width))
            (height (screen-height))
-           (vp-offset (viewport-offset viewport))
+           (vp-offset (viewport-offset-pixel viewport))
            x-edges y-edges)
       (map-windows
        (lambda (w)
diff --git a/lisp/sawfish/wm/viewport.jl b/lisp/sawfish/wm/viewport.jl
index 60b2d4e..f2341c6 100644
--- a/lisp/sawfish/wm/viewport.jl
+++ b/lisp/sawfish/wm/viewport.jl
@@ -33,7 +33,7 @@
 	    move-window-viewport
             viewport-at
 	    window-viewport
-            viewport-offset
+            viewport-offset-pixel
             window-relative-position
 	    window-absolute-position
 	    set-number-of-viewports
@@ -422,7 +422,7 @@ even if the viewport currently exists.  If `viewport' is specified
 check only against that viewport."
     (let ((vp (viewport-at (car rect) (nth 1 rect))))
       (when (or (null viewport) (equal vp viewport))
-        (let ((offset (viewport-offset vp)))
+        (let ((offset (viewport-offset-pixel vp)))
           (rect-wholly-within-rect (list (car offset)
                                          (cdr offset)
                                          (+ (car offset) (screen-width))
@@ -437,7 +437,7 @@ check only against that viewport."
     "Return t if `rect' is entirely within some head on some
 viewport. If `head' is provided `rect' must be within that head on
 some viewport."
-    (let* ((offset (viewport-offset (viewport-at (car rect)
+    (let* ((offset (viewport-offset-pixel (viewport-at (car rect)
                                                  (nth 1 rect))))
            (left (- (car rect) (car offset)))
            (top (- (nth 1 rect) (cdr offset)))
@@ -459,21 +459,19 @@ some viewport."
            (dims (window-dimensions w))
            (center (cons (+ (car coords) (quotient (car dims) 2))
                          (+ (cdr coords) (quotient (cdr dims) 2))))
-           (vp-offset (viewport-offset (viewport-at (car center)
+           (vp-offset (viewport-offset-pixel (viewport-at (car center)
                                                     (cdr center)))))
       (find-head (- (car center) (car vp-offset))
                  (- (cdr center) (cdr vp-offset)))))
 
-  (define (viewport-offset vp)
-    "`vp' is (column . row) of a viewport (whether or not that
-viewport currently exists).  A cons cell consisting of the x and y
-offset between the specified viewport and the current viewport is
-returned.  The offset can be used to translate between locations in
-the two viewports.  For example:
+  (define (viewport-offset-pixel vp)
+    "Returns the offset from the current viewport to viewport `VP'
+which is specified as (column . row). The return value is the cons
+cell (x . y). The values are in pixel, and are negative if it lies at
+left or above the current viewport.
 
-<position in current vp> + <offset> = <equivalent position in other vp>
-
-If `vp' is nil treat it as the current viewport -- i.e., return '(0 . 0)"
+`VP' can be non existent one. If `VP' is nil, it is
+understood as the current viewport, i.e., (0 . 0) will be returned."
     (if (consp vp)
         (let* ((cur-vp (screen-viewport)))
           (cons
@@ -484,7 +482,7 @@ If `vp' is nil treat it as the current viewport -- i.e., return '(0 . 0)"
   (define (window-relative-position w)
     "Returns a cons cell with the coordinates of the window relative
 to the viewport it occupies."
-    (let ((offset (viewport-offset (window-viewport w)))
+    (let ((offset (viewport-offset-pixel (window-viewport w)))
           (coords (window-position w)))
       (cons
        (- (car coords) (car offset))
diff --git a/man/sawfish.texi b/man/sawfish.texi
index b348407..e3e4909 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -4130,16 +4130,15 @@ Returns a cons cell @code{(@var{col} . @var{row})} of the viewport
 holding the top-left corner of @var{window}.
 @end defun
 
- defun viewport-offset vp
- var{vp} is @code{(column . row)} of a viewport (whether or not that
-viewport currently exists).  A cons cell consisting of the x and y
-offset between the specified viewport and the current viewport is
-returned.  The offset can be used to translate between locations in the
-two viewports.  Given a position in the current viewport you can get the
-equivalent position in another viewport by adding the offset, or you can
-go the other way by subtracting the offset.  If @var{vp} is @code{nil}
-it is understood as the current viewport,
-i.e., @code{'(0 . 0)} will be returned.
+ defun viewport-offset-pixel viewport
+Returns the offset from the current viewport to @var{viewport}
+which is specified as @code{(column . row)}. The return value is the
+cons cell @code{(x . y)}. The values are in pixel, and are negative if
+it lies at left or above the current viewport.
+
+ var{viewport} can be non existent one. If @var{viewport} is @code{nil} it
+is understood as the current viewport, i.e., @code{(0 . 0)} will be
+returned.
 @end defun
 
 @defun window-relative-position w



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