diff --git a/marks.c b/marks.c index 1e65259..84e67f2 100644 --- a/marks.c +++ b/marks.c @@ -237,7 +237,7 @@ mark_evaluate(zathura_t* zathura, int key) if (mark != NULL && mark->key == key) { double old_scale = zathura_document_get_scale(zathura->document); zathura_document_set_scale(zathura->document, mark->scale); - readjust_view_after_zooming(zathura, old_scale); + readjust_view_after_zooming(zathura, old_scale, true); render_all(zathura); position_set_delayed(zathura, mark->position_x, mark->position_y); diff --git a/shortcuts.c b/shortcuts.c index c19cdeb..50edc16 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -154,7 +154,7 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument, } /* keep position */ - readjust_view_after_zooming(zathura, old_zoom); + readjust_view_after_zooming(zathura, old_zoom, false); /* re-render all pages */ render_all(zathura); @@ -1007,7 +1007,7 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t* } /* keep position */ - readjust_view_after_zooming(zathura, old_zoom); + readjust_view_after_zooming(zathura, old_zoom, true); render_all(zathura); diff --git a/utils.c b/utils.c index 135861f..6323fe3 100644 --- a/utils.c +++ b/utils.c @@ -312,7 +312,7 @@ zathura_page_get_widget(zathura_t* zathura, zathura_page_t* page) } void -readjust_view_after_zooming(zathura_t *zathura, float old_zoom) { +readjust_view_after_zooming(zathura_t *zathura, float old_zoom, bool delay) { if (zathura == NULL || zathura->document == NULL) { return; } @@ -325,7 +325,12 @@ readjust_view_after_zooming(zathura_t *zathura, float old_zoom) { gdouble valx = gtk_adjustment_get_value(hadjustment) / old_zoom * scale; gdouble valy = gtk_adjustment_get_value(vadjustment) / old_zoom * scale; - position_set_delayed(zathura, valx, valy); + if (delay == true) { + position_set_delayed(zathura, valx, valy); + } else { + set_adjustment(vadjustment, valx); + set_adjustment(vadjustment, valy); + } } void diff --git a/utils.h b/utils.h index 504c7e2..a13c832 100644 --- a/utils.h +++ b/utils.h @@ -119,8 +119,9 @@ GtkWidget* zathura_page_get_widget(zathura_t* zathura, zathura_page_t* page); * * @param zathura Zathura instance * @param old_zoom Old zoom value + * @param delay true if action should be delayed */ -void readjust_view_after_zooming(zathura_t* zathura, float old_zoom); +void readjust_view_after_zooming(zathura_t* zathura, float old_zoom, bool delay); /** * Set if the search results should be drawn or not