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.
This commit is contained in:
Carlos Garnacho 2014-07-08 15:17:23 +02:00 committed by Matthias Clasen
parent ee0982ffe3
commit f7e983a4c9

View File

@ -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))