From 6d07584544ac99ef3114f94ad8541321a9848062 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Apr 2011 23:50:14 +0000 Subject: [PATCH] Do send wxEVT_UPDATE_UI events to hidden windows. Failing to send wxEVT_UPDATE_UI to hidden windows made it impossible to show them from their update UI handler which was totally unexpected as the documented wxUpdateUIEvent::Show() method could never be used. Do send these events to the hidden windows themselves but avoid sending the update UI events to the children of hidden windows as this is really useless because any change of their state wouldn't be seen by the user anyhow (even if the child is shown, it would still remain hidden until its parent is) and would just waste time processing a lot of needless events. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/event.cpp | 7 +++++++ src/common/wincmn.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index 382b3ab50c..fcb917dae8 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -474,6 +474,13 @@ bool wxUpdateUIEvent::CanUpdate(wxWindowBase *win) ((win->GetExtraStyle() & wxWS_EX_PROCESS_UI_UPDATES) == 0))) return false; + // Don't update children of the hidden windows: this is useless as any + // change to their state won't be seen by the user anyhow. Notice that this + // argument doesn't apply to the hidden windows (with visible parent) + // themselves as they could be shown by their EVT_UPDATE_UI handler. + if ( win->GetParent() && !win->GetParent()->IsShownOnScreen() ) + return false; + if (sm_updateInterval == -1) return false; diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 0b8a353c3a..77729d68c6 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -2651,7 +2651,7 @@ bool wxWindowBase::SendIdleEvents(wxIdleEvent& event) void wxWindowBase::OnInternalIdle() { - if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen()) + if ( wxUpdateUIEvent::CanUpdate(this) ) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } -- 2.45.2