merged patch from maemo-gtk which handles failed keynav correctly also

2007-09-21  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextview.c (gtk_text_view_move_cursor_internal)
	(gtk_text_view_move_viewport): merged patch from maemo-gtk which
	handles failed keynav correctly also when the cursor is invisible.
	(Tommi Komulainen)


svn path=/trunk/; revision=18851
This commit is contained in:
Michael Natterer 2007-09-21 14:29:08 +00:00 committed by Michael Natterer
parent 4e5d3ecf07
commit 86994b49d3

View File

@ -258,7 +258,7 @@ static void gtk_text_view_move_cursor (GtkTextView *text_view,
static void gtk_text_view_page_horizontally (GtkTextView *text_view,
gint count,
gboolean extend_selection);
static void gtk_text_view_move_viewport (GtkTextView *text_view,
static gboolean gtk_text_view_move_viewport (GtkTextView *text_view,
GtkScrollStep step,
gint count);
static void gtk_text_view_set_anchor (GtkTextView *text_view);
@ -4872,8 +4872,10 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
switch (step)
{
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_VISUAL_POSITIONS:
leave_direction = count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT;
/* fall through */
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_WORDS:
scroll_step = GTK_SCROLL_HORIZONTAL_STEPS;
break;
@ -4881,6 +4883,8 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
break;
case GTK_MOVEMENT_DISPLAY_LINES:
leave_direction = count > 0 ? GTK_DIR_DOWN : GTK_DIR_UP;
/* fall through */
case GTK_MOVEMENT_PARAGRAPHS:
case GTK_MOVEMENT_PARAGRAPH_ENDS:
scroll_step = GTK_SCROLL_STEPS;
@ -4899,7 +4903,15 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
break;
}
gtk_text_view_move_viewport (text_view, scroll_step, count);
if (!gtk_text_view_move_viewport (text_view, scroll_step, count))
{
if (leave_direction != -1 &&
!gtk_widget_keynav_failed (GTK_WIDGET (text_view),
leave_direction))
{
g_signal_emit_by_name (text_view, "move-focus", leave_direction);
}
}
return;
}
@ -5079,7 +5091,7 @@ gtk_text_view_page_horizontally (GtkTextView *text_view,
}
static void
static gboolean
gtk_text_view_move_viewport (GtkTextView *text_view,
GtkScrollStep step,
gint count)
@ -5123,7 +5135,7 @@ gtk_text_view_move_viewport (GtkTextView *text_view,
break;
}
set_adjustment_clamped (adjustment, adjustment->value + count * increment);
return set_adjustment_clamped (adjustment, adjustment->value + count * increment);
}
static void