X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5109ae5d178fb4025c6b92bb2f840c07dae99a82..e1983ab58804a0e32ab2d832ded0349af1cc0476:/src/motif/app.cpp diff --git a/src/motif/app.cpp b/src/motif/app.cpp index c01b74f67c..d17e8fc734 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "app.h" #endif @@ -71,7 +71,7 @@ wxHashTable *wxWidgetHashTable = NULL; IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxApp::OnIdle) + EVT_IDLE(wxAppBase::OnIdle) END_EVENT_TABLE() #ifdef __WXDEBUG__ @@ -120,7 +120,7 @@ wxApp::wxApp() argc = 0; argv = NULL; - m_eventLoop = new wxEventLoop; + m_mainLoop = new wxEventLoop; m_mainColormap = (WXColormap) NULL; m_appContext = (WXAppContext) NULL; m_initialDisplay = (WXDisplay*) 0; @@ -129,7 +129,7 @@ wxApp::wxApp() wxApp::~wxApp() { - delete m_eventLoop; + delete m_mainLoop; for( wxPerDisplayDataMap::iterator it = m_perDisplayData->begin(), end = m_perDisplayData->end(); @@ -141,15 +141,7 @@ wxApp::~wxApp() delete m_perDisplayData; - wxTheApp = NULL; -} - -bool wxApp::Initialized() -{ - if (GetTopWindow()) - return TRUE; - else - return FALSE; + wxApp::SetInstance(NULL); } int wxApp::MainLoop() @@ -165,36 +157,11 @@ int wxApp::MainLoop() XDefaultRootWindow(XtDisplay((Widget) wxTheApp->GetTopLevelWidget())), PropertyChangeMask); - m_eventLoop->Run(); + m_mainLoop->Run(); return 0; } -void wxApp::ExitMainLoop() -{ - if( m_eventLoop->IsRunning() ) - m_eventLoop->Exit(); -} - -// Is a message/event pending? -bool wxApp::Pending() -{ - return m_eventLoop->Pending(); -#if 0 - XFlush(XtDisplay( (Widget) wxTheApp->GetTopLevelWidget() )); - - // Fix by Doug from STI, to prevent a stall if non-X event - // is found. - return ((XtAppPending( (XtAppContext) GetAppContext() ) & XtIMXEvent) != 0) ; -#endif -} - -// Dispatch a message. -void wxApp::Dispatch() -{ - m_eventLoop->Dispatch(); -} - // This should be redefined in a derived class for // handling property change events for XAtom IPC. void wxApp::HandlePropertyChange(WXEvent *event) @@ -203,48 +170,6 @@ void wxApp::HandlePropertyChange(WXEvent *event) XtDispatchEvent((XEvent*) event); /* let Motif do the work */ } -void wxApp::OnIdle(wxIdleEvent& event) -{ - static bool inOnIdle = FALSE; - - // Avoid recursion (via ProcessEvent default case) - if (inOnIdle) - return; - - inOnIdle = TRUE; - - // If there are pending events, we must process them: pending events - // are either events to the threads other than main or events posted - // with wxPostEvent() functions - // GRG: I have moved this here so that all pending events are processed - // before starting to delete any objects. This behaves better (in - // particular, wrt wxPostEvent) and is coherent with wxGTK's current - // behaviour. Also removed the '#if wxUSE_THREADS' around it. - // Changed Mar/2000 before 2.1.14 - - // Flush pending events. - ProcessPendingEvents(); - - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); - - // flush the logged messages if any - wxLog *pLog = wxLog::GetActiveTarget(); - if ( pLog != NULL && pLog->HasPendingMessages() ) - pLog->Flush(); - - // Now done in ProcessIdle() -#if 0 - // Send OnIdle events to all windows - bool needMore = SendIdleEvents(); - - if (needMore) - event.RequestMore(TRUE); -#endif - - inOnIdle = FALSE; -} - static char *fallbackResources[] = { "*menuBar.marginHeight: 0", "*menuBar.shadowThickness: 1", @@ -379,7 +304,7 @@ void wxApp::SetTopLevelWidget(WXDisplay* display, WXWidget widget) bool wxApp::Yield(bool onlyIfNeeded) { - bool s_inYield = FALSE; + static bool s_inYield = FALSE; if ( s_inYield ) {