directfb: Allow a window subclass to allocate a different kind of surface
A subclass of QDirectFbWindow might need to allocate a window with different surface flags. This is the case for the DirectFB EGL plugin and QSurface::OpenGLSurface type of surfaces. Add createDirectFBWindow, make it virtual and call it from the platform integration classes. Add an assert to verify that this method is only called once. Remove the pre DirectFb 1.1 code as it was never really tested. Change-Id: Icf3d262f40bca70e376043935eeb292958f6df5d Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>bb10
parent
56fca8ce14
commit
9e424adbdd
|
|
@ -203,7 +203,9 @@ EGLSurface QDirectFbEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *s
|
|||
|
||||
QPlatformWindow *QDirectFbIntegrationEGL::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
return new QDirectFbWindowEGL(window, m_input.data());
|
||||
QDirectFbWindow *dfbWindow = new QDirectFbWindowEGL(window, m_input.data());
|
||||
dfbWindow->createDirectFBWindow();
|
||||
return dfbWindow;
|
||||
}
|
||||
|
||||
QPlatformOpenGLContext *QDirectFbIntegrationEGL::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::Pix
|
|||
|
||||
QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) const
|
||||
{
|
||||
return new QDirectFbWindow(window,m_input.data());
|
||||
QDirectFbWindow *dfbWindow = new QDirectFbWindow(window, m_input.data());
|
||||
dfbWindow->createDirectFBWindow();
|
||||
return dfbWindow;
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const
|
||||
|
|
|
|||
|
|
@ -53,41 +53,41 @@ QT_BEGIN_NAMESPACE
|
|||
QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler)
|
||||
: QPlatformWindow(tlw), m_inputHandler(inputhandler)
|
||||
{
|
||||
}
|
||||
|
||||
void QDirectFbWindow::createDirectFBWindow()
|
||||
{
|
||||
Q_ASSERT(!m_dfbWindow.data());
|
||||
|
||||
DFBDisplayLayerConfig layerConfig;
|
||||
IDirectFBDisplayLayer *layer;
|
||||
|
||||
layer = toDfbScreen(tlw)->dfbLayer();
|
||||
toDfbScreen(tlw)->dfbLayer()->GetConfiguration(layer, &layerConfig);
|
||||
layer = toDfbScreen(window())->dfbLayer();
|
||||
layer->GetConfiguration(layer, &layerConfig);
|
||||
|
||||
DFBWindowDescription description;
|
||||
memset(&description,0,sizeof(DFBWindowDescription));
|
||||
description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS
|
||||
#if DIRECTFB_MINOR_VERSION >= 1
|
||||
|DWDESC_OPTIONS
|
||||
#endif
|
||||
|DWDESC_CAPS);
|
||||
description.width = qMax(1, tlw->width());
|
||||
description.height = qMax(1, tlw->height());
|
||||
description.posx = tlw->x();
|
||||
description.posy = tlw->y();
|
||||
description.width = qMax(1, window()->width());
|
||||
description.height = qMax(1, window()->height());
|
||||
description.posx = window()->x();
|
||||
description.posy = window()->y();
|
||||
|
||||
if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED)
|
||||
description.surface_caps = DSCAPS_PREMULTIPLIED;
|
||||
description.pixelformat = layerConfig.pixelformat;
|
||||
|
||||
#if DIRECTFB_MINOR_VERSION >= 1
|
||||
description.options = DFBWindowOptions(DWOP_ALPHACHANNEL);
|
||||
#endif
|
||||
description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL);
|
||||
|
||||
DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
|
||||
if (result != DFB_OK) {
|
||||
if (result != DFB_OK)
|
||||
DirectFBError("QDirectFbWindow: failed to create window", result);
|
||||
}
|
||||
|
||||
m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
|
||||
|
||||
m_inputHandler->addWindow(m_dfbWindow.data(), tlw);
|
||||
m_inputHandler->addWindow(m_dfbWindow.data(), window());
|
||||
}
|
||||
|
||||
QDirectFbWindow::~QDirectFbWindow()
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public:
|
|||
void lower();
|
||||
WId winId() const;
|
||||
|
||||
virtual void createDirectFBWindow();
|
||||
IDirectFBWindow *dfbWindow() const;
|
||||
|
||||
// helper to get access to DirectFB types
|
||||
|
|
|
|||
Loading…
Reference in New Issue