summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-07-27 16:54:53 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-07-28 10:06:11 +0200
commitdfd72c6e6c5aab58bd56c8f7854e94df2230bd8d (patch)
tree72cd4bc3aca6135e8be267aaa7aedefd04a7d908 /src/plugins/platforms/xcb
parentb6b853b1b64175c191e776ffbf297bdc9de0a0fd (diff)
Make QPlatformIntegration not have a factory for eventdispatcher
but rather an accessor for the guiThreadEventDispatcher Change-Id: I1b9ba14efc9f338c5a67e3e24ddb0caf76c07413 Reviewed-on: http://codereview.qt.nokia.com/2321 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-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
4 files changed, 18 insertions, 24 deletions
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