From: H.G. Muller Date: Tue, 19 Mar 2013 12:20:24 +0000 (+0100) Subject: Fix scrolling of Chat Box X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=0290d2bc845bbd6445d22176ceb88ca5a7dc3422;p=xboard.git Fix scrolling of Chat Box Seems the problem is that scroll_to_iter does not work until after some time, needed to calculate line heights. Use scroll_to_mark instead, after clumsily adding a text_mark. --- diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 0eb1658..7a03ffb 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -317,8 +317,13 @@ void ScrollToCursor (Option *opt, int caretPos) { static GtkTextIter iter; + static GtkTextMark *mark; + if(!mark) mark = gtk_text_mark_new(NULL, 0); gtk_text_buffer_get_iter_at_offset((GtkTextBuffer *) opt->handle, &iter, caretPos); - gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_add_mark((GtkTextBuffer *) opt->handle, mark, &iter); + gtk_text_view_scroll_to_mark((GtkTextView *) opt->textValue, mark, 0.0, 0, 0.5, 0.5); +// gtk_text_view_scroll_to_iter((GtkTextView *) opt->textValue, &iter, 0.0, 0, 0.5, 0.5); + gtk_text_buffer_delete_mark((GtkTextBuffer *) opt->handle, mark); } int