Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions zathura/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ void cb_view_hadjustment_value_changed(GtkAdjustment* adjustment, gpointer data)
zathura_document_t* document = zathura_get_document(zathura);
const double stored_position = zathura_document_get_position_x(document);

// FIXME: this callback should really not set the adjustment
// the value was set by someone else, so restore the stored position instead of reading it back
if (zathura_adjustment_value_matches_ratio(adjustment, stored_position) == false) {
zathura_adjustment_set_value_from_ratio(adjustment, stored_position);
return;
}

const double position_x = zathura_adjustment_get_ratio(adjustment);
const double position_y = zathura_document_get_position_y(document);
GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(zathura->ui.view));
Expand Down Expand Up @@ -152,13 +145,6 @@ void cb_view_vadjustment_value_changed(GtkAdjustment* adjustment, gpointer data)
zathura_document_t* document = zathura_get_document(zathura);
const double stored_position = zathura_document_get_position_y(document);

// FIXME: this callback should really not set the adjustment
// restore the stored position when the value came from elsewhere
if (zathura_adjustment_value_matches_ratio(adjustment, stored_position) == false) {
zathura_adjustment_set_value_from_ratio(adjustment, stored_position);
return;
}

const double position_x = zathura_document_get_position_x(document);
const double position_y = zathura_adjustment_get_ratio(adjustment);
const unsigned int page_id = position_to_page_number(zathura, position_x, page_position_y(adjustment));
Expand Down Expand Up @@ -201,13 +187,6 @@ static void cb_view_adjustment_changed(GtkAdjustment* adjustment, zathura_t* zat
return;
}

// FIXME: this callback should never change the adjustment value itself
// reset the adjustment, in case bounds have changed
const double ratio =
width == true ? zathura_document_get_position_x(document) : zathura_document_get_position_y(document);

zathura_adjustment_set_value_from_ratio(adjustment, ratio);

/* store the position that was actually applied so it stays valid after the view is sized */
const double extent = gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_lower(adjustment);
if (extent > size) {
Expand Down
8 changes: 7 additions & 1 deletion zathura/document-widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,14 @@ void zathura_document_widget_compute_layout(ZathuraDocumentWidget* document) {
unsigned int doc_height = 0, doc_width = 0;
zathura_document_widget_get_document_size(document, &doc_height, &doc_width);

gtk_adjustment_set_upper(priv->hadjustment, doc_width);
const double stored_x = zathura_document_get_position_x(priv->document);
const double stored_y = zathura_document_get_position_y(priv->document);
gtk_adjustment_set_upper(priv->vadjustment, doc_height);
gtk_adjustment_set_upper(priv->hadjustment, doc_width);
// Better set vadjustment first because it's likely that hadjustment_value_changed
// callback to call excess zathura_document_set_current_page_number
zathura_adjustment_set_value_from_ratio(priv->vadjustment, stored_y);
zathura_adjustment_set_value_from_ratio(priv->hadjustment, stored_x);

float scroll_step = 40;
girara_setting_get(priv->zathura->ui.session, "scroll-step", &scroll_step);
Expand Down
3 changes: 3 additions & 0 deletions zathura/shortcuts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,9 @@ bool sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_even
g_return_val_if_fail(argument != NULL, false);
g_return_val_if_fail(zathura_has_document(zathura), false);

gtk_scrolled_window_set_kinetic_scrolling(GTK_SCROLLED_WINDOW(zathura->ui.view), FALSE);
Comment thread
sebastinas marked this conversation as resolved.
gtk_scrolled_window_set_kinetic_scrolling(GTK_SCROLLED_WINDOW(zathura->ui.view), TRUE);

zathura_document_set_adjust_mode(zathura->document, ZATHURA_ADJUST_NONE);

/* retrieve zoom step value */
Expand Down
3 changes: 3 additions & 0 deletions zathura/zathura.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,9 @@ bool position_set(zathura_t* zathura, double position_x, double position_y) {
return true;
}

gtk_scrolled_window_set_kinetic_scrolling(GTK_SCROLLED_WINDOW(zathura->ui.view), FALSE);
Comment thread
sebastinas marked this conversation as resolved.
gtk_scrolled_window_set_kinetic_scrolling(GTK_SCROLLED_WINDOW(zathura->ui.view), TRUE);

double comppos_x, comppos_y;
const unsigned int page_id = zathura_document_get_current_page_number(document);

Expand Down
Loading