From 90182e55d0f14b7f4fa7896343210ee50e294eac Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Mon, 21 Jun 2010 16:27:38 +0200 Subject: [PATCH] Restore adjustment after reloading the document --- zathura.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zathura.c b/zathura.c index dc3433d..cc9ded5 100644 --- a/zathura.c +++ b/zathura.c @@ -1791,6 +1791,9 @@ sc_reload(Argument* argument) { draw(Zathura.PDF.page_number); + GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment(Zathura.UI.view); + GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment(Zathura.UI.view); + /* save old information */ g_static_mutex_lock(&(Zathura.Lock.pdf_obj_lock)); char* path = Zathura.PDF.file ? strdup(Zathura.PDF.file) : NULL; @@ -1798,14 +1801,20 @@ sc_reload(Argument* argument) int scale = Zathura.PDF.scale; int page = Zathura.PDF.page_number; int rotate = Zathura.PDF.rotate; + gdouble va = gtk_adjustment_get_value(vadjustment); + gdouble ha = gtk_adjustment_get_value(hadjustment); g_static_mutex_unlock(&(Zathura.Lock.pdf_obj_lock)); /* reopen and restore settings */ close_file(TRUE); open_file(path, password); + g_static_mutex_lock(&(Zathura.Lock.pdf_obj_lock)); Zathura.PDF.scale = scale; Zathura.PDF.rotate = rotate; + gtk_adjustment_set_value(vadjustment, va); + gtk_adjustment_set_value(hadjustment, ha); + g_static_mutex_unlock(&(Zathura.Lock.pdf_obj_lock)); draw(page);