From cd381c813dc63ae694e94af1e40be993bfee2176 Mon Sep 17 00:00:00 2001 From: Marwan Tanager Date: Wed, 27 Mar 2013 11:28:47 +0200 Subject: [PATCH] Don't set visibility, update view time, or lookup the cache, if the page is already visible. 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. Signed-off-by: Sebastian Ramacher --- 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(¢er, &page_rect, NULL) == TRUE) { zathura_document_set_current_page_number(zathura->document, page_id);