diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 440e9b00bc..61b20185c8 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -41,9 +41,13 @@ #include "qdirectfbconvenience.h" #include "qdirectfbblitter.h" +#include "qdirectfbscreen.h" #include +#include +#include + IDirectFB *QDirectFbConvenience::dfbInterface() { static IDirectFB *dfb = 0; @@ -378,3 +382,8 @@ QDirectFbKeyMap::QDirectFbKeyMap() insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); insert(DIKS_TILDE , Qt::Key_AsciiTilde); } + +QDirectFbScreen *toDfbScreen(QWindow *window) +{ + return static_cast(window->screen()->handle()); +} diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index e7c9378ece..39409ac6bd 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -49,6 +49,9 @@ #include + +class QDirectFbScreen; + class QDirectFbKeyMap: public QHash { public: @@ -106,4 +109,7 @@ public: } }; +// Helper conversions from internal to DFB types +QDirectFbScreen *toDfbScreen(QWindow *window); + #endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.cpp b/src/plugins/platforms/directfb/qdirectfbscreen.cpp index fbc3349581..c903a2995c 100644 --- a/src/plugins/platforms/directfb/qdirectfbscreen.cpp +++ b/src/plugins/platforms/directfb/qdirectfbscreen.cpp @@ -63,5 +63,10 @@ QDirectFbScreen::QDirectFbScreen(int display) m_cursor.reset(new QDirectFBCursor(this)); } +IDirectFBDisplayLayer *QDirectFbScreen::dfbLayer() const +{ + return m_layer.data(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.h b/src/plugins/platforms/directfb/qdirectfbscreen.h index 2b2f8d1d89..b719146c90 100644 --- a/src/plugins/platforms/directfb/qdirectfbscreen.h +++ b/src/plugins/platforms/directfb/qdirectfbscreen.h @@ -62,6 +62,9 @@ public: QImage::Format format() const { return m_format; } QSizeF physicalSize() const { return m_physicalSize; } + // DirectFb helpers + IDirectFBDisplayLayer *dfbLayer() const; + public: QRect m_geometry; int m_depth; diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index 0d32596631..4dd968ee60 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -40,18 +40,21 @@ ****************************************************************************/ #include "qdirectfbwindow.h" -#include "qdirectfbinput.h" - #include "qdirectfbbackingstore.h" +#include "qdirectfbinput.h" +#include "qdirectfbscreen.h" + #include QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler) : QPlatformWindow(tlw), m_inputHandler(inputhandler) { - QDirectFBPointer layer(QDirectFbConvenience::dfbDisplayLayer()); DFBDisplayLayerConfig layerConfig; - layer->GetConfiguration(layer.data(), &layerConfig); + IDirectFBDisplayLayer *layer; + + layer = toDfbScreen(tlw)->dfbLayer(); + toDfbScreen(tlw)->dfbLayer()->GetConfiguration(layer, &layerConfig); DFBWindowDescription description; memset(&description,0,sizeof(DFBWindowDescription)); @@ -75,7 +78,7 @@ QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler) description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); description.surface_caps = DSCAPS_PREMULTIPLIED; - DFBResult result = layer->CreateWindow(layer.data(), &description, m_dfbWindow.outPtr()); + DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr()); if (result != DFB_OK) { DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); }