Small optical bug in the pager

Bernhard Walle Bernhard.Walle at gmx.de
Fri Jun 27 10:45:48 CEST 2003


Hello,

On Mon, 23 Jun 2003 at 17:16 (+0200), Bernhard Walle wrote:
> 
> when I maximize a window (horizontally no desktop borders!) then it is
> maximized on the screen but not 100 % maximized in the pager. You have
> to look very carefully.

I looked a bit at the source and it *is* a rounding problem. After
calculating with doubles it is better to round because of arithmetic 
inaccuracy. 

So I write a patch, which solves another problem (double gray line in
small pager), too.

Because I don't see any negative side effects I would appreciate if you
can include this in CVS.


Regards,
Bernhard

-- 
-------------- next part --------------
--- netk-pager.c.orig	Tue May 27 19:02:24 2003
+++ netk-pager.c	Fri Jun 27 10:43:48 2003
@@ -579,10 +579,10 @@
 
     x += netk_workspace_get_viewport_x (workspace);
     y += netk_workspace_get_viewport_y (workspace);
-    x *= width_ratio;
-    y *= height_ratio;
-    width *= width_ratio;
-    height *= height_ratio;
+    x = x * width_ratio + 0.5 /* rounding */;
+    y = y * height_ratio + 0.5 /* rounding */;
+    width = width * width_ratio + 0.5 /* rounding */;
+    height = height * height_ratio + 0.5 /* roudning */;
 
     x += workspace_rect->x;
     y += workspace_rect->y;
@@ -816,12 +816,14 @@
             rect->width / (double) netk_workspace_get_width (active_space);
         height_ratio =
             rect->height / (double) netk_workspace_get_height (active_space);
-        vx = rect->x +
+        vx = 0.5 /* rounding */ + rect->x +
             width_ratio * netk_workspace_get_viewport_x (active_space);
-        vy = rect->y +
+        vy = 0.5 /* rounding */ + rect->y +
             height_ratio * netk_workspace_get_viewport_y (active_space);
-        vw = width_ratio * netk_screen_get_width (pager->priv->screen);
-        vh = height_ratio * netk_screen_get_height (pager->priv->screen);
+        vw = 0.5 /* rounding */ +
+            width_ratio * netk_screen_get_width (pager->priv->screen);
+        vh = 0.5 /* rounding */ +
+            height_ratio * netk_screen_get_height (pager->priv->screen);
 
         gdk_draw_rectangle (GTK_WIDGET (pager)->window,
                             prelight ?


More information about the Xfce4-dev mailing list