From 3e74b2df1bff8d34409a3e99422d203ff8d7a4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 27 Jul 2011 16:54:53 +0200 Subject: Make QPlatformIntegration not have a factory for eventdispatcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit but rather an accessor for the guiThreadEventDispatcher Change-Id: I1b9ba14efc9f338c5a67e3e24ddb0caf76c07413 Reviewed-on: http://codereview.qt.nokia.com/2321 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 17 +++++++---------- src/plugins/platforms/wayland/qwaylanddisplay.h | 2 -- src/plugins/platforms/wayland/qwaylandintegration.cpp | 12 +++++++----- src/plugins/platforms/wayland/qwaylandintegration.h | 4 +++- 4 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ca0e6572c..588096933 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -142,6 +142,13 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); + mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); + + mReadNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this); + connect(mReadNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); + #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); #endif @@ -156,16 +163,6 @@ QWaylandDisplay::QWaylandDisplay(void) mEglIntegration->initialize(); #endif - mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); -} - -void QWaylandDisplay::eventDispatcherCreated(QAbstractEventDispatcher *dispatcher) -{ - connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); - - mReadNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this); - connect(mReadNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); - waitForScreens(); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 14812885a..2b7f33f4f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -92,8 +92,6 @@ public: QList inputDevices() const { return mInputDevices; } - void eventDispatcherCreated(QAbstractEventDispatcher *dispatcher); - public slots: void createNewScreen(struct wl_output *output, QRect geometry); void readEvents(); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index d3d7edf0f..eb4503c82 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -51,6 +51,8 @@ #include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" #include +#include + #include #include #include @@ -61,9 +63,11 @@ QWaylandIntegration::QWaylandIntegration() : mFontDb(new QGenericUnixFontDatabase()) - , mDisplay(new QWaylandDisplay()) + , mEventDispatcher(createUnixEventDispatcher()) , mNativeInterface(new QWaylandNativeInterface) { + QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); + mDisplay = new QWaylandDisplay(); } QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const @@ -116,11 +120,9 @@ QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow * return new QWaylandShmBackingStore(window); } -QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const +QAbstractEventDispatcher *QWaylandIntegration::guiThreadEventDispatcher() const { - QAbstractEventDispatcher *dispatcher = createUnixEventDispatcher(); - mDisplay->eventDispatcherCreated(dispatcher); - return dispatcher; + return mEventDispatcher; } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index 3c8b996f1..209d5da0d 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -59,7 +59,8 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - QAbstractEventDispatcher *createEventDispatcher() const; + + QAbstractEventDispatcher *guiThreadEventDispatcher() const; QList screens() const; @@ -73,6 +74,7 @@ public: private: QPlatformFontDatabase *mFontDb; + QAbstractEventDispatcher *mEventDispatcher; QWaylandDisplay *mDisplay; QPlatformNativeInterface *mNativeInterface; }; -- cgit v1.2.3