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
This commit is contained in:
Florian Müllner 2013-10-08 23:56:19 +02:00
parent 22fe579d37
commit dd85acbaf1

View File

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