Instead of guesstimating the values of the scrollbars adjustments after
a change in zoom level, connect callbacks to the "changed" GtkAdjustment
event (which is emitted when the bounds or page_size of the adjustment
change, e.g. when the zoom level changes), and compute the new values
from there.
The previous adjustment values are tracked in zathura->ui.hadjustment
and zathura->ui.vadjustment (and updated by signal handlers as well), so
that the view's position can be maintained while zooming.
cb_view_hadjustment_changed() centers the page horizontally if a
"best-fit" or "width" zoom is being performed, or if "zoom-center" is
true; otherwise, it keeps the view horizontally centered around the same
area of the page.
cb_view_vadjustment_changed() always keeps the view vertically centered
around the same area of the page.
Many thanks to Marwan Tanager for thoroughly reviewing the various
stages of this patch, and actually coming up with a working solution.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
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 <sebastian+dev@ramacher.at>
Now by default, 'q' quits zathura even in fullscreen mode, and
'BackSpace' does the reverse of 'space', i.e. go back one page.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
If '--page [number]' (or '-P [number]') is given on the command-line,
the document is opened at the specified page number. Negative numbers
are allowed, and denote a page number starting from the end of the
document.
See issue 275 <http://bugs.pwmt.org/issue275>.
Reported-by: bob <sean258@gmail.com>
If we have already requested a page to be rendered, we don't have to request it
once again.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
According to my compiler output and the page on glib deprecated APIs
[1], some of the stuff needed to be removed or changed.
[1] - http://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
Previously it was set to -1, which was essentially disabling the
horizontal scrolling. This enables the scrolling by default by setting
it to be the same as the vertical scrolling.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>