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
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();
}
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
- void eventDispatcherCreated(QAbstractEventDispatcher *dispatcher);
-
public slots:
void createNewScreen(struct wl_output *output, QRect geometry);
void readEvents();
#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h"
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+
#include <QtGui/QWindowSystemInterface>
#include <QtGui/QPlatformCursor>
#include <QtGui/QSurfaceFormat>
QWaylandIntegration::QWaylandIntegration()
: mFontDb(new QGenericUnixFontDatabase())
- , mDisplay(new QWaylandDisplay())
+ , mEventDispatcher(createUnixEventDispatcher())
, mNativeInterface(new QWaylandNativeInterface)
{
+ QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
+ mDisplay = new QWaylandDisplay();
}
QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const
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
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<QPlatformScreen *> screens() const;
private:
QPlatformFontDatabase *mFontDb;
+ QAbstractEventDispatcher *mEventDispatcher;
QWaylandDisplay *mDisplay;
QPlatformNativeInterface *mNativeInterface;
};