mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-14 22:06:00 +01:00
use the new document functions for the jumplist
And get rid of explicit gtk calls to the adjustment
This commit is contained in:
parent
6ca81e3716
commit
4a75efd4f2
2 changed files with 12 additions and 15 deletions
15
shortcuts.c
15
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;
|
||||
}
|
||||
|
|
12
zathura.c
12
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue