*CtrlLib: Fix in problem with DisplayPopup sometimes popping up on focus change wrongly

git-svn-id: svn://ultimatepp.org/upp/trunk@3459 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-05-26 09:00:37 +00:00
parent 52c85f6a32
commit facb657ddb

View file

@ -487,18 +487,20 @@ void DisplayPopup::Sync()
if(top && top->HasFocusDeep()) {
Size sz = display->GetStdSize(value);
if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) {
Rect wa = GetWorkArea();
slim = item + ctrl->GetScreenView().TopLeft();
Rect r = item;
r.right = max(r.right, r.left + sz.cx + 2 * margin);
r.bottom = max(r.bottom, r.top + sz.cy);
r.Inflate(1, 1);
r.Offset(ctrl->GetScreenView().TopLeft());
SetRect(r);
if(!IsOpen())
Ctrl::PopUp(ctrl, true, false, false);
Refresh();
return;
if(slim.Contains(GetMousePos())) {
Rect wa = GetWorkArea();
Rect r = item;
r.right = max(r.right, r.left + sz.cx + 2 * margin);
r.bottom = max(r.bottom, r.top + sz.cy);
r.Inflate(1, 1);
r.Offset(ctrl->GetScreenView().TopLeft());
SetRect(r);
if(!IsOpen())
Ctrl::PopUp(ctrl, true, false, false);
Refresh();
return;
}
}
}
}