QPA: Fix semantics of GUI event dispatcher ownership in platform plugins
The QPlatformIntegration::guiThreadEventDispatcher() function acted as an accessor to event dispatchers created in the constructor of each platform plugin, but the logic and semantics of event-dispatcher handling in Qt itself (QCoreApplication/QGuiApplication) still assumed both ownership and control over the event dispatcher, such as when to create one, which one to create, and when to delete it. This conflicted with the explicit calls in the platform plugins to QGuiApplication::setEventDispatcher(), as well as left a possibility that the event-dispatcher created by the platform plugin would never be deleted, as none of the platform plugins actually took full ownership of the dispatcher and deleted it in its destructor. The integration function has now been renamed back to its old name, createEventDispatcher(), and acts as a factory function, leaving the logic and lifetime of event dispatcher to QtCoreApplication. The only platform left with creating the event-dispatcher in the constructor is QNX, where other parts of the platform relies on having an event-dispatcher before their initialization. We then need to manually take care of the ownership transfer, so that the event-dispatcher is still destroyed at some point. Change-Id: I113db97d2545ebda39ebdefa865e488d2ce9368b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
a2bf063dd4
commit
999e5162ec
@ -1029,27 +1029,23 @@ void QGuiApplicationPrivate::createPlatformIntegration()
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
Called from QCoreApplication::init()
|
||||
|
||||
Responsible for creating an event dispatcher when QCoreApplication
|
||||
decides that it needs one (because a custom one has not been set).
|
||||
*/
|
||||
void QGuiApplicationPrivate::createEventDispatcher()
|
||||
{
|
||||
Q_ASSERT(!eventDispatcher);
|
||||
|
||||
if (platform_integration == 0)
|
||||
createPlatformIntegration();
|
||||
|
||||
if (!eventDispatcher) {
|
||||
QAbstractEventDispatcher *eventDispatcher = platform_integration->guiThreadEventDispatcher();
|
||||
setEventDispatcher(eventDispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
|
||||
{
|
||||
Q_Q(QGuiApplication);
|
||||
|
||||
if (!QCoreApplicationPrivate::eventDispatcher) {
|
||||
QCoreApplicationPrivate::eventDispatcher = eventDispatcher;
|
||||
QCoreApplicationPrivate::eventDispatcher->setParent(q);
|
||||
threadData->eventDispatcher = eventDispatcher;
|
||||
}
|
||||
// The platform integration should not mess with the event dispatcher
|
||||
Q_ASSERT(!eventDispatcher);
|
||||
|
||||
eventDispatcher = platform_integration->createEventDispatcher();
|
||||
}
|
||||
|
||||
#if defined(QT_DEBUG) && defined(Q_OS_LINUX)
|
||||
|
@ -83,8 +83,7 @@ public:
|
||||
~QGuiApplicationPrivate();
|
||||
|
||||
void createPlatformIntegration();
|
||||
void createEventDispatcher();
|
||||
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
|
||||
void createEventDispatcher() Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void notifyLayoutDirectionChange();
|
||||
virtual void notifyActiveWindowChange(QWindow *previous);
|
||||
|
@ -231,17 +231,23 @@ QPlatformServices *QPlatformIntegration::services() const
|
||||
are never repositioned by the window manager. The default implementation returns true.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
\fn QAbstractEventDispatcher *QPlatformIntegration::guiThreadEventDispatcher() const = 0
|
||||
\fn QAbstractEventDispatcher *QPlatformIntegration::createEventDispatcher() const = 0
|
||||
|
||||
Accessor function for the event dispatcher. The platform plugin should create
|
||||
an instance of the QAbstractEventDispatcher in its constructor and set it
|
||||
on the application using QGuiApplicationPrivate::instance()->setEventDispatcher().
|
||||
The event dispatcher is owned by QGuiApplication, the accessor should return
|
||||
a flat pointer.
|
||||
\sa QGuiApplicationPrivate
|
||||
Factory function for the GUI event dispatcher. The platform plugin should create
|
||||
and return a QAbstractEventDispatcher subclass when this function is called.
|
||||
|
||||
If the platform plugin for some reason creates the event dispatcher outside of
|
||||
this function (for example in the constructor), it needs to handle the case
|
||||
where this function is never called, ensuring that the event dispatcher is
|
||||
still deleted at some point (typically in the destructor).
|
||||
|
||||
Note that the platform plugin should never explicitly set the event dispatcher
|
||||
itself, using QCoreApplication::setEventDispatcher(), but let QCoreApplication
|
||||
decide when and which event dispatcher to create.
|
||||
|
||||
\since 5.2
|
||||
*/
|
||||
|
||||
bool QPlatformIntegration::hasCapability(Capability cap) const
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
|
||||
|
||||
// Event dispatcher:
|
||||
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
|
||||
virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
|
||||
|
||||
//Deeper window system integrations
|
||||
virtual QPlatformFontDatabase *fontDatabase() const;
|
||||
|
@ -100,10 +100,6 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
m_eventDispatcher = createUnixEventDispatcher();
|
||||
#endif
|
||||
|
||||
m_androidPlatformNativeInterface = new QAndroidPlatformNativeInterface();
|
||||
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
@ -150,9 +146,9 @@ QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *wind
|
||||
return new QAndroidPlatformWindow(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QAndroidPlatformIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QAndroidPlatformIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
#else // !ANDROID_PLUGIN_OPENGL
|
||||
QPlatformWindow *QAndroidPlatformIntegration::createPlatformWindow(QWindow *window) const
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
QAndroidPlatformScreen *screen() { return m_primaryScreen; }
|
||||
#else
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
@ -147,7 +147,6 @@ private:
|
||||
QTouchDevice *m_touchDevice;
|
||||
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
QAndroidPlatformScreen *m_primaryScreen;
|
||||
#endif
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;
|
||||
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
QPlatformNativeInterface *nativeInterface() const;
|
||||
@ -130,7 +130,6 @@ public:
|
||||
private:
|
||||
|
||||
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||
QAbstractEventDispatcher *mEventDispatcher;
|
||||
|
||||
QScopedPointer<QPlatformInputContext> mInputContext;
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
|
@ -216,7 +216,6 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
|
||||
|
||||
QCocoaIntegration::QCocoaIntegration()
|
||||
: mFontDb(new QCoreTextFontDatabase())
|
||||
, mEventDispatcher(new QCocoaEventDispatcher())
|
||||
, mInputContext(new QCocoaInputContext)
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
, mAccessibility(new QCocoaAccessibility)
|
||||
@ -384,9 +383,9 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
|
||||
return new QCocoaBackingStore(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
|
||||
{
|
||||
return mEventDispatcher;
|
||||
return new QCocoaEventDispatcher;
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
|
||||
|
@ -61,9 +61,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QDirectFbIntegration::QDirectFbIntegration()
|
||||
: m_fontDb(new QGenericUnixFontDatabase())
|
||||
, m_eventDispatcher(createUnixEventDispatcher())
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
}
|
||||
|
||||
void QDirectFbIntegration::initialize()
|
||||
@ -129,9 +127,9 @@ QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) con
|
||||
return dfbWindow;
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
@ -80,7 +80,6 @@ protected:
|
||||
QScopedPointer<QDirectFbInput> m_input;
|
||||
QScopedPointer<QThread> m_inputRunner;
|
||||
QScopedPointer<QPlatformFontDatabase> m_fontDb;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -78,12 +78,9 @@ QT_BEGIN_NAMESPACE
|
||||
static void *eglContextForContext(QOpenGLContext *context);
|
||||
|
||||
QEglFSIntegration::QEglFSIntegration()
|
||||
: mEventDispatcher(createUnixEventDispatcher()),
|
||||
mFontDb(new QGenericUnixFontDatabase),
|
||||
mServices(new QGenericUnixServices)
|
||||
: mFontDb(new QGenericUnixFontDatabase)
|
||||
, mServices(new QGenericUnixServices)
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
|
||||
|
||||
#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
|
||||
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
|
||||
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
|
||||
@ -168,9 +165,9 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
|
||||
return mFontDb.data();
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QEglFSIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const
|
||||
{
|
||||
return mEventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
QPlatformServices *services() const;
|
||||
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
|
||||
|
||||
@ -87,7 +87,6 @@ public:
|
||||
|
||||
private:
|
||||
EGLDisplay mDisplay;
|
||||
QAbstractEventDispatcher *mEventDispatcher;
|
||||
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||
QScopedPointer<QPlatformServices> mServices;
|
||||
QEglFSScreen *mScreen;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
QStringList themeNames() const;
|
||||
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
QPlatformNativeInterface *nativeInterface() const;
|
||||
|
||||
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
|
||||
|
@ -113,7 +113,7 @@ QPlatformOpenGLContext *QIOSIntegration::createPlatformOpenGLContext(QOpenGLCont
|
||||
return new QIOSContext(context);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QIOSIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QIOSIntegration::createEventDispatcher() const
|
||||
{
|
||||
if (isQtApplication())
|
||||
return new QIOSEventDispatcher;
|
||||
|
@ -65,10 +65,8 @@ QT_BEGIN_NAMESPACE
|
||||
QKmsIntegration::QKmsIntegration()
|
||||
: QPlatformIntegration(),
|
||||
m_fontDatabase(new QGenericUnixFontDatabase()),
|
||||
m_eventDispatcher(createUnixEventDispatcher()),
|
||||
m_nativeInterface(new QKmsNativeInterface)
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
setenv("EGL_PLATFORM", "drm",1);
|
||||
m_vtHandler = new QKmsVTHandler;
|
||||
|
||||
@ -152,9 +150,9 @@ void QKmsIntegration::addScreen(QKmsScreen *screen)
|
||||
screenAdded(screen);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QKmsIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QKmsIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QPlatformNativeInterface *QKmsIntegration::nativeInterface() const
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QPlatformNativeInterface *nativeInterface() const;
|
||||
|
||||
@ -84,7 +84,6 @@ private:
|
||||
QList<QPlatformScreen *> m_screens;
|
||||
QList<QKmsDevice *> m_devices;
|
||||
QPlatformFontDatabase *m_fontDatabase;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
QPlatformNativeInterface *m_nativeInterface;
|
||||
QKmsVTHandler *m_vtHandler;
|
||||
QDeviceDiscovery *m_deviceDiscovery;
|
||||
|
@ -54,11 +54,8 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QLinuxFbIntegration::QLinuxFbIntegration(const QStringList ¶mList)
|
||||
: m_fontDb(new QGenericUnixFontDatabase()),
|
||||
m_eventDispatcher(createUnixEventDispatcher())
|
||||
: m_fontDb(new QGenericUnixFontDatabase())
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
|
||||
m_primaryScreen = new QLinuxFbScreen;
|
||||
if (m_primaryScreen->initialize(paramList))
|
||||
screenAdded(m_primaryScreen);
|
||||
@ -92,9 +89,9 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWindow *window) cons
|
||||
return new QFbWindow(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QLinuxFbIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QLinuxFbIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QList<QPlatformScreen *> QLinuxFbIntegration::screens() const
|
||||
|
@ -61,14 +61,13 @@ public:
|
||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
QList<QPlatformScreen *> screens() const;
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
private:
|
||||
QLinuxFbScreen *m_primaryScreen;
|
||||
QPlatformFontDatabase *m_fontDb;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -53,14 +53,8 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QMinimalIntegration::QMinimalIntegration() :
|
||||
#ifdef Q_OS_WIN
|
||||
m_eventDispatcher(new QEventDispatcherWin32())
|
||||
#else
|
||||
m_eventDispatcher(createUnixEventDispatcher())
|
||||
#endif
|
||||
QMinimalIntegration::QMinimalIntegration()
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
QMinimalScreen *mPrimaryScreen = new QMinimalScreen();
|
||||
|
||||
mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320);
|
||||
@ -92,9 +86,13 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow *
|
||||
return new QMinimalBackingStore(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QMinimalIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
#ifdef Q_OS_WIN
|
||||
return new QEventDispatcherWin32;
|
||||
#else
|
||||
return createUnixEventDispatcher();
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -73,10 +73,7 @@ public:
|
||||
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
|
||||
private:
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -110,7 +110,7 @@ QPlatformFontDatabase *QMinimalEglIntegration::fontDatabase() const
|
||||
return mFontDb;
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QMinimalEglIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
|
||||
{
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QVariant styleHint(QPlatformIntegration::StyleHint hint) const;
|
||||
|
||||
|
@ -95,14 +95,12 @@ public:
|
||||
QOffscreenIntegration::QOffscreenIntegration()
|
||||
{
|
||||
#if defined(Q_OS_UNIX)
|
||||
m_eventDispatcher = createUnixEventDispatcher();
|
||||
#if defined(Q_OS_MAC)
|
||||
m_fontDatabase.reset(new QPlatformFontDatabase());
|
||||
#else
|
||||
m_fontDatabase.reset(new QGenericUnixFontDatabase());
|
||||
#endif
|
||||
#elif defined(Q_OS_WIN)
|
||||
m_eventDispatcher = new QOffscreenEventDispatcher<QEventDispatcherWin32>();
|
||||
m_fontDatabase.reset(new QBasicFontDatabase());
|
||||
#endif
|
||||
|
||||
@ -111,7 +109,6 @@ QOffscreenIntegration::QOffscreenIntegration()
|
||||
#endif
|
||||
m_services.reset(new QPlatformServices);
|
||||
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
screenAdded(new QOffscreenScreen);
|
||||
}
|
||||
|
||||
@ -141,9 +138,15 @@ QPlatformBackingStore *QOffscreenIntegration::createPlatformBackingStore(QWindow
|
||||
return new QOffscreenBackingStore(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QOffscreenIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QOffscreenIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
#if defined(Q_OS_UNIX)
|
||||
return createUnixEventDispatcher();
|
||||
#elif defined(Q_OS_WIN)
|
||||
return new QOffscreenEventDispatcher<QEventDispatcherWin32>();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QOffscreenIntegration::fontDatabase() const
|
||||
|
@ -66,12 +66,11 @@ public:
|
||||
QPlatformServices *services() const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
static QOffscreenIntegration *createOffscreenIntegration();
|
||||
|
||||
private:
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
QScopedPointer<QPlatformFontDatabase> m_fontDatabase;
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
QScopedPointer<QPlatformDrag> m_drag;
|
||||
|
@ -63,9 +63,7 @@
|
||||
QOpenWFDIntegration::QOpenWFDIntegration()
|
||||
: QPlatformIntegration()
|
||||
, mPrinterSupport(new QGenericUnixPrinterSupport)
|
||||
, mEventDispatcher(createUnixEventDispatcher())
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
|
||||
int numberOfDevices = wfdEnumerateDevices(0,0,0);
|
||||
|
||||
WFDint devices[numberOfDevices];
|
||||
@ -119,9 +117,9 @@ QPlatformBackingStore *QOpenWFDIntegration::createPlatformBackingStore(QWindow *
|
||||
return new QOpenWFDBackingStore(window);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QOpenWFDIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QOpenWFDIntegration::createEventDispatcher() const
|
||||
{
|
||||
return mEventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QOpenWFDIntegration::fontDatabase() const
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
|
||||
|
||||
//This should not be a factory interface, but rather a accessor
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const;
|
||||
|
||||
@ -78,7 +78,6 @@ private:
|
||||
QPlatformFontDatabase *mFontDatabase;
|
||||
QPlatformNativeInterface *mNativeInterface;
|
||||
QPlatformPrinterSupport *mPrinterSupport;
|
||||
QAbstractEventDispatcher *mEventDispatcher;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -294,6 +294,9 @@ QQnxIntegration::~QQnxIntegration()
|
||||
delete m_bpsEventFilter;
|
||||
#endif
|
||||
|
||||
// In case the event-dispatcher was never transferred to QCoreApplication
|
||||
delete m_eventDispatcher;
|
||||
|
||||
delete m_screenEventHandler;
|
||||
|
||||
// Destroy all displays
|
||||
@ -386,10 +389,15 @@ void QQnxIntegration::moveToScreen(QWindow *window, int screen)
|
||||
platformWindow->setScreen(platformScreen);
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QQnxIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QQnxIntegration::createEventDispatcher() const
|
||||
{
|
||||
qIntegrationDebug() << Q_FUNC_INFO;
|
||||
return m_eventDispatcher;
|
||||
|
||||
// We transfer ownersip of the event-dispatcher to QtCoreApplication
|
||||
QAbstractEventDispatcher *eventDispatcher = m_eventDispatcher;
|
||||
m_eventDispatcher = 0;
|
||||
|
||||
return eventDispatcher;
|
||||
}
|
||||
|
||||
QPlatformNativeInterface *QQnxIntegration::nativeInterface() const
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
|
||||
bool supportsNavigatorEvents() const;
|
||||
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; }
|
||||
|
||||
@ -158,7 +158,7 @@ private:
|
||||
#endif
|
||||
QQnxServices *m_services;
|
||||
QPlatformFontDatabase *m_fontDatabase;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
mutable QAbstractEventDispatcher *m_eventDispatcher;
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QQnxBpsEventFilter *m_bpsEventFilter;
|
||||
#endif
|
||||
|
@ -315,7 +315,6 @@ struct QWindowsIntegrationPrivate
|
||||
QWindowsDrag m_drag;
|
||||
# endif
|
||||
#endif
|
||||
QWindowsGuiEventDispatcher *m_eventDispatcher;
|
||||
#if defined(QT_OPENGL_ES_2)
|
||||
QEGLStaticContextPtr m_staticEGLContext;
|
||||
#elif !defined(QT_NO_OPENGL)
|
||||
@ -356,7 +355,6 @@ static inline unsigned parseOptions(const QStringList ¶mList)
|
||||
QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mList)
|
||||
: m_options(parseOptions(paramList))
|
||||
, m_fontDatabase(0)
|
||||
, m_eventDispatcher(new QWindowsGuiEventDispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
@ -369,7 +367,6 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
|
||||
QWindowsIntegration::QWindowsIntegration(const QStringList ¶mList) :
|
||||
d(new QWindowsIntegrationPrivate(paramList))
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher);
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
d->m_clipboard.registerViewer();
|
||||
#endif
|
||||
@ -635,9 +632,9 @@ QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const
|
||||
}
|
||||
#endif
|
||||
|
||||
QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher * QWindowsIntegration::createEventDispatcher() const
|
||||
{
|
||||
return d->m_eventDispatcher;
|
||||
return new QWindowsGuiEventDispatcher;
|
||||
}
|
||||
|
||||
QStringList QWindowsIntegration::themeNames() const
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
#ifndef QT_NO_OPENGL
|
||||
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
|
||||
#endif
|
||||
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
virtual QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
virtual QPlatformClipboard *clipboard() const;
|
||||
# ifndef QT_NO_DRAGANDDROP
|
||||
|
@ -124,12 +124,9 @@ static bool runningUnderDebugger()
|
||||
#endif
|
||||
|
||||
QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char **argv)
|
||||
: m_eventDispatcher(createUnixEventDispatcher())
|
||||
, m_services(new QGenericUnixServices)
|
||||
: m_services(new QGenericUnixServices)
|
||||
, m_instanceName(0)
|
||||
{
|
||||
QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
|
||||
|
||||
#ifdef XCB_USE_XLIB
|
||||
XInitThreads();
|
||||
#endif
|
||||
@ -293,9 +290,9 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
}
|
||||
}
|
||||
|
||||
QAbstractEventDispatcher *QXcbIntegration::guiThreadEventDispatcher() const
|
||||
QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
|
||||
{
|
||||
return m_eventDispatcher;
|
||||
return createUnixEventDispatcher();
|
||||
}
|
||||
|
||||
void QXcbIntegration::moveToScreen(QWindow *window, int screen)
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
|
||||
|
||||
bool hasCapability(Capability cap) const;
|
||||
QAbstractEventDispatcher *guiThreadEventDispatcher() const;
|
||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||
|
||||
void moveToScreen(QWindow *window, int screen);
|
||||
|
||||
@ -112,7 +112,6 @@ private:
|
||||
QScopedPointer<QXcbNativeInterface> m_nativeInterface;
|
||||
|
||||
QScopedPointer<QPlatformInputContext> m_inputContext;
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
QScopedPointer<QPlatformAccessibility> m_accessibility;
|
||||
|
Loading…
Reference in New Issue
Block a user