[gtk+] listbox: Fix keynav_failed() parameter in move_cursor()



commit dd85acbaf17a1ffcd6c7dc8ee181e9c6cf771020
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Oct 8 23:56:19 2013 +0200

    listbox: Fix keynav_failed() parameter in move_cursor()
    
    The 'direction' parameter to gtk_widget_keynav_failed() is based on
    gtk_list_box_move_cursor()'s 'count' parameter. However if the passed
    in movement is GTK_MOVEMENT_DISPLAY_LINES, 'count' is modified by
    the keynav handling and will always be 0. To avoid messing up the
    'direction' parameter, use a local variable for keynav handling and
    leave 'count' untouched.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709687

 gtk/gtklistbox.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index bcff01b..a4ff50a 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -2277,17 +2277,18 @@ gtk_list_box_move_cursor (GtkListBox      *list_box,
     case GTK_MOVEMENT_DISPLAY_LINES:
       if (priv->cursor_row != NULL)
         {
+          int i = count;
           iter = ROW_PRIV (priv->cursor_row)->iter;
 
-          while (count < 0  && iter != NULL)
+          while (i < 0  && iter != NULL)
             {
               iter = gtk_list_box_get_previous_visible (list_box, iter);
-              count = count + 1;
+              i = i + 1;
             }
-          while (count > 0  && iter != NULL)
+          while (i > 0  && iter != NULL)
             {
               iter = gtk_list_box_get_next_visible (list_box, iter);
-              count = count - 1;
+              i = i - 1;
             }
 
           if (iter != NULL && !g_sequence_iter_is_end (iter))


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