pidgin: e07e1ddb: Fix scrolling bug for very busy chat roo...
sadrul at pidgin.im
sadrul at pidgin.im
Sat Nov 21 14:40:39 EST 2009
-----------------------------------------------------------------
Revision: e07e1ddb6d78d967d0f96d7a3002e233323d44b3
Ancestor: 3d4c639042fbd0a2602bdee93b94788a6e9f24b5
Author: sadrul at pidgin.im
Date: 2009-11-21T19:40:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e07e1ddb6d78d967d0f96d7a3002e233323d44b3
Modified files:
ChangeLog pidgin/gtkimhtml.c
ChangeLog:
Fix scrolling bug for very busy chat rooms.
The bug shows up only when smooth-scrolling is enabled. When the imhtml
widget is still scrolling (such that an entire line still needs to be
scrolled), and a new message comes in, it thinks the user isn't looking
at the end of the buffer, so it doesn't scroll for the new message. The
fix is to detect that and not disable the scrolling in such cases.
-------------- next part --------------
============================================================
--- ChangeLog 5aa1e763049a83e5ad024a67635fd3276a7a7530
+++ ChangeLog 551ed331bfc9609c4cd3c0abc47b0e6fa5d143da
@@ -64,6 +64,8 @@ version 2.6.4 (??/??/20??):
* The userlist in a multiuser chat can be styled via gtkrc by using the
widget name "pidgin_conv_userlist". (Heiko Schmitt)
* Add a hold button to the media window.
+ * Fix a bug where the conversation backlog stops scrolling in a very busy
+ chat room.
Pidgin Preference and Preference Window Changes:
* Removed the "Use font from theme" and "Conversation Font" preferences
============================================================
--- pidgin/gtkimhtml.c 5e93c64a73fc5627035a4e4a03d4c7b12946e7ed
+++ pidgin/gtkimhtml.c cfdf7d85601d0d205a9f20f2ecc837a7fe91e83b
@@ -2423,6 +2423,8 @@ static int gtk_imhtml_is_protocol(const
return proto ? proto->length : 0;
}
+static gboolean smooth_scroll_cb(gpointer data);
+
/*
<KingAnt> marv: The two IM image functions in oscar are purple_odc_send_im and purple_odc_incoming
@@ -2477,7 +2479,14 @@ void gtk_imhtml_append_text_with_images
if (((y + height) - (rect.y + rect.height)) > height &&
gtk_text_buffer_get_char_count(imhtml->text_buffer)) {
- options |= GTK_IMHTML_NO_SCROLL;
+ /* If we are in the middle of smooth-scrolling, then take a scroll step.
+ * If we are not in the middle of smooth-scrolling, that means we were
+ * not looking at the end of the buffer before the new text was added,
+ * so do not scroll. */
+ if (imhtml->scroll_time)
+ smooth_scroll_cb(imhtml);
+ else
+ options |= GTK_IMHTML_NO_SCROLL;
}
}
@@ -2506,7 +2515,7 @@ void gtk_imhtml_append_text_with_images
*
* @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom.
*/
-static gboolean scroll_cb(gpointer data)
+static gboolean smooth_scroll_cb(gpointer data)
{
GtkIMHtml *imhtml = data;
GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment;
@@ -2520,6 +2529,8 @@ static gboolean scroll_cb(gpointer data)
gtk_adjustment_set_value(adj, max_val);
g_timer_destroy(imhtml->scroll_time);
imhtml->scroll_time = NULL;
+ g_source_remove(imhtml->scroll_src);
+ imhtml->scroll_src = 0;
return FALSE;
}
@@ -2528,13 +2539,6 @@ static gboolean scroll_cb(gpointer data)
return TRUE;
}
-static gboolean smooth_scroll_idle_cb(gpointer data)
-{
- GtkIMHtml *imhtml = data;
- imhtml->scroll_src = g_timeout_add(SCROLL_DELAY, scroll_cb, imhtml);
- return FALSE;
-}
-
static gboolean scroll_idle_cb(gpointer data)
{
GtkIMHtml *imhtml = data;
@@ -2554,7 +2558,7 @@ void gtk_imhtml_scroll_to_end(GtkIMHtml
g_source_remove(imhtml->scroll_src);
if(smooth) {
imhtml->scroll_time = g_timer_new();
- imhtml->scroll_src = g_idle_add_full(G_PRIORITY_LOW, smooth_scroll_idle_cb, imhtml, NULL);
+ imhtml->scroll_src = g_timeout_add_full(G_PRIORITY_LOW, SCROLL_DELAY, smooth_scroll_cb, imhtml, NULL);
} else {
imhtml->scroll_time = NULL;
imhtml->scroll_src = g_idle_add_full(G_PRIORITY_LOW, scroll_idle_cb, imhtml, NULL);
More information about the Commits
mailing list