diff --git a/zathura.c b/zathura.c index a82fb55..a858b1c 100644 --- a/zathura.c +++ b/zathura.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -1145,6 +1146,25 @@ position_set(zathura_t* zathura, double position_x, double position_y) } } +static void +zathura_jumplist_hide_inputbar(zathura_t* zathura) +{ + g_return_if_fail(zathura != NULL && zathura->ui.session->gtk.inputbar != NULL); + + girara_argument_t arg = { GIRARA_HIDE, NULL }; + girara_isc_completion(zathura->ui.session, &arg, NULL, 0); + + if (zathura->ui.session->global.autohide_inputbar == true) { + gtk_widget_hide(zathura->ui.session->gtk.inputbar); + } + + /* we want to do it immediately */ + + while (gtk_events_pending()) { + gtk_main_iteration(); + } +} + bool zathura_jumplist_has_previous(zathura_t* zathura) { @@ -1231,29 +1251,31 @@ zathura_jumplist_append_jump(zathura_t* zathura) void zathura_jumplist_add(zathura_t* zathura) { - if (zathura->jumplist.list != NULL) { + g_return_if_fail(zathura != 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))); + 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))); - zathura_jumplist_reset_current(zathura); + zathura_jumplist_reset_current(zathura); - zathura_jump_t* cur = zathura_jumplist_current(zathura); + zathura_jump_t* cur = zathura_jumplist_current(zathura); - if (cur && cur->page == pagenum && cur->x == x && cur->y == y) { - return; - } - - zathura_jumplist_append_jump(zathura); - zathura_jumplist_reset_current(zathura); - zathura_jumplist_save(zathura); + if (cur && cur->page == pagenum && cur->x == x && cur->y == y) { + return; } + + zathura_jumplist_append_jump(zathura); + zathura_jumplist_reset_current(zathura); + zathura_jumplist_save(zathura); } static void zathura_jumplist_save(zathura_t* zathura) { + g_return_if_fail(zathura != NULL); + zathura_jump_t* cur = zathura_jumplist_current(zathura); unsigned int pagenum = zathura_document_get_current_page_number(zathura->document);