Added wxWakeUpIdle() for MSW and empty stubs for Motif, OS2, and Mac

Pending events are now deleted after being processed


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-11-17 21:02:45 +00:00
parent 5f2936dacb
commit 9779893b90
7 changed files with 270 additions and 236 deletions

View File

@@ -310,10 +310,8 @@ extern void WXDLLEXPORT wxExit();
// Yield to other apps/messages // Yield to other apps/messages
extern bool WXDLLEXPORT wxYield(); extern bool WXDLLEXPORT wxYield();
#ifdef __WXGTK__
// Yield to other apps/messages // Yield to other apps/messages
extern void WXDLLEXPORT wxWakeUpIdle(); extern void WXDLLEXPORT wxWakeUpIdle();
#endif
// Post a message to the given eventhandler which will be processed during the // Post a message to the given eventhandler which will be processed during the
// next event loop iteration // next event loop iteration

View File

@@ -609,15 +609,7 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
wxLEAVE_CRIT_SECT(wxPendingEventsLocker); wxLEAVE_CRIT_SECT(wxPendingEventsLocker);
// TODO: Wake up idle handler for the other platforms.
#ifdef __WXGTK__
wxWakeUpIdle(); wxWakeUpIdle();
#elif wxUSE_GUI // this works for wxMSW, but may be for others too?
// might also send a dummy message to the top level window, this would
// probably be cleaner?
wxIdleEvent eventIdle;
wxTheApp->OnIdle(eventIdle);
#endif // platform
} }
void wxEvtHandler::ProcessPendingEvents() void wxEvtHandler::ProcessPendingEvents()
@@ -631,6 +623,7 @@ void wxEvtHandler::ProcessPendingEvents()
{ {
event = (wxEvent *)node->Data(); event = (wxEvent *)node->Data();
ProcessEvent(*event); ProcessEvent(*event);
delete event;
delete node; delete node;
node = m_pendingEvents->First(); node = m_pendingEvents->First();
} }

View File

@@ -656,6 +656,12 @@ void wxApp::OnIdle(wxIdleEvent& event)
inOnIdle = FALSE; inOnIdle = FALSE;
} }
void wxWakeUpIdle()
{
// **** please implement me! ****
// Wake up the idle handler processor, even if it is in another thread...
}
// Send idle event to all top-level windows // Send idle event to all top-level windows
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {

View File

@@ -656,6 +656,12 @@ void wxApp::OnIdle(wxIdleEvent& event)
inOnIdle = FALSE; inOnIdle = FALSE;
} }
void wxWakeUpIdle()
{
// **** please implement me! ****
// Wake up the idle handler processor, even if it is in another thread...
}
// Send idle event to all top-level windows // Send idle event to all top-level windows
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {

View File

@@ -483,6 +483,13 @@ void wxApp::OnIdle(wxIdleEvent& event)
inOnIdle = FALSE; inOnIdle = FALSE;
} }
void wxWakeUpIdle()
{
// **** please implement me! ****
// Wake up the idle handler processor, even if it is in another thread...
}
// Send idle event to all top-level windows // Send idle event to all top-level windows
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {

View File

@@ -1168,6 +1168,24 @@ bool wxYield()
return TRUE; return TRUE;
} }
//-----------------------------------------------------------------------------
// wxWakeUpIdle
//-----------------------------------------------------------------------------
void wxWakeUpIdle()
{
// Send the top window a dummy message so idle handler processing will
// start up again. Doing it this way ensures that the idle handler
// wakes up in the right thread.
wxWindow *topWindow = wxTheApp->GetTopWindow();
if ( topWindow ) {
HWND hWnd = (HWND)topWindow->GetHWND();
::PostMessage(hWnd, WM_NULL, 0, 0);
}
}
//-----------------------------------------------------------------------------
wxIcon wxIcon
wxApp::GetStdIcon(int which) const wxApp::GetStdIcon(int which) const
{ {

View File

@@ -767,6 +767,12 @@ void wxApp::OnIdle(
sbInOnIdle = FALSE; sbInOnIdle = FALSE;
} }
void wxWakeUpIdle()
{
// **** please implement me! ****
// Wake up the idle handler processor, even if it is in another thread...
}
// Send idle event to all top-level windows // Send idle event to all top-level windows
bool wxApp::SendIdleEvents() bool wxApp::SendIdleEvents()
{ {