mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 13:26:00 +01:00
Don't scroll the document when focusing the inputbar
Add a new adjust mode that is set when focusing the inputbar and disables adjusting the vertical scrollbar. As a result, focusing the inputbar doesn't scroll the document, leading to better results when changing pages from the inputbar (e.g. using bookmarks). Reported-by: Marwan Tanager <marwan.tngr@gmail.com> Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
c9eef95492
commit
1702fb620a
4 changed files with 12 additions and 6 deletions
|
@ -148,6 +148,13 @@ cb_view_vadjustment_changed(GtkAdjustment* adjustment, gpointer data)
|
|||
zathura_t* zathura = data;
|
||||
g_return_if_fail(zathura != NULL);
|
||||
|
||||
zathura_adjust_mode_t adjust_mode =
|
||||
zathura_document_get_adjust_mode(zathura->document);
|
||||
|
||||
/* Don't scroll we're focusing the inputbar. */
|
||||
if (adjust_mode == ZATHURA_ADJUST_INPUTBAR)
|
||||
return;
|
||||
|
||||
double ratio = zathura_adjustment_get_ratio(zathura->ui.vadjustment);
|
||||
zathura_adjustment_set_value_from_ratio(adjustment, ratio);
|
||||
}
|
||||
|
|
|
@ -362,11 +362,7 @@ zathura_document_set_adjust_mode(zathura_document_t* document, zathura_adjust_mo
|
|||
return;
|
||||
}
|
||||
|
||||
if (mode == ZATHURA_ADJUST_BESTFIT || mode == ZATHURA_ADJUST_WIDTH) {
|
||||
document->adjust_mode = mode;
|
||||
} else {
|
||||
document->adjust_mode = ZATHURA_ADJUST_NONE;
|
||||
}
|
||||
document->adjust_mode = mode;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
|
|
|
@ -232,6 +232,8 @@ sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument, girara
|
|||
zathura_t* zathura = session->global.data;
|
||||
g_return_val_if_fail(argument != NULL, false);
|
||||
|
||||
zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_INPUTBAR);
|
||||
|
||||
if (gtk_widget_get_visible(GTK_WIDGET(session->gtk.inputbar)) == false) {
|
||||
gtk_widget_show(GTK_WIDGET(session->gtk.inputbar));
|
||||
}
|
||||
|
|
3
types.h
3
types.h
|
@ -85,7 +85,8 @@ typedef enum zathura_adjust_mode_e
|
|||
{
|
||||
ZATHURA_ADJUST_NONE, /**< No adjustment */
|
||||
ZATHURA_ADJUST_BESTFIT, /**< Adjust to best-fit */
|
||||
ZATHURA_ADJUST_WIDTH /**< Adjust to width */
|
||||
ZATHURA_ADJUST_WIDTH, /**< Adjust to width */
|
||||
ZATHURA_ADJUST_INPUTBAR /**< Focusing the inputbar */
|
||||
} zathura_adjust_mode_t;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue