[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-188-ge90e11cad
wwp
wwp at claws-mail.org
Wed Sep 15 08:38:13 CEST 2021
Hello Jonathan,
On Wed, 15 Sep 2021 02:58:40 +0000 (UTC) jonathan at claws-mail.org wrote:
> The branch, gtk3 has been updated
> via e90e11cadc5546567f47bb13c50020eb822b75d4 (commit)
> from 73557a0db41ef99a726881a1af8b516404a5bc2a (commit)
>
> Summary of changes:
> src/plugins/pdf_viewer/poppler_viewer.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
>
> - Log -----------------------------------------------------------------
> commit e90e11cadc5546567f47bb13c50020eb822b75d4
> Author: Jonathan Boeing <jonathan at claws-mail.org>
> Date: Tue Sep 14 18:31:01 2021 -0700
>
> Fix scroll to next/prev page in pdf_viewer
>
> Add handling for GDK_SCROLL_SMOOTH events in scroll callback
>
> diff --git a/src/plugins/pdf_viewer/poppler_viewer.c b/src/plugins/pdf_viewer/poppler_viewer.c
> index cf62eaf8f..37126fbd1 100644
> --- a/src/plugins/pdf_viewer/poppler_viewer.c
> +++ b/src/plugins/pdf_viewer/poppler_viewer.c
> @@ -1111,6 +1111,7 @@ static gboolean pdf_viewer_scroll_cb(GtkWidget *widget, GdkEventScroll *event,
> GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(viewer->scrollwin));
> static gboolean in_scroll_cb = FALSE;
> gboolean handled = FALSE;
> + gdouble delta_x = 0.0, delta_y = 0.0;
> gint cur_p = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(viewer->cur_page));
>
> if (in_scroll_cb)
> @@ -1128,14 +1129,18 @@ static gboolean pdf_viewer_scroll_cb(GtkWidget *widget, GdkEventScroll *event,
> return TRUE;
> }
>
> - if (event->direction == GDK_SCROLL_UP &&
> + if (event->direction == GDK_SCROLL_SMOOTH) {
> + gdk_event_get_scroll_deltas((GdkEvent *)event, &delta_x, &delta_y);
> + }
> +
> + if ((delta_y < 0.0 || event->direction == GDK_SCROLL_UP) &&
> gtk_adjustment_get_value(adj) == gtk_adjustment_get_lower(adj) &&
> cur_p > 1) {
> gtk_spin_button_spin(GTK_SPIN_BUTTON(viewer->cur_page), GTK_SPIN_STEP_BACKWARD, 1);
> gtk_adjustment_set_value(adj,
> gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj));
> handled = TRUE;
> - } else if (event->direction == GDK_SCROLL_DOWN &&
> + } else if ((delta_y > 0.0 || event->direction == GDK_SCROLL_DOWN) &&
> gtk_adjustment_get_value(adj) + gtk_adjustment_get_page_size(adj) == gtk_adjustment_get_upper(adj) &&
> cur_p < viewer->num_pages) {
> gtk_spin_button_spin(GTK_SPIN_BUTTON(viewer->cur_page), GTK_SPIN_STEP_FORWARD, 1);
I'm not 100% sure but I'm afraid that with GTK3 we have to take both
scrolling methods into account: the smooth one (w/ deltas) and the plain
basic up/down one. Following the system where I tested it, I had one or
the other working, when I was working on d4e2645d82e74b9a24c34ec2edb2430529ef4354.
See textview_scrolled().
Regards,
--
wwp
https://useplaintext.email/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/commits/attachments/20210915/1d472f2c/attachment.sig>
More information about the Commits
mailing list