diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2013-10-02 14:20:06 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-07 19:09:37 +0200 |
commit | cf092abdfc888f19a607a43c9b4bac776b5c1f8e (patch) | |
tree | deaef143d4e310d73f0fbf7e839ddbd1c7cf2eb1 /src/gui | |
parent | 8a383c585f337320a203e26c505b594c949d59e5 (diff) |
QPA: Fix event dispatcher dependent operations in platform integration
999e5162ec3e86c9cb84c3ec95dfd0ba4b21277f breaks QPlatformIntegration
implementations that perform tasks in their constructor that rely on
the event dispatcher. For example creating a QSocketNotifier is not
possible anymore since the event dispatcher is created later on.
This is fixed by introducing an additional virtual in
QPlatformIntegration that gets called after createEventDispatcher().
Two broken platform plugins have been identified so far: eglfs is
creating socket notifiers to read events from input devices and xcb's
input context plugins may use dbus. Both are updated accordingly.
Task-number: QTBUG-33768
Change-Id: I5badb623958a52ab5314ff93dd7d60061f5df70a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index bde8d99a1c..c7eefdbefa 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1048,6 +1048,14 @@ void QGuiApplicationPrivate::createEventDispatcher() eventDispatcher = platform_integration->createEventDispatcher(); } +void QGuiApplicationPrivate::eventDispatcherReady() +{ + if (platform_integration == 0) + createPlatformIntegration(); + + platform_integration->initialize(); +} + #if defined(QT_DEBUG) && defined(Q_OS_LINUX) // Find out if our parent process is gdb by looking at the 'exe' symlink under /proc. static bool runningUnderDebugger() diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 91c63e54c5..d1716a6e28 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -84,6 +84,7 @@ public: void createPlatformIntegration(); void createEventDispatcher() Q_DECL_OVERRIDE; + void eventDispatcherReady() Q_DECL_OVERRIDE; virtual void notifyLayoutDirectionChange(); virtual void notifyActiveWindowChange(QWindow *previous); diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 3f93856349..22d6746ce0 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -291,6 +291,18 @@ QPaintEngine *QPlatformIntegration::createImagePaintEngine(QPaintDevice *paintDe } /*! + Performs initialization steps that depend on having an event dispatcher + available. Called after the event dispatcher has been created. + + Tasks that require an event dispatcher, for example creating socket notifiers, cannot be + performed in the constructor. Instead, they should be performed here. The default + implementation does nothing. +*/ +void QPlatformIntegration::initialize() +{ +} + +/*! Returns the platforms input context. The default implementation returns 0, implying no input method support. diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 0af74370b5..d3189f8641 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -112,6 +112,7 @@ public: // Event dispatcher: virtual QAbstractEventDispatcher *createEventDispatcher() const = 0; + virtual void initialize(); //Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; |