[gtk+] textview: Use the adjustment target value to figure out if keynav failed



commit f7e983a4c98bca80f3a1fb62cb3a57ff5e5123a3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 8 15:17:23 2014 +0200

    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 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index b42d95a..581a378 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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]