This also has the side effect of not flooding the console with debug messages 
on every change of the vertical adjustment as a result of redundant cache 
lookups.

---
 callbacks.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/callbacks.c b/callbacks.c
index b4242d6..124837c 100644
--- a/callbacks.c
+++ b/callbacks.c
@@ -94,9 +94,11 @@ cb_view_vadjustment_value_changed(GtkAdjustment* 
GIRARA_UNUSED(adjustment), gpoi
                                      zathura->ui.session->gtk.view, 0, 0, 
&page_rect.x, &page_rect.y);
 
     if (gdk_rectangle_intersect(&view_rect, &page_rect, NULL) == TRUE) {
-      zathura_page_set_visibility(page, true);
-      zathura_page_widget_update_view_time(ZATHURA_PAGE(page_widget));
-      zathura_page_cache_add(zathura, zathura_page_get_index(page));
+      if (zathura_page_get_visibility(page) == false) {
+       zathura_page_set_visibility(page, true);
+       zathura_page_widget_update_view_time(ZATHURA_PAGE(page_widget));
+       zathura_page_cache_add(zathura, zathura_page_get_index(page));
+      }
       if (zathura->global.update_page_number == true && updated == false
           && gdk_rectangle_intersect(&center, &page_rect, NULL) == TRUE) {
         zathura_document_set_current_page_number(zathura->document, page_id);
-- 
1.7.10.4

_______________________________________________
zathura mailing list
zathura@lists.pwmt.org
http://lists.pwmt.org/mailman/listinfo/zathura

Reply via email to