directfb: Access the screen layer through QWindow::screen()

Instead of assuming which layer was assigned to Qt, resolve the to
be used layer via QWindow::screen()->handle(). Add a method to the
DirectFB QPlatformScreen to provide a pointer to the IDirectFBDisplayLayer

Change-Id: Iaea9466ca84daff752a4932deafbe38f48123715
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
Holger Hans Peter Freyther 2011-11-18 21:09:03 +01:00 committed by Qt by Nokia
parent 0948237d7f
commit 6b22448fa3
5 changed files with 31 additions and 5 deletions

View File

@ -41,9 +41,13 @@
#include "qdirectfbconvenience.h"
#include "qdirectfbblitter.h"
#include "qdirectfbscreen.h"
#include <private/qpixmap_blitter_p.h>
#include <QtGui/QWindow>
#include <QtGui/QScreen>
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<QDirectFbScreen*>(window->screen()->handle());
}

View File

@ -49,6 +49,9 @@
#include <directfb.h>
class QDirectFbScreen;
class QDirectFbKeyMap: public QHash<DFBInputDeviceKeySymbol, Qt::Key>
{
public:
@ -106,4 +109,7 @@ public:
}
};
// Helper conversions from internal to DFB types
QDirectFbScreen *toDfbScreen(QWindow *window);
#endif // QDIRECTFBCONVENIENCE_H

View File

@ -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

View File

@ -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;

View File

@ -40,18 +40,21 @@
****************************************************************************/
#include "qdirectfbwindow.h"
#include "qdirectfbinput.h"
#include "qdirectfbbackingstore.h"
#include "qdirectfbinput.h"
#include "qdirectfbscreen.h"
#include <directfb.h>
QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler)
: QPlatformWindow(tlw), m_inputHandler(inputhandler)
{
QDirectFBPointer<IDirectFBDisplayLayer> 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);
}