diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb.pro | 3 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 984c8afb9d..fcc17b28b2 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -71,6 +71,11 @@ #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #endif +#define XCB_USE_IBUS +#if defined(XCB_USE_IBUS) +#include "QtPlatformSupport/qibusplatforminputcontext.h" +#endif + QXcbIntegration::QXcbIntegration() : m_connection(new QXcbConnection), m_printerSupport(new QGenericUnixPrinterSupport) { @@ -79,6 +84,8 @@ QXcbIntegration::QXcbIntegration() m_fontDatabase = new QGenericUnixFontDatabase(); m_nativeInterface = new QXcbNativeInterface; + + m_inputContext = 0; } QXcbIntegration::~QXcbIntegration() @@ -141,6 +148,11 @@ QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const { QAbstractEventDispatcher *eventDispatcher = createUnixEventDispatcher(); m_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; } @@ -318,3 +330,8 @@ QPlatformDrag *QXcbIntegration::drag() const { return m_connection->drag(); } + +QPlatformInputContext *QXcbIntegration::inputContext() const +{ + return m_inputContext; +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 1f426ab4e7..a89ffc89c6 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -76,6 +76,8 @@ public: QPlatformClipboard *clipboard() const; QPlatformDrag *drag() const; + QPlatformInputContext *inputContext() const; + private: bool hasOpenGL() const; QList<QPlatformScreen *> m_screens; @@ -84,6 +86,8 @@ private: QPlatformFontDatabase *m_fontDatabase; QPlatformNativeInterface *m_nativeInterface; QPlatformPrinterSupport *m_printerSupport; + + QPlatformInputContext *m_inputContext; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 5c034252d3..adaed53106 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -46,8 +46,14 @@ #include <X11/keysym.h> #include <QtGui/QWindowSystemInterface> #include <QtCore/QTextCodec> +#include <private/qguiapplication_p.h> #include <stdio.h> +#define XCB_USE_IBUS +#if defined(XCB_USE_IBUS) +#include "QtPlatformSupport/qibusplatforminputcontext.h" +#endif + #ifndef XK_ISO_Left_Tab #define XK_ISO_Left_Tab 0xFE20 #endif @@ -1023,6 +1029,11 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod QByteArray chars; xcb_keysym_t sym = lookupString(window, state, code, type, &chars); + + QIBusPlatformInputContext *ic = static_cast<QIBusPlatformInputContext *>(QGuiApplicationPrivate::platformIntegration()->inputContext()); + if (ic && ic->x11FilterEvent(sym, code, state, type == QEvent::KeyPress)) + return; + Qt::KeyboardModifiers modifiers; int qtcode = 0; int count = chars.count(); diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 33a7494133..4b242428fe 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -84,5 +84,8 @@ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB CONFIG += qpa/genericunixfontdatabase +QT += dbus +LIBS += -ldbus-1 + target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target |