Hello list, This is my first patch being sent here. I found a bug, which manifests itself when one presses 'a'. The bugtracker has a bug (#0000226) on related issue, but it's not exactly the same.
Cheers, Ignas A.
>From 7ca6f8ba30c7dd55dbb3c0e3f1dd5b9ab48668f9 Mon Sep 17 00:00:00 2001 From: "Ignas Anikevicius (gns_ank)" <[email protected]> Date: Mon, 16 Jul 2012 21:22:54 +0100 Subject: [PATCH] Fix BESTFIT to work well when pages-per-row > 1. There are two causes of the problem: - page_ratio should be defined differently This is because the usefull page ratio is max_height/total_width or max_width/total_height. This then changes accordingly if pages_per_row != 1, otherwise, if the pages are of the same size, the page ratios will not change, which screws up the resizing. - Sometimes we need to do height or width division diferently. This is because not always total_height or total_width is meaningful in BESTFIT condition. This commit also should fix the bug #0000226. Signed-off-by: Ignas Anikevicius (gns_ank) <[email protected]> --- shortcuts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shortcuts.c b/shortcuts.c index dc57d91..7986738 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -122,11 +122,11 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, } unsigned int rotation = zathura_document_get_rotation(zathura->document); - double page_ratio = total_height / total_width; + double page_ratio = max_height / total_width; double window_ratio = height / width; if (rotation == 90 || rotation == 270) { - page_ratio = total_width / total_height; + page_ratio = max_width / total_height; } switch (argument->n) { @@ -142,13 +142,13 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, if (page_ratio < window_ratio) { zathura_document_set_scale(zathura->document, width / total_width); } else { - zathura_document_set_scale(zathura->document, height / total_height); + zathura_document_set_scale(zathura->document, height / max_height); } } else { if (page_ratio < window_ratio) { zathura_document_set_scale(zathura->document, width / total_height); } else { - zathura_document_set_scale(zathura->document, height / total_width); + zathura_document_set_scale(zathura->document, height / max_width); } } break; -- 1.7.11.2
_______________________________________________ zathura mailing list [email protected] http://lists.pwmt.org/mailman/listinfo/zathura
