forked from AuroraMiddleware/gtk
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:
parent
4e5d3ecf07
commit
86994b49d3
@ -258,7 +258,7 @@ static void gtk_text_view_move_cursor (GtkTextView *text_view,
|
|||||||
static void gtk_text_view_page_horizontally (GtkTextView *text_view,
|
static void gtk_text_view_page_horizontally (GtkTextView *text_view,
|
||||||
gint count,
|
gint count,
|
||||||
gboolean extend_selection);
|
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,
|
GtkScrollStep step,
|
||||||
gint count);
|
gint count);
|
||||||
static void gtk_text_view_set_anchor (GtkTextView *text_view);
|
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)
|
switch (step)
|
||||||
{
|
{
|
||||||
case GTK_MOVEMENT_LOGICAL_POSITIONS:
|
|
||||||
case GTK_MOVEMENT_VISUAL_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:
|
case GTK_MOVEMENT_WORDS:
|
||||||
scroll_step = GTK_SCROLL_HORIZONTAL_STEPS;
|
scroll_step = GTK_SCROLL_HORIZONTAL_STEPS;
|
||||||
break;
|
break;
|
||||||
@ -4881,6 +4883,8 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
|
|||||||
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
|
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
|
||||||
break;
|
break;
|
||||||
case GTK_MOVEMENT_DISPLAY_LINES:
|
case GTK_MOVEMENT_DISPLAY_LINES:
|
||||||
|
leave_direction = count > 0 ? GTK_DIR_DOWN : GTK_DIR_UP;
|
||||||
|
/* fall through */
|
||||||
case GTK_MOVEMENT_PARAGRAPHS:
|
case GTK_MOVEMENT_PARAGRAPHS:
|
||||||
case GTK_MOVEMENT_PARAGRAPH_ENDS:
|
case GTK_MOVEMENT_PARAGRAPH_ENDS:
|
||||||
scroll_step = GTK_SCROLL_STEPS;
|
scroll_step = GTK_SCROLL_STEPS;
|
||||||
@ -4898,8 +4902,16 @@ gtk_text_view_move_cursor_internal (GtkTextView *text_view,
|
|||||||
scroll_step = GTK_SCROLL_PAGES;
|
scroll_step = GTK_SCROLL_PAGES;
|
||||||
break;
|
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;
|
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,
|
gtk_text_view_move_viewport (GtkTextView *text_view,
|
||||||
GtkScrollStep step,
|
GtkScrollStep step,
|
||||||
gint count)
|
gint count)
|
||||||
@ -5123,7 +5135,7 @@ gtk_text_view_move_viewport (GtkTextView *text_view,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_adjustment_clamped (adjustment, adjustment->value + count * increment);
|
return set_adjustment_clamped (adjustment, adjustment->value + count * increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user