Commit 8e1cf395 authored by Moritz Lipp's avatar Moritz Lipp

Show correct page after leaving fullscreen mode

Fixes #220
parent dd99eca7
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment