From: Mikko Rasa Date: Tue, 21 Jan 2014 21:16:51 +0000 (+0200) Subject: Fix list positioning logic in Dropdown X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1d6cebd9f1795a22d6be47a7a049496b89de46f7;p=libs%2Fgltk.git Fix list positioning logic in Dropdown --- diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 84f6af3..7dc0d35 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -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)