Mercurial > pidgin
changeset 18760:bf47d0401a96
Eliminate some unnecessary scrolling activity.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 31 Jul 2007 23:20:56 +0000 |
parents | c3d48512c58a |
children | 316be7e715c6 |
files | pidgin/gtkconv.c pidgin/gtkimhtml.c |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Tue Jul 31 21:41:48 2007 +0000 +++ b/pidgin/gtkconv.c Tue Jul 31 23:20:56 2007 +0000 @@ -5290,7 +5290,7 @@ gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); + gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all | GTK_IMHTML_NO_SCROLL); /* First message in a conversation. */ if (gtkconv->newday == 0) @@ -5478,7 +5478,7 @@ color, sml_attrib ? sml_attrib : "", mdate, str); } - gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); + gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all | GTK_IMHTML_NO_SCROLL); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && !(flags & PURPLE_MESSAGE_SEND)) {
--- a/pidgin/gtkimhtml.c Tue Jul 31 21:41:48 2007 +0000 +++ b/pidgin/gtkimhtml.c Tue Jul 31 23:20:56 2007 +0000 @@ -2270,10 +2270,11 @@ GtkIMHtml *imhtml = data; GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment; gdouble max_val = adj->upper - adj->page_size; + gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3); g_return_val_if_fail(imhtml->scroll_time != NULL, FALSE); - if (g_timer_elapsed(imhtml->scroll_time, NULL) > MAX_SCROLL_TIME) { + if (g_timer_elapsed(imhtml->scroll_time, NULL) > MAX_SCROLL_TIME || scroll_val >= max_val) { /* time's up. jump to the end and kill the timer */ gtk_adjustment_set_value(adj, max_val); g_timer_destroy(imhtml->scroll_time); @@ -2282,7 +2283,7 @@ } /* scroll by 1/3rd the remaining distance */ - gtk_adjustment_set_value(adj, gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3)); + gtk_adjustment_set_value(adj, scroll_val); return TRUE; }