Commit 4d5b395f authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Never scroll on focus in (#81893, Patch from Paolo Maggi)

Thu Jun  5 16:52:54 2003  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtktextview.[ch]: Never scroll on focus in
        (#81893, Patch from Paolo Maggi)

        * gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
        Scroll to the current cursor location before handling
        the action, in case the user just tabbed in
        and the cursor is offscreen.
parent de425c5d
Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch]: Never scroll on focus in
(#81893, Patch from Paolo Maggi)
* gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
Scroll to the current cursor location before handling
the action, in case the user just tabbed in
and the cursor is offscreen.
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
#107883, Gustavo Giráldez
......
Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch]: Never scroll on focus in
(#81893, Patch from Paolo Maggi)
* gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
Scroll to the current cursor location before handling
the action, in case the user just tabbed in
and the cursor is offscreen.
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
#107883, Gustavo Giráldez
......
Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch]: Never scroll on focus in
(#81893, Patch from Paolo Maggi)
* gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
Scroll to the current cursor location before handling
the action, in case the user just tabbed in
and the cursor is offscreen.
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
#107883, Gustavo Giráldez
......
Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch]: Never scroll on focus in
(#81893, Patch from Paolo Maggi)
* gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
Scroll to the current cursor location before handling
the action, in case the user just tabbed in
and the cursor is offscreen.
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
#107883, Gustavo Giráldez
......
Thu Jun 5 16:52:54 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.[ch]: Never scroll on focus in
(#81893, Patch from Paolo Maggi)
* gtk/gtktextview.c (gtk_text_view_scroll_[h]pages):
Scroll to the current cursor location before handling
the action, in case the user just tabbed in
and the cursor is offscreen.
Thu Jun 5 17:20:40 2003 Owen Taylor <otaylor@redhat.com>
#107883, Gustavo Giráldez
......
......@@ -185,7 +185,6 @@ static gint gtk_text_view_motion_event (GtkWidget *widget,
static gint gtk_text_view_expose_event (GtkWidget *widget,
GdkEventExpose *expose);
static void gtk_text_view_draw_focus (GtkWidget *widget);
static void gtk_text_view_grab_focus (GtkWidget *widget);
static gboolean gtk_text_view_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_text_view_select_all (GtkWidget *widget,
......@@ -506,7 +505,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
widget_class->focus_out_event = gtk_text_view_focus_out_event;
widget_class->motion_notify_event = gtk_text_view_motion_event;
widget_class->expose_event = gtk_text_view_expose_event;
widget_class->grab_focus = gtk_text_view_grab_focus;
widget_class->focus = gtk_text_view_focus;
widget_class->drag_begin = gtk_text_view_drag_begin;
......@@ -3814,9 +3812,7 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
text_view = GTK_TEXT_VIEW (widget);
text_view->disable_scroll_on_focus = TRUE;
gtk_widget_grab_focus (widget);
text_view->disable_scroll_on_focus = FALSE;
if (event->window != text_view->text_window->bin_window)
{
......@@ -4188,21 +4184,6 @@ gtk_text_view_draw_focus (GtkWidget *widget)
}
}
static void
gtk_text_view_grab_focus (GtkWidget *widget)
{
GtkTextView *text_view;
text_view = GTK_TEXT_VIEW (widget);
GTK_WIDGET_CLASS (parent_class)->grab_focus (widget);
if (!text_view->disable_scroll_on_focus)
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
}
static gboolean
gtk_text_view_focus (GtkWidget *widget,
GtkDirectionType direction)
......@@ -4667,7 +4648,14 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
adj = text_view->vadjustment;
/* Validate the region that will be brought into view by the cursor motion
/* Make sure we start from the current cursor position, even
* if it was offscreen.
*/
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
/* Validate the region that will be brought into view by the cursor motion
*/
if (count < 0)
{
......@@ -4743,6 +4731,13 @@ gtk_text_view_scroll_hpages (GtkTextView *text_view,
adj = text_view->hadjustment;
/* Make sure we start from the current cursor position, even
* if it was offscreen.
*/
gtk_text_view_scroll_mark_onscreen (text_view,
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
/* Validate the line that we're moving within.
*/
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
......
......@@ -93,11 +93,9 @@ struct _GtkTextView
/* if we have reset the IM since the last character entered */
guint need_im_reset : 1;
/* this flag is no longer used */
guint just_selected_element : 1;
/* disable scrolling to cursor on focus */
guint disable_scroll_on_focus : 1;
/* these flags are no longer used */
guint reserved1 : 1;
guint reserved2 : 1;
/* debug flag - means that we've validated onscreen since the
* last "invalidate" signal from the layout
......
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