Commit 86994b49 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer
Browse files

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
parent 4e5d3ecf
......@@ -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;
......@@ -4898,8 +4902,16 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
scroll_step = GTK_SCROLL_PAGES;
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment