extern char *wxOsVersion;
extern wxList *wxWinHandleList;
extern wxList WXDLLEXPORT wxPendingDelete;
+#if wxUSE_THREADS
+extern wxList wxPendingEvents;
+extern wxCriticalSection wxPendingEventsLocker;
+#endif
extern void wxSetKeyboardHook(bool doIt);
extern wxCursor *g_globalCursor;
char name[260]; // 260 is MAX_PATH value from windef.h
::GetModuleFileName(wxhInstance, name, WXSIZEOF(name));
- // GNUWIN32 already fills in the first arg with the application name.
- // JACS: apparently not now (b20 and above?)
-#if 0 // !defined(__GNUWIN32__)
args.Add(name);
- count ++;
-#endif
+ count++;
strcpy(name, wxFileNameFromPath(name));
wxStripExtension(name);
// (double deletion of the cursor).
wxSetCursor(wxNullCursor);
delete g_globalCursor;
+ g_globalCursor = NULL;
wxDeleteStockObjects() ;
// blocks that aren't part of the wxDebugContext itself,
// as a special case. Then when dumping we need to ignore
// wxDebugContext, too.
- if (wxDebugContext::CountObjectsLeft() > 0)
+ if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
{
wxLogDebug("There were memory leaks.");
wxDebugContext::Dump();
{
}
+
DoMessage();
+
+ // If they are pending events, we must process them.
+#if wxUSE_THREADS
+ ProcessPendingEvents();
+#endif
}
return s_currentMsg.wParam;
return event.MoreRequested();
}
+#if wxUSE_THREADS
+void wxApp::ProcessPendingEvents()
+{
+ wxNode *node = wxPendingEvents.First();
+ wxCriticalSectionLocker locker(wxPendingEventsLocker);
+
+ while (node)
+ {
+ wxEvtHandler *handler = (wxEvtHandler *)node->Data();
+
+ handler->ProcessPendingEvents();
+
+ delete node;
+ node = wxPendingEvents.First();
+ }
+}
+#endif
+
+
void wxApp::ExitMainLoop()
{
m_keepGoing = FALSE;
* the message. Some may have accelerator tables, or have
* MDI complications.
*/
+
bool wxApp::ProcessMessage(WXMSG *wxmsg)
{
MSG *msg = (MSG *)wxmsg;
bool wxApp::SendIdleEvents()
{
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 (m_topWindow)
return m_topWindow;
- else if (wxTopLevelWindows.Number() > 0)
- return (wxWindow*) wxTopLevelWindows.First()->Data();
+ else if (wxTopLevelWindows.GetCount() > 0)
+ return wxTopLevelWindows.GetFirst()->GetData();
else
return NULL;
}