summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2011-06-22 11:33:17 +0200
committerMorten Johan Sorvig <morten.sorvig@nokia.com>2011-06-22 11:37:42 +0200
commitf1975cfc53412c8ce82df5d857b0d435db53cec8 (patch)
tree67d2ef1babc0c88906e307871ae1e5761194e2c8 /src/plugins/platforms/xcb
parent407a6fe79824b722dbc1224a1be29d26b8fdb729 (diff)
Make xcb work again after event dispatcher changes.
The platform plugin/event dispatcher creation order has now been reversed and the event dispatcher cannot be accessed during plugin construciton.
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp17
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp4
3 files changed, 15 insertions, 9 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index ac8a900d66..1e18077ea2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -138,14 +138,6 @@ QXcbConnection::QXcbConnection(const char *displayName)
#ifdef XCB_USE_DRI2
initializeDri2();
#endif
-
- QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents()));
-
- QAbstractEventDispatcher *dispatcher = QAbstractEventDispatcher::instance(qApp->thread());
- connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents()));
- connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents()));
-
sync();
}
@@ -164,6 +156,15 @@ 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 6cc7e13d02..bc90f5fcdc 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -222,6 +222,7 @@ namespace QXcbAtom {
};
}
+class QAbstractEventDispatcher;
class QXcbConnection : public QObject
{
Q_OBJECT
@@ -231,6 +232,8 @@ 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 2513075f45..984c8afb9d 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -139,7 +139,9 @@ QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *wind
QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
{
- return createUnixEventDispatcher();
+ QAbstractEventDispatcher *eventDispatcher = createUnixEventDispatcher();
+ m_connection->setEventDispatcher(eventDispatcher);
+ return eventDispatcher;
}
QList<QPlatformScreen *> QXcbIntegration::screens() const