Hi folks, I know there is a gtk_text_view_scroll_to_mark() and gtk_text_view_scroll_mark_onscreen() function but I don't want to scroll to a mark but check whether a mark is already on the screen. There is gtk_text_mark_get_visible() but that only returns whether the mark is painted. Is there an easy way to do that? I probably can jump through through various loopholes to get this (involving gtk_text_buffer_get_iter_at_mark(), gtk_text_view_get_iter_location() and gtk_text_view_get_visible_rect()) but then it might be just too much work not worth the feature. The background is, that I want to do an intelligent auto-scroll for a chat log. If the scroll position is all the way on the bottom the TextView should do the normal auto-scroll via gtk_text_view_scroll_mark_onscreen() but if the user scrolled to a different area (e.g. to read past posts) it should stop auto-scrolling and just stay where it was. The easiest way I can think of right now would be to have a right-weighted mark at the end of the log and whenever a new message is posted check if the mark is in the visible area, then add the new message and only when the mark was on screen before make the TextView scroll_mark_onscreen() Thanks for helping me out, Michael
Attachment:
signature.asc
Description: OpenPGP digital signature