summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp8
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm5
-rw-r--r--src/plugins/platforms/openwfd/qopenwfddevice.cpp4
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.cpp8
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.h3
-rw-r--r--src/plugins/platforms/wayland/qwaylanddisplay.cpp17
-rw-r--r--src/plugins/platforms/wayland/qwaylanddisplay.h2
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.cpp12
-rw-r--r--src/plugins/platforms/wayland/qwaylandintegration.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp16
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp21
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h3
15 files changed, 54 insertions, 57 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 5a31fb5df1..6442f290d2 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -318,7 +318,7 @@ void QGuiApplicationPrivate::createEventDispatcher()
createPlatformIntegration();
if (!eventDispatcher) {
- QAbstractEventDispatcher *eventDispatcher = platform_integration->createEventDispatcher();
+ QAbstractEventDispatcher *eventDispatcher = platform_integration->guiThreadEventDispatcher();
setEventDispatcher(eventDispatcher);
}
}
@@ -327,9 +327,9 @@ void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventD
{
Q_Q(QGuiApplication);
- if (!this->eventDispatcher) {
- this->eventDispatcher = eventDispatcher;
- this->eventDispatcher->setParent(q);
+ if (!QCoreApplicationPrivate::eventDispatcher) {
+ QCoreApplicationPrivate::eventDispatcher = eventDispatcher;
+ QCoreApplicationPrivate::eventDispatcher->setParent(q);
threadData->eventDispatcher = eventDispatcher;
}
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index 35dfe07140..b355f4ff12 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -83,7 +83,7 @@ public:
virtual QPlatformGLContext *createPlatformGLContext(QGuiGLContext *context) const;
// Event dispatcher:
- virtual QAbstractEventDispatcher *createEventDispatcher() const = 0;
+ virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0;
//Deeper window system integrations
virtual QPlatformFontDatabase *fontDatabase() const;
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 5a30de697e..075405a9d6 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -79,13 +79,15 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformGLContext *createPlatformGLContext(QGuiGLContext *context) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;
- QAbstractEventDispatcher *createEventDispatcher() const;
+
+ QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
QPlatformNativeInterface *nativeInterface() const;
private:
QPlatformFontDatabase *mFontDb;
+ QAbstractEventDispatcher *mEventDispatcher;
QCocoaAutoReleasePool *mPool;
};
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 23110583c1..6c10ed6692 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -72,6 +72,7 @@ QCocoaScreen::~QCocoaScreen()
QCocoaIntegration::QCocoaIntegration()
: mFontDb(new QBasicUnixFontDatabase())
+ , mEventDispatcher(new QCocoaEventDispatcher())
{
mPool = new QCocoaAutoReleasePool;
@@ -117,9 +118,9 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi
return new QCocoaBackingStore(window);
}
-QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
+QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
{
- return new QCocoaEventDispatcher();
+ return mEventDispatcher;
}
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
index fb63468725..d3ff6d45d8 100644
--- a/src/plugins/platforms/openwfd/qopenwfddevice.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfddevice.cpp
@@ -83,8 +83,8 @@ QOpenWFDDevice::QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint device_e
}
}
- int copyFd = wfdDeviceEventGetFD(mDevice,mEvent);
- mEventSocketNotifier = new QSocketNotifier(copyFd,QSocketNotifier::Read,this);
+ int fd = wfdDeviceEventGetFD(mDevice,mEvent);
+ mEventSocketNotifier = new QSocketNotifier(fd,QSocketNotifier::Read,this);
connect(mEventSocketNotifier,SIGNAL(activated(int)),SLOT(readEvents()));
mCommitedDevice = true;
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
index 2494e7f030..63d7b6a31f 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
@@ -63,8 +63,9 @@
QOpenWFDIntegration::QOpenWFDIntegration()
: QPlatformIntegration()
, mPrinterSupport(new QGenericUnixPrinterSupport)
+ , mEventDispatcher(createUnixEventDispatcher())
{
- QGuiApplicationPrivate::instance()->setEventDispatcher(createEventDispatcher());
+ QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher);
int numberOfDevices = wfdEnumerateDevices(0,0,0);
WFDint devices[numberOfDevices];
@@ -118,10 +119,9 @@ QPlatformBackingStore *QOpenWFDIntegration::createPlatformBackingStore(QWindow *
return new QOpenWFDBackingStore(window);
}
-QAbstractEventDispatcher *QOpenWFDIntegration::createEventDispatcher() const
+QAbstractEventDispatcher *QOpenWFDIntegration::guiThreadEventDispatcher() const
{
- QAbstractEventDispatcher *eventDispatcher = createUnixEventDispatcher();
- return eventDispatcher;
+ return mEventDispatcher;
}
QPlatformFontDatabase *QOpenWFDIntegration::fontDatabase() const
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h
index 9b7b5329dc..18d87fd90e 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.h
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.h
@@ -62,7 +62,7 @@ public:
QPlatformGLContext *createPlatformGLContext(QGuiGLContext *context) const;
//This should not be a factory interface, but rather a accessor
- QAbstractEventDispatcher *createEventDispatcher() const;
+ QAbstractEventDispatcher *guiThreadEventDispatcher() const;
QPlatformFontDatabase *fontDatabase() const;
@@ -78,6 +78,7 @@ private:
QPlatformFontDatabase *mFontDatabase;
QPlatformNativeInterface *mNativeInterface;
QPlatformPrinterSupport *mPrinterSupport;
+ QAbstractEventDispatcher *mEventDispatcher;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
index ca0e6572cf..588096933c 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 14812885a3..2b7f33f4f6 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay.h
+++ b/src/plugins/platforms/wayland/qwaylanddisplay.h
@@ -92,8 +92,6 @@ public:
QList<QWaylandInputDevice *> 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 d3d7edf0f6..eb4503c829 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 <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+
#include <QtGui/QWindowSystemInterface>
#include <QtGui/QPlatformCursor>
#include <QtGui/QSurfaceFormat>
@@ -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 3c8b996f14..209d5da0da 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<QPlatformScreen *> screens() const;
@@ -73,6 +74,7 @@ public:
private:
QPlatformFontDatabase *mFontDb;
+ QAbstractEventDispatcher *mEventDispatcher;
QWaylandDisplay *mDisplay;
QPlatformNativeInterface *mNativeInterface;
};
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7803b3afe9..0727af4b40 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -114,6 +114,13 @@ QXcbConnection::QXcbConnection(const char *displayName)
if (m_connection)
printf("Successfully connected to display %s\n", m_displayName.constData());
+ QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);
+ connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents()));
+
+ QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher;
+ connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents()));
+ connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents()));
+
xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id);
m_setup = xcb_get_setup(xcb_connection());
@@ -159,15 +166,6 @@ QXcbConnection::~QXcbConnection()
delete m_keyboard;
}
-void QXcbConnection::setEventDispatcher(QAbstractEventDispatcher *dispatcher)
-{
- QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents()));
-
- connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents()));
- connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents()));
-}
-
void QXcbConnection::addWindow(xcb_window_t id, QXcbWindow *window)
{
m_mapper.insert(id, window);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index bc90f5fcdc..6a80f57972 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -232,8 +232,6 @@ public:
QXcbConnection *connection() const { return const_cast<QXcbConnection *>(this); }
- void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
-
const QList<QXcbScreen *> &screens() const { return m_screens; }
int primaryScreen() const { return m_primaryScreen; }
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 313a773c78..7982f8dc0e 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -57,6 +57,9 @@
#include <stdio.h>
+//this has to be included before egl, since egl pulls in X headers
+#include <QtGui/private/qguiapplication_p.h>
+
#ifdef XCB_USE_EGL
#include <EGL/egl.h>
#endif
@@ -78,7 +81,10 @@
QXcbIntegration::QXcbIntegration(const QStringList &parameters)
: m_printerSupport(new QGenericUnixPrinterSupport)
+ , m_eventDispatcher(createUnixEventDispatcher())
{
+ QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher);
+
m_connections << new QXcbConnection;
for (int i = 0; i < parameters.size() - 1; i += 2) {
@@ -94,7 +100,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
m_fontDatabase = new QGenericUnixFontDatabase();
m_nativeInterface = new QXcbNativeInterface;
- m_inputContext = 0;
+ m_inputContext = new QIBusPlatformInputContext;
}
QXcbIntegration::~QXcbIntegration()
@@ -149,18 +155,9 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
}
}
-QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
+QAbstractEventDispatcher *QXcbIntegration::guiThreadEventDispatcher() const
{
- QAbstractEventDispatcher *eventDispatcher = createUnixEventDispatcher();
-
- foreach (QXcbConnection *connection, m_connections)
- connection->setEventDispatcher(eventDispatcher);
-#ifdef XCB_USE_IBUS
- // A bit hacky to do this here, but we need an eventloop before we can instantiate
- // the input context.
- const_cast<QXcbIntegration *>(this)->m_inputContext = new QIBusPlatformInputContext;
-#endif
- return eventDispatcher;
+ return m_eventDispatcher;
}
void QXcbIntegration::moveToScreen(QWindow *window, int screen)
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index d62878c7af..29835f493f 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -61,7 +61,7 @@ public:
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
bool hasCapability(Capability cap) const;
- QAbstractEventDispatcher *createEventDispatcher() const;
+ QAbstractEventDispatcher *guiThreadEventDispatcher() const;
void moveToScreen(QWindow *window, int screen);
@@ -83,6 +83,7 @@ private:
QPlatformPrinterSupport *m_printerSupport;
QPlatformInputContext *m_inputContext;
+ QAbstractEventDispatcher *m_eventDispatcher;
};
QT_END_NAMESPACE