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 335247 - keep focussed child visible on size_allocate()
keep focussed child visible on size_allocate()
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-03-20 17:03 UTC by Tim Janik
Modified: 2007-09-19 12:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to scroll-to-focus on ::size-allocate (4.62 KB, patch)
2006-03-20 17:03 UTC, Tim Janik
none Details | Review
test program to trigger acroll-to-focus on ::size-allocate (1.28 KB, text/x-csrc)
2006-03-20 17:08 UTC, Tim Janik
  Details
updated scroll-to-focus-widget patch (4.83 KB, text/x-patch)
2007-09-19 12:18 UTC, Tim Janik
  Details

Description Tim Janik 2006-03-20 17:03:02 UTC
maemo-gtk contains a scrolled window patch to keep focussed children visible across size allocations.
i've rewritten the patch to achive this automatically upon GtkWidget::size-allocate signals, for containers where gtk_container_set_focus_?adjustment() was called.
Comment 1 Tim Janik 2006-03-20 17:03:55 UTC
Created attachment 61637 [details] [review]
patch to scroll-to-focus on ::size-allocate
Comment 2 Tim Janik 2006-03-20 17:08:40 UTC
Created attachment 61638 [details]
test program to trigger acroll-to-focus on ::size-allocate

this program can be used to trigger the described behaviour with the above patch applied. for that, give the focus to any of the buttons by clicking on it, and then scroll the window to move the focussed button out of sight.
resizing the window slightly will cause gtk to do a new size allocation, and with the patch applied, the button previously moved out of sight comes back into the visible region due to adjustments of the scroll position.
Comment 3 Matthias Clasen 2006-03-21 16:06:27 UTC
So, how does this work if you manually scroll the focus child away, and then 
resize the window. Will the focus child jump back into view ? That would be 
wrong, imo. I should probably just try it, but I have too many other patches in
my tree at the moment.
Comment 4 Tim Janik 2006-03-22 15:01:45 UTC
matthias, nah, feel free to ask ;)
yes, if you resize, the scroll position snaps back to bring the child back into child. i can see your argument to keep the approximate scroll position when resizing (approximate, because you're resizing anyway).
but then, the container in question is one where the programmer/designer explicitely called gtk_container_set_focus_vadjustment() (or the hadjustment variant), i.e. requested that the scroll position stays adjusted to the focussed child, so to an extend, it's resonable to adjust the position upon resizing as well.
(i'm aware that this is not an easy call to make, which is basically why we're having it as a bug report here, open for discussion.)
Comment 5 Sven Neumann 2006-03-22 15:24:31 UTC
IMO the scroll position should be kept approximately. It would be confusing if things start to jump around when the window is being resized. So only if the focused child was visible, an attempt should be made to keep it visible.
Comment 6 Tim Janik 2006-03-28 15:01:16 UTC
i asked mitch and he seems to object as well.
so general consensus is to not have this "feature".
hence closing the bug.
Comment 7 Tim Janik 2007-09-19 12:18:23 UTC
Created attachment 95846 [details]
updated scroll-to-focus-widget patch

for completeness, the attached patch is what maemo-gtk uses now. this patch also adjust scroll positions of containers that the first patch didn't cover. it basically ensures that, if any container got resized, at the end of the current resizing, the focus_widget will be scrolled into sight by adjusting all scrollable containers of the focus_widgets ancestry.