use YieldFor() in wxTopLevelWindowGTK::RequestUserAttention; comment on the use of YieldFor() in wxProgressDialog; add some TODOs near wxYieldIfNeeded()/wxSafeYield() calls in wxListCtrl, wxDataViewCtrl, wxTreeCtrl (closes #10320)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1903,7 +1903,11 @@ void wxDataViewMainWindow::OnRenameTimer()
|
||||
// We have to call this here because changes may just have
|
||||
// been made and no screen update taken place.
|
||||
if ( m_dirty )
|
||||
{
|
||||
// TODO: use wxTheApp->SafeYieldFor(NULL, wxEVT_CATEGORY_UI) instead
|
||||
// (needs to be tested!)
|
||||
wxSafeYield();
|
||||
}
|
||||
|
||||
int xpos = 0;
|
||||
unsigned int cols = GetOwner()->GetColumnCount();
|
||||
|
@@ -2243,6 +2243,9 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass
|
||||
// been added and no screen update taken place.
|
||||
if ( m_dirty )
|
||||
{
|
||||
// TODO: use wxTheApp->SafeYieldFor(NULL, wxEVT_CATEGORY_UI) instead
|
||||
// so that no pending events may change the item count (see below)
|
||||
// IMPORTANT: needs to be tested!
|
||||
wxSafeYield();
|
||||
|
||||
// Pending events dispatched by wxSafeYield might have changed the item
|
||||
|
@@ -403,6 +403,9 @@ wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
|
||||
m_msg->SetLabel(_("Done."));
|
||||
}
|
||||
|
||||
// allow the window to repaint:
|
||||
// NOTE: since we yield only for UI events with this call, there
|
||||
// should be no side-effects
|
||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||
|
||||
(void)ShowModal();
|
||||
@@ -453,6 +456,8 @@ bool wxProgressDialog::DoAfterUpdate(bool *skip)
|
||||
{
|
||||
// we have to yield because not only we want to update the display but
|
||||
// also to process the clicks on the cancel and skip buttons
|
||||
// NOTE: using YieldFor() this call shouldn't give re-entrancy problems
|
||||
// for event handlers not interested to UI/user-input events.
|
||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT);
|
||||
|
||||
Update();
|
||||
@@ -672,6 +677,9 @@ void wxProgressDialog::UpdateMessage(const wxString &newmsg)
|
||||
|
||||
Fit(); // adapt to the new label size
|
||||
|
||||
// allow the window to repaint:
|
||||
// NOTE: since we yield only for UI events with this call, there
|
||||
// should be no side-effects
|
||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||
}
|
||||
}
|
||||
|
@@ -3576,6 +3576,8 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__)
|
||||
Update();
|
||||
#else
|
||||
// TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI)
|
||||
// instead (needs to be tested!)
|
||||
wxYieldIfNeeded();
|
||||
#endif
|
||||
}
|
||||
@@ -3606,9 +3608,11 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
|
||||
|
||||
SetCursor(m_oldCursor);
|
||||
|
||||
#if defined( __WXMSW__ ) || defined(__WXMAC__)
|
||||
#if defined( __WXMSW__ ) || defined(__WXMAC__) || defined(__WXGTK20__)
|
||||
Update();
|
||||
#else
|
||||
// TODO: remove this call or use wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI)
|
||||
// instead (needs to be tested!)
|
||||
wxYieldIfNeeded();
|
||||
#endif
|
||||
}
|
||||
|
@@ -1247,10 +1247,11 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
||||
bool new_hint_value = false;
|
||||
|
||||
// FIXME: This is a workaround to focus handling problem
|
||||
// If RequestUserAttention is called for example right after a wxSleep, OnInternalIdle hasn't
|
||||
// yet been processed, and the internal focus system is not up to date yet.
|
||||
// wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR
|
||||
::wxYieldIfNeeded();
|
||||
// If RequestUserAttention is called for example right after a wxSleep, OnInternalIdle
|
||||
// hasn't yet been processed, and the internal focus system is not up to date yet.
|
||||
// YieldFor(wxEVT_CATEGORY_UI) ensures the processing of it (hopefully it
|
||||
// won't have side effects) - MR
|
||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||
|
||||
if(m_urgency_hint >= 0)
|
||||
g_source_remove(m_urgency_hint);
|
||||
|
Reference in New Issue
Block a user