]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/layout.cpp
Make autosize_special const and add a const autosize overload
[libs/gltk.git] / source / layout.cpp
index 5ebb55ccf4f8822de2423427d4c795c8d906ecf8..bee972d903ab242415f992767247e425e9109922 100644 (file)
@@ -470,16 +470,13 @@ Layout::Slot::Slot(Layout &l, Widget &w):
 
 void Layout::Slot::autosize_changed()
 {
-       widget.autosize();
-       autosize_geom = widget.get_geometry();
+       widget.autosize(autosize_geom);
 
        if(!widget.is_visible() && !ghost)
                return;
 
-       // If the widget fits in the area it had, just leave it there.
-       if(autosize_geom.w<=geom.w && autosize_geom.h<=geom.h)
-               widget.set_geometry(geom);
-       else
+       // Only trigger an update if the widget won't fit in its current area.
+       if(autosize_geom.w>geom.w || autosize_geom.h>geom.h)
        {
                layout.container->signal_autosize_changed.emit();
                layout.update();