From 9b5dceac17df3badc99365e273122994106d3dbb Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Sun, 6 Nov 2016 18:40:55 +0100 Subject: [PATCH] Debug output for sc_zoom Signed-off-by: Sebastian Ramacher --- zathura/shortcuts.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zathura/shortcuts.c b/zathura/shortcuts.c index a3f5cdd..7020586 100644 --- a/zathura/shortcuts.c +++ b/zathura/shortcuts.c @@ -1375,19 +1375,25 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* /* specify new zoom value */ if (argument->n == ZOOM_IN) { + girara_debug("Increasing zoom by %f.", zoom_step - 1.0); zathura_document_set_scale(zathura->document, old_zoom * zoom_step); } else if (argument->n == ZOOM_OUT) { + girara_debug("Decreasing zoom by %f.", zoom_step - 1.0); zathura_document_set_scale(zathura->document, old_zoom / zoom_step); } else if (argument->n == ZOOM_SPECIFIC) { if (t == 0) { + girara_debug("Setting zoom to 1."); zathura_document_set_scale(zathura->document, 1.0); } else { + girara_debug("Setting zoom to %f.", t / 100.0); zathura_document_set_scale(zathura->document, t / 100.0); } } else if (argument->n == ZOOM_SMOOTH) { - const double dy = (event != NULL) ? event->y : 1.0; - zathura_document_set_scale(zathura->document, old_zoom + zoom_step * dy); + const double dy = (event != NULL) ? event->y : 1.0; + girara_debug("Increasing zoom by %f.", zoom_step * dy - 1.0); + zathura_document_set_scale(zathura->document, old_zoom + zoom_step * dy); } else { + girara_debug("Setting zoom to 1."); zathura_document_set_scale(zathura->document, 1.0); } @@ -1397,9 +1403,11 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* const double new_zoom = zathura_document_get_scale(zathura->document); if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) { + girara_debug("New and old zoom level are too close: %f vs. %f, diff = %f", new_zoom, old_zoom, fabs(new_zoom - old_zoom)); return false; } + girara_debug("Re-rendering with new zoom level %f.", new_zoom); render_all(zathura); refresh_view(zathura);