return NULL;
}
- wxIDirectFBSurfacePtr GetSurface()
- {
- IDirectFBSurface *s;
- if ( Check(m_ptr->GetSurface(m_ptr, &s)) )
- return new wxIDirectFBSurface(s);
- else
- return NULL;
- }
+ bool GetConfiguration(DFBDisplayLayerConfig *config)
+ { return Check(m_ptr->GetConfiguration(m_ptr, config)); }
+
+ wxVideoMode GetVideoMode();
bool GetCursorPosition(int *x, int *y)
{ return Check(m_ptr->GetCursorPosition(m_ptr, x, y)); }
static wxVideoMode GetCurrentVideoMode()
{
- wxVideoMode m;
+ wxIDirectFBDisplayLayerPtr layer(wxIDirectFB::Get()->GetDisplayLayer());
+ if ( !layer )
+ return wxVideoMode(); // invalid
- wxIDirectFBSurfacePtr surface(wxIDirectFB::Get()->GetPrimarySurface());
- if ( !surface )
- return m; // invalid
-
- surface->GetSize(&m.w, &m.h);
- m.bpp = surface->GetDepth();
-
- return m;
+ return layer->GetVideoMode();
}
wxVideoMode wxApp::GetDisplayMode() const
// wxScreenDC
//-----------------------------------------------------------------------------
-#warning "FIXME: verify that wxScreenDC works in 2nd DirectFB app started"
+#warning "FIXME: this doesn't work (neither single app nor multiapp core)
// FIXME: maybe use a subsurface as well?
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxDC)
wxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface()
{
- wxIDirectFBDisplayLayerPtr layer(GetDisplayLayer());
- return layer ? layer->GetSurface() : NULL;
+ DFBSurfaceDescription desc;
+ desc.flags = DSDESC_CAPS;
+ desc.caps = DSCAPS_PRIMARY;
+ return CreateSurface(&desc);
}
//-----------------------------------------------------------------------------
// drawings:
return Flip(region, DSFLIP_BLIT);
}
+
+//-----------------------------------------------------------------------------
+// wxIDirectFBDisplayLayer
+//-----------------------------------------------------------------------------
+
+wxVideoMode wxIDirectFBDisplayLayer::GetVideoMode()
+{
+ DFBDisplayLayerConfig cfg;
+ if ( !GetConfiguration(&cfg) )
+ return wxVideoMode(); // invalid
+
+ if ( !((cfg.flags & DLCONF_WIDTH) &&
+ (cfg.flags & DLCONF_HEIGHT) &&
+ (cfg.flags & DLCONF_PIXELFORMAT)) )
+ return wxVideoMode(); // invalid
+
+ return wxVideoMode
+ (
+ cfg.width,
+ cfg.height,
+ DFB_BITS_PER_PIXEL(cfg.pixelformat)
+ );
+}