diff options
author | infirit <[email protected]> | 2014-07-28 15:42:14 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-28 15:42:14 +0200 |
commit | 9bc2242b445893389e0cc01f7377b522268edb29 (patch) | |
tree | a4b30996f7e11a5c63da5df9036450cc750d1ed2 /src/eom-scroll-view.c | |
parent | f5ae31fe150db149a07be9ca8d4e2048f85d5a4b (diff) | |
download | eom-9bc2242b445893389e0cc01f7377b522268edb29.tar.bz2 eom-9bc2242b445893389e0cc01f7377b522268edb29.tar.xz |
Make sure EomScrollView's adjustment values are always correctly set
Ensures one can only scroll as far as necessary. If one scrolled to far
the images's last line/column was used for padding.
Eog bug https://bugzilla.gnome.org/show_bug.cgi?id=631710
Based one eog commit b21dd56b9437e53b7ba8abdd96942c1871edc02c
From Felix Riemann <[email protected]>
Diffstat (limited to 'src/eom-scroll-view.c')
-rw-r--r-- | src/eom-scroll-view.c | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index 7aa9c9c..86541eb 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -314,9 +314,8 @@ update_scrollbar_values (EomScrollView *view) { EomScrollViewPrivate *priv; int scaled_width, scaled_height; - int xofs, yofs; gdouble page_size,page_increment,step_increment; - gdouble lower, upper, value; + gdouble lower, upper; GtkAllocation allocation; priv = view->priv; @@ -338,26 +337,19 @@ update_scrollbar_values (EomScrollView *view) /* Set scroll bounds and new offsets */ lower = 0; upper = scaled_width; - xofs = CLAMP (priv->xofs, 0, upper - page_size); + priv->xofs = CLAMP (priv->xofs, 0, upper - page_size); - if (gtk_adjustment_get_value (priv->hadj) != xofs - || gtk_adjustment_get_page_size (priv->hadj) != page_size) { - value = xofs; - priv->xofs = xofs; + g_signal_handlers_block_matched ( + priv->hadj, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, view); - g_signal_handlers_block_matched ( - priv->hadj, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, view); + gtk_adjustment_configure (priv->hadj, priv->xofs, lower, + upper, step_increment, + page_increment, page_size); - gtk_adjustment_configure (priv->hadj, value, lower, - upper, step_increment, - page_increment, page_size); - - g_signal_handlers_unblock_matched ( - priv->hadj, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, view); - } - } + g_signal_handlers_unblock_matched ( + priv->hadj, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, view); if (gtk_widget_get_visible (GTK_WIDGET (priv->vbar))) { page_size = MIN (scaled_height, allocation.height); @@ -366,24 +358,19 @@ update_scrollbar_values (EomScrollView *view) lower = 0; upper = scaled_height; - yofs = CLAMP (priv->yofs, 0, upper - page_size); - - if (gtk_adjustment_get_value (priv->vadj) != yofs - || gtk_adjustment_get_page_size (priv->vadj) != page_size) { - value = yofs; - priv->yofs = yofs; + priv->yofs = CLAMP (priv->yofs, 0, upper - page_size); - g_signal_handlers_block_matched ( - priv->vadj, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, view); + g_signal_handlers_block_matched ( + priv->vadj, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, view); - gtk_adjustment_configure (priv->vadj, value, lower, - upper, step_increment, - page_increment, page_size); + gtk_adjustment_configure (priv->vadj, priv->yofs, lower, + upper, step_increment, + page_increment, page_size); - g_signal_handlers_unblock_matched ( - priv->vadj, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, view); + g_signal_handlers_unblock_matched ( + priv->vadj, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, view); } } } |