Show correct page after leaving fullscreen mode

Fixes #220
This commit is contained in:
Moritz Lipp 2012-06-17 00:20:34 +02:00
parent dd99eca7c5
commit 8e1cf395a5
4 changed files with 12 additions and 6 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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