[Xfce4-commits] <ristretto:master> Improve the scale calculation when doing box_zoom.

Stephan Arts noreply at xfce.org
Mon Aug 8 15:04:25 CEST 2011


Updating branch refs/heads/master
         to 6c5ff39c0777f5bc6cc3d3c603679966c1e42fd5 (commit)
       from 0a18c04760f358f279a63b55de1ee46af69c0ccd (commit)

commit 6c5ff39c0777f5bc6cc3d3c603679966c1e42fd5
Author: Stephan Arts <stephan at xfce.org>
Date:   Fri Aug 5 00:19:48 2011 +0200

    Improve the scale calculation when doing box_zoom.

 src/image_viewer.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/image_viewer.c b/src/image_viewer.c
index bb6b208..2c08972 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -1779,7 +1779,7 @@ cb_rstto_image_viewer_button_release_event (RsttoImageViewer *viewer, GdkEventBu
                          * Calculate the new scale
                          */
                         gdouble scale;
-                        if ((gtk_adjustment_get_page_size(viewer->hadjustment) / box_width) > 
+                        if ((gtk_adjustment_get_page_size(viewer->hadjustment) / box_width) < 
                             (gtk_adjustment_get_page_size(viewer->vadjustment) / box_height))
                         {
                             scale = viewer->priv->scale * (gtk_adjustment_get_page_size(viewer->hadjustment) / box_width);
@@ -1801,14 +1801,15 @@ cb_rstto_image_viewer_button_release_event (RsttoImageViewer *viewer, GdkEventBu
 
                         
                         g_object_freeze_notify(G_OBJECT(viewer->hadjustment));
+                        g_object_freeze_notify(G_OBJECT(viewer->vadjustment));
+
                         gtk_adjustment_set_upper (viewer->hadjustment, (gdouble)width*(viewer->priv->scale/viewer->priv->image_scale));
                         gtk_adjustment_set_value (viewer->hadjustment, (tmp_x * scale - ((gdouble)gtk_adjustment_get_page_size(viewer->hadjustment)/2)));
-                        g_object_thaw_notify(G_OBJECT(viewer->hadjustment));
-
-                        g_object_freeze_notify(G_OBJECT(viewer->vadjustment));
                         gtk_adjustment_set_upper (viewer->vadjustment, (gdouble)height*(viewer->priv->scale/viewer->priv->image_scale));
                         gtk_adjustment_set_value (viewer->vadjustment, (tmp_y * scale - ((gdouble)gtk_adjustment_get_page_size(viewer->vadjustment)/2)));
+
                         g_object_thaw_notify(G_OBJECT(viewer->vadjustment));
+                        g_object_thaw_notify(G_OBJECT(viewer->hadjustment));
 
                         gtk_adjustment_changed(viewer->hadjustment);
                         gtk_adjustment_changed(viewer->vadjustment);


More information about the Xfce4-commits mailing list