forked from AuroraMiddleware/gtk
update cursor_y_pos with clamped delta rather than theoretical delta
2002-01-16 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_scroll_pages): update cursor_y_pos with clamped delta rather than theoretical delta (#68788). Also, if we can't page up/down further then jump to top/bottom of the document.
This commit is contained in:
parent
396f5ab1f6
commit
fe622071f6
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -1,3 +1,10 @@
|
||||
2002-01-16 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_scroll_pages): update
|
||||
cursor_y_pos with clamped delta rather than theoretical delta
|
||||
(#68788). Also, if we can't page up/down further then jump
|
||||
to top/bottom of the document.
|
||||
|
||||
Wed Jan 16 19:33:41 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkfilesel.c (gtk_file_selection_map): Refresh
|
||||
|
@ -4459,6 +4459,7 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
|
||||
gint count)
|
||||
{
|
||||
gdouble newval;
|
||||
gdouble oldval;
|
||||
GtkAdjustment *adj;
|
||||
gint cursor_x_pos, cursor_y_pos;
|
||||
GtkTextIter new_insert;
|
||||
@ -4486,22 +4487,38 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
|
||||
|
||||
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
|
||||
/* FIXME do we need to update the adjustment ranges here? */
|
||||
|
||||
if (count < 0 && adj->value <= (adj->lower + 1e-12))
|
||||
{
|
||||
/* already at top, just be sure we are at offset 0 */
|
||||
gtk_text_buffer_get_start_iter (get_buffer (text_view), &new_insert);
|
||||
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
|
||||
}
|
||||
else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
|
||||
{
|
||||
/* already at bottom, just be sure we are at the end */
|
||||
gtk_text_buffer_get_end_iter (get_buffer (text_view), &new_insert);
|
||||
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
|
||||
|
||||
newval = adj->value;
|
||||
oldval = adj->value;
|
||||
|
||||
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
|
||||
newval += count * adj->page_increment;
|
||||
|
||||
newval = adj->value;
|
||||
set_adjustment_clamped (adj, newval);
|
||||
cursor_y_pos += adj->value - oldval;
|
||||
|
||||
newval += count * adj->page_increment;
|
||||
|
||||
cursor_y_pos += newval - adj->value;
|
||||
set_adjustment_clamped (adj, newval);
|
||||
|
||||
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
|
||||
clamp_iter_onscreen (text_view, &new_insert);
|
||||
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
|
||||
|
||||
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
|
||||
gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
|
||||
clamp_iter_onscreen (text_view, &new_insert);
|
||||
gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
|
||||
|
||||
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
|
||||
}
|
||||
|
||||
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
|
||||
* only guarantees 1 pixel onscreen.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user