From dd85acbaf17a1ffcd6c7dc8ee181e9c6cf771020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 8 Oct 2013 23:56:19 +0200 Subject: [PATCH] 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 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index bcff01b3c5..a4ff50a3ab 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))