From f7e983a4c98bca80f3a1fb62cb3a57ff5e5123a3 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 8 Jul 2014 15:17:23 +0200 Subject: [PATCH] textview: Use the adjustment target value to figure out if keynav failed When moving the cursor, compare current adjustment value with the post-animation target value, in order to avoid false "keynav failed" positives as the animation hasn't started yet, so dx/dy are still 0 at that time. --- gtk/gtktextview.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index b42d95a970..581a378834 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5858,10 +5858,11 @@ gtk_text_view_move_cursor (GtkTextView *text_view, break; } - old_xpos = priv->xoffset; - old_ypos = priv->yoffset; + old_xpos = gtk_adjustment_get_value (priv->hadjustment); + old_ypos = gtk_adjustment_get_value (priv->vadjustment); gtk_text_view_move_viewport (text_view, scroll_step, count); - if ((old_xpos == priv->xoffset && old_ypos == priv->yoffset) && + if ((old_xpos == gtk_adjustment_get_target_value (priv->hadjustment) && + old_ypos == gtk_adjustment_get_target_value (priv->vadjustment)) && leave_direction != -1 && !gtk_widget_keynav_failed (GTK_WIDGET (text_view), leave_direction))