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 696623 - GtkOverlay with a revealer produces warnings setting a margin
GtkOverlay with a revealer produces warnings setting a margin
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-03-26 10:40 UTC by Ignacio Casal Quinteiro (nacho)
Modified: 2013-03-28 12:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkOverlay: Don't allocate child except in size_allocate (2.82 KB, patch)
2013-03-28 11:07 UTC, Alexander Larsson
none Details | Review
GtkOverlay: Don't allocate child except in size_allocate (6.97 KB, patch)
2013-03-28 11:59 UTC, Alexander Larsson
committed Details | Review
GtkOverlay: Respect overlay child min size (2.21 KB, patch)
2013-03-28 12:18 UTC, Alexander Larsson
committed Details | Review

Description Ignacio Casal Quinteiro (nacho) 2013-03-26 10:40:03 UTC
(gedit:21936): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -11 and height 0


This is what I get in gedit. A revealer allocates 0,0 so setting a margin the overlay makes it request a negative width.
Comment 1 Alexander Larsson 2013-03-28 11:07:21 UTC
Created attachment 240024 [details] [review]
GtkOverlay: Don't allocate child except in size_allocate

We were calling gtk_overlay_child_allocate() both in realize
and in add as we wanted to create and position the child windows
for the widgets. However, this call also actually called
gtk_widget_size_allocate() on the child, which it shouldn't. In some
cases the overlay is realized before being allocated, and thus it
will allocate the child at 0x0 which is an invalid size for it to be in.
In particular, if the child has margins set this will result in negative
allocations and warnings.

This fix just avoids actually allocating the child except in the
actual size_allocate() call on the overlay.
Comment 2 Alexander Larsson 2013-03-28 11:59:33 UTC
Created attachment 240032 [details] [review]
GtkOverlay: Don't allocate child except in size_allocate

We were calling gtk_overlay_child_allocate() both in realize
and in add as we wanted to create and position the child windows
for the widgets. However, this call also actually called
gtk_widget_size_allocate() on the child, which it shouldn't. In some
cases the overlay is realized before being allocated, and thus it
will allocate the child at 0x0 which is an invalid size for it to be in.
In particular, if the child has margins set this will result in negative
allocations and warnings.

This fix splits out the allocation computation so that
gtk_overlay_create_child_window can use it without callers
having to call gtk_overlay_child_allocate() to move the windows.
Comment 3 Alexander Larsson 2013-03-28 12:18:33 UTC
Created attachment 240035 [details] [review]
GtkOverlay: Respect overlay child min size

Never allocate an overlayed child less than its minimum request.
If the minimum doesn't fit we will gracefully clip via the
widget window.
Comment 4 Alexander Larsson 2013-03-28 12:22:46 UTC
Attachment 240032 [details] pushed as b54f277 - GtkOverlay: Don't allocate child except in size_allocate
Attachment 240035 [details] pushed as e495d31 - GtkOverlay: Respect overlay child min size