summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp5
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h2
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp31
-rw-r--r--src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h1
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp15
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp4
7 files changed, 39 insertions, 21 deletions
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index 328d4f5b74..6482d4a34a 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -52,6 +52,11 @@ QPlatformInputContext::~QPlatformInputContext()
{
}
+bool QPlatformInputContext::isValid() const
+{
+ return false;
+}
+
void QPlatformInputContext::reset()
{
}
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 804200708a..35763edf13 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -60,6 +60,8 @@ public:
QPlatformInputContext();
virtual ~QPlatformInputContext();
+ virtual bool isValid() const;
+
virtual void reset();
virtual void commit();
virtual void update(Qt::InputMethodQueries);
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
index 255ed71fe2..494431e624 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
+++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp
@@ -46,14 +46,13 @@
#include "qguiapplication.h"
#include "qdebug.h"
+#include <stdlib.h>
QT_BEGIN_NAMESPACE
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QPlatformInputContextFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
QStringList QPlatformInputContextFactory::keys()
@@ -79,5 +78,33 @@ QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key)
return ret;
}
+QPlatformInputContext *QPlatformInputContextFactory::create()
+{
+ QPlatformInputContext *ic = 0;
+
+ QString icString = QString::fromLatin1(getenv("QT_IM_MODULE"));
+ ic = create(icString);
+ qDebug() << ic << ic->isValid();
+ if (ic && ic->isValid())
+ return ic;
+
+ delete ic;
+ ic = 0;
+
+ QStringList k = keys();
+ for (int i = 0; i < k.size(); ++i) {
+ if (k.at(i) == icString)
+ continue;
+ ic = create(k.at(i));
+ if (ic && ic->isValid())
+ return ic;
+ delete ic;
+ ic = 0;
+ }
+
+ return 0;
+}
+
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
index ea7f4f1319..5c42931357 100644
--- a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
+++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h
@@ -68,6 +68,7 @@ class QPlatformInputContextFactory
public:
static QStringList keys();
static QPlatformInputContext *create(const QString &key);
+ static QPlatformInputContext *create();
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index b6e40489c0..84b578db16 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -53,7 +53,7 @@ public:
QIBusPlatformInputContext();
~QIBusPlatformInputContext();
- Q_INVOKABLE bool isValid() const;
+ bool isValid() const;
void invokeAction(QInputPanel::Action a, int x);
void reset(void);
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index db3bcf90a8..b0d377bcac 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -62,10 +62,8 @@
#include <EGL/egl.h>
#endif
-#if defined(XCB_USE_IBUS)
#include <private/qplatforminputcontextfactory_qpa_p.h>
#include <qplatforminputcontext_qpa.h>
-#endif
#if defined(XCB_USE_GLX)
#include "qglxintegration.h"
@@ -101,18 +99,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters)
m_fontDatabase = new QGenericUnixFontDatabase();
m_nativeInterface = new QXcbNativeInterface;
- m_inputContext = 0;
-#if defined(XCB_USE_IBUS)
- QPlatformInputContext *platformInputContext = QPlatformInputContextFactory::create("ibus");
- if (platformInputContext) {
- bool retval;
- QMetaObject::invokeMethod(platformInputContext, "isValid", Qt::DirectConnection, Q_RETURN_ARG(bool, retval));
- if (retval)
- m_inputContext = platformInputContext;
- }
- if (platformInputContext && !m_inputContext)
- delete platformInputContext;
-#endif
+ m_inputContext = QPlatformInputContextFactory::create();
}
QXcbIntegration::~QXcbIntegration()
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index c445dbfe2a..907dd0f1b6 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -49,9 +49,7 @@
#include <private/qguiapplication_p.h>
#include <stdio.h>
-#if defined(XCB_USE_IBUS)
#include <qplatforminputcontext_qpa.h>
-#endif
#ifndef XK_ISO_Left_Tab
#define XK_ISO_Left_Tab 0xFE20
@@ -1030,7 +1028,6 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
xcb_keysym_t sym = lookupString(window, state, code, type, &chars);
-#if defined(XCB_USE_IBUS)
if (QObject* inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext()) {
bool retval;
QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection,
@@ -1042,7 +1039,6 @@ void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycod
if (retval)
return;
}
-#endif
Qt::KeyboardModifiers modifiers;
int qtcode = 0;