From f5b02a9751510b6133238cb6a79ee9a39298bcbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Wed, 20 Mar 2013 23:03:54 +0000 Subject: [PATCH] Revert commit ce6e735 This wasn't correct. Padding is already accounted for: scale = (width - (pages_per_row - 1) * padding) / (pages_per_row * cell_width) If you add padding on the denominator, you end up with black margins on the sides of the window, which isn't what padding is for (i.e. insert a gap between rendered pages), and defeats the purpose of a "best-fit". Signed-off-by: Sebastian Ramacher --- shortcuts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shortcuts.c b/shortcuts.c index a3348af..6974d48 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -144,7 +144,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, if (argument->n == ZATHURA_ADJUST_WIDTH || (argument->n == ZATHURA_ADJUST_BESTFIT && page_ratio < window_ratio)) { scale = (double)(width - (pages_per_row - 1) * padding) / - (double)(pages_per_row * cell_width + (pages_per_row - 1) * padding); + (double)(pages_per_row * cell_width); zathura_document_set_scale(zathura->document, scale); bool show_scrollbars = false; @@ -165,7 +165,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, if (0 < requisition.width && (unsigned)requisition.width < width) { width -= requisition.width; scale = (double)(width - (pages_per_row - 1) * padding) / - (double)(pages_per_row * cell_width + (pages_per_row - 1) * padding); + (double)(pages_per_row * cell_width); zathura_document_set_scale(zathura->document, scale); } }