don't use priviledged calls in wxDFB to allow concurrent use of the display by >1...
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 18 Nov 2006 13:17:35 +0000 (13:17 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 18 Nov 2006 13:17:35 +0000 (13:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/dfb/wrapdfb.h
src/dfb/app.cpp
src/dfb/dcscreen.cpp
src/dfb/wrapdfb.cpp

index d4b5467a5e06c03c989d6f3b54ef5f9f990d565e..3e803933269d4582eaef350808d6084bb133cc50 100644 (file)
@@ -426,14 +426,10 @@ struct wxIDirectFBDisplayLayer : public wxDfbWrapper<IDirectFBDisplayLayer>
             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)); }
index fc5357d91f8567f17623b73d06fbdd4de4ea8883..2883ee6f548abb8660119eae10c5fbbccb84fb39 100644 (file)
@@ -67,16 +67,11 @@ void wxApp::CleanUp()
 
 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
index 114f30ba0b4942011521e1e49202445f0788f113..6ccea5aaf3c4f65b3e3ecc4c901fb1463a4fcfa1 100644 (file)
@@ -31,7 +31,7 @@
 // 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)
index afd6ee064b0e8a57d1fa7bfbe790dfbd5cbeebcf..eac0024b2aaf5b6ec308e0901348447436833b71 100644 (file)
@@ -98,8 +98,10 @@ void wxIDirectFB::CleanUp()
 
 wxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface()
 {
-    wxIDirectFBDisplayLayerPtr layer(GetDisplayLayer());
-    return layer ? layer->GetSurface() : NULL;
+    DFBSurfaceDescription desc;
+    desc.flags = DSDESC_CAPS;
+    desc.caps = DSCAPS_PRIMARY;
+    return CreateSurface(&desc);
 }
 
 //-----------------------------------------------------------------------------
@@ -192,3 +194,26 @@ bool wxIDirectFBSurface::FlipToFront(const DFBRegion *region)
     // 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)
+           );
+}