diff --git a/shortcuts.c b/shortcuts.c index 288fad9..1dcd9db 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -648,10 +648,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument, return true; } - GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); - GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); - double x = zathura_adjustment_get_ratio(hadj); - double y = zathura_adjustment_get_ratio(vadj); + double x = zathura_document_get_position_x(zathura->document); + double y = zathura_document_get_position_y(zathura->document); + zathura_jump_t* jump = NULL; zathura_jump_t* prev_jump = zathura_jumplist_current(zathura); bool go_to_current = false; @@ -691,11 +690,9 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument, } if (jump != NULL) { - zathura_adjustment_set_value_from_ratio(hadj, jump->x); - zathura_adjustment_set_value_from_ratio(vadj, jump->y); - zathura_document_set_current_page_number(zathura->document, jump->page); - statusbar_page_number_update(zathura); -} + page_set(zathura, jump->page); + position_set(zathura, jump->x, jump->y); + } return false; } diff --git a/zathura.c b/zathura.c index 0a63b10..d264076 100644 --- a/zathura.c +++ b/zathura.c @@ -1426,12 +1426,12 @@ zathura_jumplist_trim(zathura_t* zathura) void zathura_jumplist_add(zathura_t* zathura) { - g_return_if_fail(zathura != NULL && zathura->jumplist.list != NULL); + g_return_if_fail(zathura != NULL && zathura->document != NULL && zathura->jumplist.list != NULL); zathura_jumplist_hide_inputbar(zathura); unsigned int pagenum = zathura_document_get_current_page_number(zathura->document); - double x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); - double y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); + double x = zathura_document_get_position_x(zathura->document); + double y = zathura_document_get_position_y(zathura->document); if (zathura->jumplist.size != 0) { zathura_jumplist_reset_current(zathura); @@ -1480,7 +1480,7 @@ zathura_jumplist_load(zathura_t* zathura, const char* file) static void zathura_jumplist_save(zathura_t* zathura) { - g_return_if_fail(zathura != NULL); + g_return_if_fail(zathura != NULL && zathura->document != NULL); zathura_jump_t* cur = zathura_jumplist_current(zathura); @@ -1488,7 +1488,7 @@ zathura_jumplist_save(zathura_t* zathura) if (cur) { cur->page = pagenum; - cur->x = zathura_adjustment_get_ratio(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); - cur->y = zathura_adjustment_get_ratio(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view))); + cur->x = zathura_document_get_position_x(zathura->document); + cur->y = zathura_document_get_position_y(zathura->document); } }