X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3c861501a451503b31c075ccb59d16b0ae01e99..04abe4bc8fbddf68ecc9950e2e743e3746ab26b6:/src/dfb/app.cpp?ds=sidebyside diff --git a/src/dfb/app.cpp b/src/dfb/app.cpp index 31bdf0f350..2cac31028b 100644 --- a/src/dfb/app.cpp +++ b/src/dfb/app.cpp @@ -20,6 +20,7 @@ #include "wx/evtloop.h" #include "wx/dfb/private.h" +#include "wx/private/fontmgr.h" //----------------------------------------------------------------------------- // wxApp initialization @@ -39,25 +40,17 @@ wxApp::~wxApp() { } -IDirectFBPtr wxApp::GetDirectFBInterface() -{ - return m_dfb; -} - bool wxApp::Initialize(int& argc, wxChar **argv) { if ( !wxAppBase::Initialize(argc, argv) ) return false; - if ( !DFB_CALL( DirectFBInit(&argc, &argv) ) ) + if ( !wxDfbCheckReturn(DirectFBInit(&argc, &argv)) ) return false; - if ( !DFB_CALL( DirectFBCreate(&m_dfb) ) ) + if ( !wxIDirectFB::Get() ) return false; - #warning "FIXME: theme override is temporary" - wxTheme::Set(wxTheme::Create(_T("gtk"))); - return true; } @@ -65,7 +58,10 @@ void wxApp::CleanUp() { wxAppBase::CleanUp(); - m_dfb.Reset(); + wxFontsManager::CleanUp(); + + wxEventLoop::CleanUp(); + wxIDirectFB::CleanUp(); } //----------------------------------------------------------------------------- @@ -74,16 +70,11 @@ void wxApp::CleanUp() static wxVideoMode GetCurrentVideoMode() { - wxVideoMode m; + wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer()); + if ( !layer ) + return wxVideoMode(); // invalid - IDirectFBSurfacePtr surface(wxDfbGetPrimarySurface()); - if ( !surface ) - return m; // invalid - - DFB_CALL( surface->GetSize(surface, &m.w, &m.h) ); - m.bpp = wxDfbGetSurfaceDepth(surface); - - return m; + return layer->GetVideoMode(); } wxVideoMode wxApp::GetDisplayMode() const @@ -96,7 +87,7 @@ wxVideoMode wxApp::GetDisplayMode() const bool wxApp::SetDisplayMode(const wxVideoMode& mode) { - if ( !DFB_CALL( m_dfb->SetVideoMode(m_dfb, mode.w, mode.h, mode.bpp) ) ) + if ( !wxIDirectFB::Get()->SetVideoMode(mode.w, mode.h, mode.bpp) ) return false; m_videoMode = mode; @@ -114,7 +105,9 @@ void wxApp::WakeUpIdle() wxMutexGuiEnter(); #endif - wxEventLoop::GetActive()->WakeUp(); + wxEventLoop * const loop = wxEventLoop::GetActive(); + if ( loop ) + loop->WakeUp(); #if wxUSE_THREADS if (!wxThread::IsMain()) @@ -146,11 +139,9 @@ bool wxApp::Yield(bool onlyIfNeeded) wxLog::Suspend(); - if ( wxEventLoop::GetActive() ) - { - while (wxEventLoop::GetActive()->Pending()) - wxEventLoop::GetActive()->Dispatch(); - } + wxEventLoop * const loop = wxEventLoop::GetActive(); + if ( loop ) + loop->Yield(); // it's necessary to call ProcessIdle() to update the frames sizes which // might have been changed (it also will update other things set from