]> git.tdb.fi Git - libs/gltk.git/commitdiff
Fix list positioning logic in Dropdown
authorMikko Rasa <tdb@tdb.fi>
Tue, 21 Jan 2014 21:16:51 +0000 (23:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 21 Jan 2014 23:03:08 +0000 (01:03 +0200)
source/dropdown.cpp

index 84f6af30422203d8ff26ecd9f3db0d111898fc42..7dc0d3550bcaf7d8953ec2a8b5d1013355ad69fd 100644 (file)
@@ -97,6 +97,7 @@ void Dropdown::button_press(int x, int y, unsigned btn)
        else if(btn==1)
        {
                dropped = true;
+               resize_list();
                set_state(ACTIVE);
                signal_grab_pointer.emit();
        }
@@ -136,7 +137,10 @@ void Dropdown::resize_list()
                {
                        const Geometry &rgeom = root->get_geometry();
                        if(lgeom.h*2>rgeom.h)
+                       {
                                lgeom.h = rgeom.h/2;
+                               lgeom.y = -lgeom.h;
+                       }
                        if(root_y+lgeom.y<0)
                                lgeom.y = -root_y;
                        if(root_y+lgeom.y+lgeom.h>rgeom.h)