[gthumb] fixed scrollbars resetting their position when changing image



commit 084bb004b1f042d429680a9aa9c72ad623dd4c8d
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Aug 13 16:09:37 2016 +0200

    fixed scrollbars resetting their position when changing image

 gthumb/gth-image-viewer.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index e9410fd..ca3199b 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -710,10 +710,12 @@ gth_image_viewer_size_allocate (GtkWidget     *widget,
 
        /* Keep the scrollbars offset in a valid range */
 
-       _gth_image_viewer_get_zoomed_size (self, &zoomed_width, &zoomed_height);
        current_image = gth_image_viewer_get_current_image (self);
-       self->visible_area.x = (current_image == NULL || zoomed_width <= self->visible_area.width) ? 0 : 
CLAMP (self->visible_area.x, 0, zoomed_width - self->visible_area.width);
-       self->visible_area.y = (current_image == NULL || zoomed_height <= self->visible_area.height) ? 0 : 
CLAMP (self->visible_area.y, 0, zoomed_height - self->visible_area.height);
+       if (current_image != NULL) {
+               _gth_image_viewer_get_zoomed_size (self, &zoomed_width, &zoomed_height);
+               self->visible_area.x = (zoomed_width <= self->visible_area.width) ? 0 : CLAMP 
(self->visible_area.x, 0, zoomed_width - self->visible_area.width);
+               self->visible_area.y = (zoomed_height <= self->visible_area.height) ? 0 : CLAMP 
(self->visible_area.y, 0, zoomed_height - self->visible_area.height);
+       }
 
        _gth_image_viewer_configure_hadjustment (self);
        _gth_image_viewer_configure_vadjustment (self);


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