kms: Adapt to initialize() pattern

Right now socket notifiers are attempted to be created before having
the event dispatcher up. This is wrong.

Change-Id: Ica3034b9fa790c037f28982db23c71342f6597d7
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Laszlo Agocs 2014-02-11 11:46:14 +01:00 committed by The Qt Project
parent b4fe9ce225
commit 17de86f282
2 changed files with 29 additions and 22 deletions

View File

@ -66,9 +66,28 @@ QT_BEGIN_NAMESPACE
QKmsIntegration::QKmsIntegration()
: QPlatformIntegration(),
m_fontDatabase(new QGenericUnixFontDatabase()),
m_nativeInterface(new QKmsNativeInterface)
m_nativeInterface(new QKmsNativeInterface),
m_vtHandler(0),
m_deviceDiscovery(0)
{
setenv("EGL_PLATFORM", "drm",1);
}
QKmsIntegration::~QKmsIntegration()
{
delete m_deviceDiscovery;
foreach (QKmsDevice *device, m_devices) {
delete device;
}
foreach (QPlatformScreen *screen, m_screens) {
delete screen;
}
delete m_fontDatabase;
delete m_vtHandler;
}
void QKmsIntegration::initialize()
{
qputenv("EGL_PLATFORM", "drm");
m_vtHandler = new QFbVtHandler;
m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_DRM | QDeviceDiscovery::Device_DRM_PrimaryGPU, 0);
@ -88,19 +107,6 @@ QKmsIntegration::QKmsIntegration()
#endif
}
QKmsIntegration::~QKmsIntegration()
{
delete m_deviceDiscovery;
foreach (QKmsDevice *device, m_devices) {
delete device;
}
foreach (QPlatformScreen *screen, m_screens) {
delete screen;
}
delete m_fontDatabase;
delete m_vtHandler;
}
void QKmsIntegration::addDevice(const QString &deviceNode)
{
m_devices.append(new QKmsDevice(deviceNode, this));

View File

@ -60,16 +60,17 @@ public:
QKmsIntegration();
~QKmsIntegration();
bool hasCapability(QPlatformIntegration::Capability cap) const;
void initialize() Q_DECL_OVERRIDE;
bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
QPlatformFontDatabase *fontDatabase() const;
QAbstractEventDispatcher *createEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
QPlatformNativeInterface *nativeInterface() const;
QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
void addScreen(QKmsScreen *screen);
QObject *createDevice(const char *);