X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb761cd53ccedec382b88e4f9c92dcae3fcdf1ea..7873ca319146f39b4685e8727fde91cf601f4bbe:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index c081dc4ed8..20699cb688 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -65,23 +65,7 @@ WX_CHECK_BUILD_OPTIONS("wxCore") // ---------------------------------------------------------------------------- // this defines wxEventLoopPtr -wxDEFINE_SCOPED_PTR_TYPE(wxEventLoop); - -// but we need a smart pointer tied to wxAppBase::m_mainLoop, so we define -// another helper class -class wxTiedEventLoopPtr : public wxEventLoopPtr -{ -public: - wxTiedEventLoopPtr(wxEventLoop **ppEvtLoop, wxEventLoop *pLoop) - : wxEventLoopPtr(*ppEvtLoop = pLoop), m_ppEvtLoop(ppEvtLoop) - { - } - - ~wxTiedEventLoopPtr() { *m_ppEvtLoop = NULL; } - -private: - wxEventLoop **m_ppEvtLoop; -}; +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop); // ============================================================================ // wxAppBase implementation @@ -156,10 +140,10 @@ void wxAppBase::CleanUp() delete wxTheColourDatabase; wxTheColourDatabase = NULL; -#if wxUSE_THREADS delete wxPendingEvents; wxPendingEvents = NULL; +#if wxUSE_THREADS delete wxPendingEventsLocker; wxPendingEventsLocker = NULL; @@ -256,7 +240,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) return FALSE; } - if ( !SetDisplayMode(wxDisplayModeInfo(w, h, bpp)) ) + if ( !SetDisplayMode(wxVideoMode(w, h, bpp)) ) return FALSE; } #endif // __WXMGL__ @@ -273,7 +257,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) int wxAppBase::MainLoop() { #if wxUSE_EVTLOOP_IN_APP - wxTiedEventLoopPtr mainLoop(&m_mainLoop, new wxEventLoop); + wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop); return m_mainLoop->Run(); #else // !wxUSE_EVTLOOP_IN_APP @@ -286,7 +270,7 @@ void wxAppBase::ExitMainLoop() #if wxUSE_EVTLOOP_IN_APP // we should exit from the main event loop, not just any currently active // (e.g. modal dialog) event loop - if ( m_mainLoop ) + if ( m_mainLoop && m_mainLoop->IsRunning() ) { m_mainLoop->Exit(0); } @@ -313,7 +297,7 @@ bool wxAppBase::Dispatch() // see comment in Pending() wxEventLoop * const loop = wxEventLoop::GetActive(); - return loop ? loop->Dispatch() : true; + return loop && loop->Dispatch(); #else // wxUSE_EVTLOOP_IN_APP return true; #endif // wxUSE_EVTLOOP_IN_APP/!wxUSE_EVTLOOP_IN_APP @@ -481,7 +465,12 @@ void wxAppBase::OnIdle(wxIdleEvent& WXUNUSED(event)) wxLog *wxGUIAppTraitsBase::CreateLogTarget() { +#if wxUSE_LOGGUI return new wxLogGui; +#else + // wem ust have something! + return new wxLogStderr; +#endif } #endif // wxUSE_LOG @@ -537,7 +526,7 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); - switch ( wxMessageBox(msgDlg, wxT("wxWindows Debug Alert"), + switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), wxYES_NO | wxCANCEL | wxICON_STOP ) ) { case wxYES: @@ -599,11 +588,11 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() { -#ifdef __WXMAC__ - // NB: wxMac does not have any GUI-specific functions in gsocket.c and +#if defined(__WXMAC__) && !defined(__DARWIN__) + // NB: wxMac CFM does not have any GUI-specific functions in gsocket.c and // so it doesn't need this table at all return NULL; -#else // !__WXMAC__ +#else // !__WXMAC__ || __DARWIN__ static GSocketGUIFunctionsTable table = { _GSocket_GUI_Init, @@ -618,7 +607,7 @@ GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() _GSocket_Disable_Events }; return &table; -#endif // __WXMAC__/!__WXMAC__ +#endif // !__WXMAC__ || __DARWIN__ } #endif