Re: [Sawfish] Pager still not working

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Thanks, I've just commited the fix.

Attached is a diff.

Regards,
Chris

On Thu, 15 Mar 2012 00:20:50 +0100, womble@xxxxxxxxx wrote:
Funnily enough I hit a similar bug just a few days ago, maybe it even
is the same one.

I was playing with X inside X and used a root window with rather
non-standard dimensions. Now it seems that sawfish assumes that the root
window is an exact multiple of the size of its pager.  If not, some
functions which expect an integer, get a float value instead, which triggers
an error.

Sawfish communicates with its pager through code in pager.jl.
There is a macro 'scale', shown below

  ;; This is just to scale the window co-ords and dimensions.
  (define-macro (scale val #!optional x up)
     ....
     `(round (/ (* ,val (screen-width)) vp-width))
     ...)

Normally the result of that 'round' operation should be an int, but
it depends:
   (round (/ 8 4))
   --> 2
however
   (round (/ 7 4))
   --> 2.  ;; note the trailing dot, its a float
diff --git a/pager.jl b/pager.jl
index a4dc058..860e989 100644
--- a/pager.jl
+++ b/pager.jl
@@ -256,11 +256,11 @@ workspace, viewport or none."
   (define-macro (scale val #!optional x up)
     (if x
 	(if up
-	    `(round (/ (* ,val (screen-width)) vp-width))
-	  `(round (/ (* ,val vp-width) (screen-width))))
+	    `(inexact->exact (round (/ (* ,val (screen-width)) vp-width)))
+	  `(inexact->exact (round (/ (* ,val vp-width) (screen-width)))))
       (if up
-	  `(round (/ (* ,val (screen-height)) vp-height))
-	`(round (/ (* ,val vp-height) (screen-height))))))
+	  `(inexact->exact (round (/ (* ,val (screen-height)) vp-height)))
+	`(inexact->exact (round (/ (* ,val vp-height) (screen-height)))))))
 
   (define (get-window-info w)
     (if (or (not (window-id w))


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/