extern wxList wxPendingDelete;
#if wxUSE_THREADS
-extern wxList wxPendingEvents;
-extern wxCriticalSection wxPendingEventsLocker;
+extern wxList *wxPendingEvents;
+extern wxCriticalSection *wxPendingEventsLocker;
#endif
extern wxResourceCache *wxTheResourceCache;
// it's necessary to call ProcessIdle() to update the frames sizes which
// might have been changed (it also will update other things set from
// OnUpdateUI() which is a nice (and desired) side effect)
- for ( wxNode *node = wxTopLevelWindows.GetFirst();
+ for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
- wxWindow *win = ((wxWindow*)node->GetData());
+ wxWindow *win = node->GetData();
win->OnInternalIdle();
}
inOnIdle = TRUE;
+#if wxUSE_THREADS
/* Resend in the main thread events which have been prepared in other
threads */
ProcessPendingEvents();
+#endif
/* 'Garbage' collection of windows deleted with Close(). */
DeletePendingObjects();
{
bool needMore = FALSE;
- wxNode* node = wxTopLevelWindows.First();
+ wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
while (node)
{
- wxWindow* win = (wxWindow*) node->Data();
+ wxWindow* win = node->GetData();
if (SendIdleEvents(win))
needMore = TRUE;
- node = node->Next();
+ node = node->GetNext();
}
+
return needMore;
}
#if wxUSE_THREADS
void wxApp::ProcessPendingEvents()
{
- wxNode *node = wxPendingEvents.First();
- wxCriticalSectionLocker locker(wxPendingEventsLocker);
+ wxNode *node = wxPendingEvents->First();
+ wxCriticalSectionLocker locker(*wxPendingEventsLocker);
while (node)
{
wxEvtHandler *handler = (wxEvtHandler *)node->Data();
handler->ProcessPendingEvents();
-
+
delete node;
- node = wxPendingEvents.First();
+ node = wxPendingEvents->First();
}
}
#endif
wxWindow *wxApp::GetTopWindow()
{
- if (m_topWindow) return m_topWindow;
- wxNode *node = wxTopLevelWindows.First();
- if (!node) return (wxWindow *) NULL;
- return (wxWindow*)node->Data();
+ if (m_topWindow)
+ return m_topWindow;
+ else if (wxTopLevelWindows.GetCount() > 0)
+ return wxTopLevelWindows.GetFirst()->GetData();
+ else
+ return NULL;
}
void wxApp::SetTopWindow( wxWindow *win )
wxSystemSettings::Init();
+ // GL: I'm annoyed ... I don't know where to put this and I don't want to
+ // create a module for that as it's part of the core.
+#if wxUSE_THREADS
+ wxPendingEvents = new wxList();
+ wxPendingEventsLocker = new wxCriticalSection();
+#endif
+
/*
wxTheFontNameDirectory = new wxFontNameDirectory;
wxTheFontNameDirectory->Initialize();
delete wxTheApp;
wxTheApp = (wxApp*) NULL;
+ // GL: I'm annoyed ... I don't know where to put this and I don't want to
+ // create a module for that as it's part of the core.
+#if wxUSE_THREADS
+ delete wxPendingEvents;
+ delete wxPendingEventsLocker;
+#endif
+
wxSystemSettings::Done();
delete[] wxBuffer;
if (!wxTheApp->OnInit())
return 0;
- wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0);
+ wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
int retValue = 0;