]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/app.cpp
trying to work around gcc internal compiler error
[wxWidgets.git] / src / gtk / app.cpp
index 93459c373dd053f08384a0e8cb5d2e4e48f3b8a0..e37f422742a07d78efc95078dbbe0e75b3853f02 100644 (file)
@@ -47,8 +47,8 @@ wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
 
 extern wxList wxPendingDelete;
 #if wxUSE_THREADS
-extern wxList wxPendingEvents;
-extern wxCriticalSection wxPendingEventsLocker;
+extern wxList *wxPendingEvents;
+extern wxCriticalSection *wxPendingEventsLocker;
 #endif
 extern wxResourceCache *wxTheResourceCache;
 
@@ -140,11 +140,11 @@ bool wxYield()
     // 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();
     }
 
@@ -287,9 +287,11 @@ void wxApp::OnIdle( wxIdleEvent &event )
 
     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();
@@ -312,14 +314,15 @@ 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;
 }
 
@@ -377,18 +380,18 @@ void wxApp::Dispatch()
 #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
@@ -411,10 +414,12 @@ void wxApp::DeletePendingObjects()
 
 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 )
@@ -430,6 +435,13 @@ bool wxApp::Initialize()
 
     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();
@@ -490,6 +502,13 @@ void wxApp::CleanUp()
     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;
@@ -565,7 +584,7 @@ int wxEntry( int argc, char *argv[] )
     if (!wxTheApp->OnInit())
         return 0;
 
-    wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0);
+    wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
 
     int retValue = 0;