After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 640337 - chat: Make sure we always scroll down when the user enters a message
chat: Make sure we always scroll down when the user enters a message
Status: RESOLVED DUPLICATE of bug 614977
Product: gnome-shell
Classification: Core
Component: message-tray
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Marina Zhurakhinskaya
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-01-23 20:09 UTC by drago01
Modified: 2011-01-24 06:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
chat: Make sure we always scroll down when the user enters a message (1.32 KB, patch)
2011-01-23 20:09 UTC, drago01
needs-work Details | Review
messageTray: Fix scrollTo hack (1.55 KB, patch)
2011-01-23 20:28 UTC, drago01
needs-work Details | Review

Description drago01 2011-01-23 20:09:24 UTC
See patch
Comment 1 drago01 2011-01-23 20:09:42 UTC
Created attachment 179096 [details] [review]
chat: Make sure we always scroll down when the user enters a message

Calling scrollTo immediately after setting the new text does not always
result into scrolling down. Do this from a style-changed signal handler
instead as this is emitted after the text has been added to the scroll
area.
Comment 2 drago01 2011-01-23 20:19:20 UTC
Review of attachment 179096 [details] [review]:

Thre seem to be a hack in scrollTo that is supposed to deal with that ... will try to fix it instead.
Comment 3 drago01 2011-01-23 20:19:20 UTC
Review of attachment 179096 [details] [review]:

Thre seem to be a hack in scrollTo that is supposed to deal with that ... will try to fix it instead.
Comment 4 drago01 2011-01-23 20:28:53 UTC
Created attachment 179098 [details] [review]
messageTray: Fix scrollTo hack

Instead of immediately setting the adjustment value after the pick
queue a BEFORE_REDRAW priority idle function that does that.

This way the scrolling is done after the new item is added but still
without a visible "jump".
Comment 5 Owen Taylor 2011-01-24 06:10:00 UTC
Review of attachment 179098 [details] [review]:

Hmm, this is a bit odd. It's not immediately clear to me why delaying the call to BEFORE_REDRAW helps - basically, if things work normally than the processing sequence would be:

 This dbus callback (at default priority)
 BEFORE_REDRAW idle functions (at BEFORE_REDRAW priority)
 The Clutter master clock (at CLUTTER_PRIORITY_REDRAW)
   - Process events
   - Update animations
   - Compute allocations
   - Repaint

So the allocation won't be computed until after your BEFORE_REDRAW idle executes. The reason that it is actually working is probably the same (to me unknown) reason as Marc-Antoine's patch in bug 614977 - something is forcing a synchronous relayout of the stage in the process of showing a notification.

It's probably good to figure that out, because the right fix here is to force a synchronous relayout *ourselves* - that is, fix up the hack before this code which isn't working - and we'd rather not do two synchronous relayouts. The way I'd determine what is forcing a synchronous relayout is to attach to the process in gdb, break on something that will be called when adding a new notification like st_widget_add_style_class(), trigger a new message being added, then break on _clutter_stage_maybe_relayout() and see what triggered that with a gdb backtrace and gjs_dumpstack().

But leaving that aside, how would we fix up the hack? If I look at the clutter code, I don't see anything in the pick code paths that would cause _clutter_stage_maybe_relayout() to be called - maybe that happened at one point, but currently it just seems to pick against the current (un-updated) allocations. So I think the current hack to call get_actor_at_pos() is completely ineffective. But if you look through the clutter code, something that does force a relayout is clutter_actor_get_allocation_box(). So if you called that on the scrollArea widget, that should force a synchronous stage update, which will update allocation.upper and with luck everything will work.

Well, except for the double synchronous relayout if we can't figure out what is triggering that.
Comment 6 Owen Taylor 2011-01-24 06:11:14 UTC
Let's consolidate this with the older bug on the same topic.

*** This bug has been marked as a duplicate of bug 614977 ***