*CtrlLib: Improved syncing of DisplayPopup to avoid stall popups (e.g. in ide navigator)

git-svn-id: svn://ultimatepp.org/upp/trunk@4714 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-03-23 09:41:23 +00:00
parent d92d97f96f
commit 6e958b4c4f
3 changed files with 22 additions and 6 deletions

View file

@ -629,12 +629,10 @@ void Ctrl::WndFree()
void Ctrl::WndDestroy0()
{
GuiLock __;
LLOG("Ctrl::WndDestroy() in " <<UPP::Name(this) << LOG_BEGIN);
LLOG((DumpWindowOrder(false), ""));
if(top && top->hwnd) {
HWND hwnd = top->hwnd;
WndFree(); // CXL 2007-06-04 to avoid loosing focus with maximize box owned dialogs
::DestroyWindow(hwnd);
bool result = ::DestroyWindow(hwnd);
}
}

View file

@ -508,6 +508,7 @@ DisplayPopup::DisplayPopup()
margin = 0;
ONCELOCK {
InstallStateHook(StateHook);
InstallMouseHook(MouseHook);
}
LinkBefore(all());
}
@ -526,7 +527,6 @@ void DisplayPopup::Sync()
if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) {
slim = item + ctrl->GetScreenView().TopLeft();
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);
@ -551,11 +551,27 @@ Link<DisplayPopup> *DisplayPopup::all()
return &all;
}
void DisplayPopup::SyncAll()
{
int n = 0;
for(DisplayPopup *p = all()->Link<DisplayPopup>::GetNext(); p != all(); p = p->Link<DisplayPopup>::GetNext())
if(p->ctrl && p->ctrl->IsOpen()) {
p->Sync();
n++;
}
}
bool DisplayPopup::StateHook(Ctrl *, int reason)
{
if(reason == FOCUS)
for(DisplayPopup *p = all()->Link<DisplayPopup>::GetNext(); p != all(); p = p->Link<DisplayPopup>::GetNext())
p->Sync();
SyncAll();
return false;
}
bool DisplayPopup::MouseHook(Ctrl *, bool, int, Point, int, dword)
{
SyncAll();
return false;
}

View file

@ -129,6 +129,8 @@ private:
static Link<DisplayPopup> *all();
static bool StateHook(Ctrl *, int reason);
static bool MouseHook(Ctrl *, bool, int, Point, int, dword);
static void SyncAll();
public:
void Set(Ctrl *ctrl, const Rect& item, const Value& v, const Display *display,