diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2011-09-08 17:22:55 +0300 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-09-08 21:40:40 +0200 |
commit | 8be11227100498d7098eb7f39bbbe1e7ac6b01cf (patch) | |
tree | 27a7b596fd69e014a8e4736fb9fd9d037603d643 /src | |
parent | 7ad91ad9ca89d868d59a1fcff85349cc9786f99a (diff) |
Add plugin mechanism to load platform input contexts
Change-Id: I6e74fd395325445420efce4adf13e89abe8177ee
Reviewed-on: http://codereview.qt-project.org/4482
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
27 files changed, 441 insertions, 33 deletions
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 9f64911399..97cf7d371e 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -59,8 +59,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QPlatformIntegration; - class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate { Q_DECLARE_PUBLIC(QGuiApplication) diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputpanel.cpp index 233ac93cb8..b6160dc71a 100644 --- a/src/gui/kernel/qinputpanel.cpp +++ b/src/gui/kernel/qinputpanel.cpp @@ -53,7 +53,6 @@ QInputPanel::~QInputPanel() { } - QObject *QInputPanel::inputItem() const { Q_D(const QInputPanel); diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h index 1720e634c7..804200708a 100644 --- a/src/gui/kernel/qplatforminputcontext_qpa.h +++ b/src/gui/kernel/qplatforminputcontext_qpa.h @@ -53,8 +53,9 @@ QT_MODULE(Gui) class QWindow; class QMouseEvent; -class Q_GUI_EXPORT QPlatformInputContext +class Q_GUI_EXPORT QPlatformInputContext : public QObject { + Q_OBJECT public: QPlatformInputContext(); virtual ~QPlatformInputContext(); diff --git a/src/platformsupport/inputcontext/inputcontext.pri b/src/platformsupport/inputcontext/inputcontext.pri new file mode 100644 index 0000000000..e1a44684ba --- /dev/null +++ b/src/platformsupport/inputcontext/inputcontext.pri @@ -0,0 +1,6 @@ +HEADERS += \ + $$PWD/qplatforminputcontextplugin_qpa_p.h \ + $$PWD/qplatforminputcontextfactory_qpa_p.h +SOURCES += \ + $$PWD/qplatforminputcontextplugin_qpa.cpp \ + $$PWD/qplatforminputcontextfactory_qpa.cpp diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp new file mode 100644 index 0000000000..255ed71fe2 --- /dev/null +++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatforminputcontextfactory_qpa_p.h" +#include "qplatforminputcontextplugin_qpa_p.h" +#include <QPlatformInputContext> +#include "private/qfactoryloader_p.h" + +#include "qguiapplication.h" +#include "qdebug.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() +{ +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList list = loader()->keys(); +#else + QStringList list; +#endif + return list; +} + +QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) +{ + QPlatformInputContext *ret = 0; + QStringList paramList = key.split(QLatin1Char(':')); + QString platform = paramList.takeFirst().toLower(); + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + if (QPlatformInputContextFactoryInterface *factory = qobject_cast<QPlatformInputContextFactoryInterface*>(loader()->instance(platform))) + ret = factory->create(platform, paramList); +#endif + return ret; +} + +QT_END_NAMESPACE + diff --git a/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h new file mode 100644 index 0000000000..ea7f4f1319 --- /dev/null +++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINPUTCONTEXTFACTORY_H +#define QPLATFORMINPUTCONTEXTFACTORY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qstringlist.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformInputContext; + +class QPlatformInputContextFactory +{ +public: + static QStringList keys(); + static QPlatformInputContext *create(const QString &key); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINPUTCONTEXTFACTORY_H + diff --git a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp new file mode 100644 index 0000000000..380ab06d9c --- /dev/null +++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatforminputcontextplugin_qpa_p.h" + +QT_BEGIN_NAMESPACE + +QPlatformInputContextPlugin::QPlatformInputContextPlugin(QObject *parent) + : QObject(parent) +{ +} + +QPlatformInputContextPlugin::~QPlatformInputContextPlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h new file mode 100644 index 0000000000..1dfb759682 --- /dev/null +++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINPUTCONTEXTPLUGIN_H +#define QPLATFORMINPUTCONTEXTPLUGIN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformInputContext; + + struct QPlatformInputContextFactoryInterface : public QFactoryInterface +{ + virtual QPlatformInputContext *create(const QString &key, const QStringList ¶mList) = 0; +}; + +#define QPlatformInputContextFactoryInterface_iid "com.nokia.Qt.QPlatformInputContextFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformInputContextFactoryInterface, QPlatformInputContextFactoryInterface_iid) + +class Q_GUI_EXPORT QPlatformInputContextPlugin : public QObject, public QPlatformInputContextFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformInputContextFactoryInterface:QFactoryInterface) +public: + explicit QPlatformInputContextPlugin(QObject *parent = 0); + ~QPlatformInputContextPlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformInputContext *create(const QString &key, const QStringList ¶mList) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMINPUTCONTEXTPLUGIN_H diff --git a/src/platformsupport/inputmethods/ibus/ibus.pri b/src/platformsupport/inputmethods/ibus/ibus.pri deleted file mode 100644 index c6e59aa484..0000000000 --- a/src/platformsupport/inputmethods/ibus/ibus.pri +++ /dev/null @@ -1,11 +0,0 @@ -QT += dbus - -SOURCES += $$PWD/qibusplatforminputcontext.cpp \ - $$PWD/qibusproxy.cpp \ - $$PWD/qibusinputcontextproxy.cpp \ - $$PWD/qibustypes.cpp - -HEADERS += $$PWD/qibusplatforminputcontext.h \ - $$PWD/qibusproxy.h \ - $$PWD/qibusinputcontextproxy.h \ - $$PWD/qibustypes.h diff --git a/src/platformsupport/inputmethods/inputmethods.pri b/src/platformsupport/inputmethods/inputmethods.pri deleted file mode 100644 index 0c3a40bb9d..0000000000 --- a/src/platformsupport/inputmethods/inputmethods.pri +++ /dev/null @@ -1,5 +0,0 @@ -contains(QT_CONFIG, dbus) { - !mac:unix: { - include($$PWD/ibus/ibus.pri) - } -} diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 126cff823a..9d6f8dcd41 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -30,4 +30,4 @@ include(fb_base/fb_base.pri) include(fontdatabases/fontdatabases.pri) include(glxconvenience/glxconvenience.pri) include(printersupport/printersupport.pri) -include(inputmethods/inputmethods.pri) +include(inputcontext/inputcontext.pri) diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro new file mode 100644 index 0000000000..193dad0018 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/ibus.pro @@ -0,0 +1,19 @@ +TARGET = ibusplatforminputcontextplugin +load(qt_plugin) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts + +QT += dbus platformsupport-private +SOURCES += $$PWD/qibusplatforminputcontext.cpp \ + $$PWD/qibusproxy.cpp \ + $$PWD/qibusinputcontextproxy.cpp \ + $$PWD/qibustypes.cpp \ + $$PWD/main.cpp + +HEADERS += $$PWD/qibusplatforminputcontext.h \ + $$PWD/qibusproxy.h \ + $$PWD/qibusinputcontextproxy.h \ + $$PWD/qibustypes.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts +INSTALLS += target diff --git a/src/platformsupport/inputmethods/ibus/interfaces/org.freedesktop.IBus.InputContext.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml index dbc79c178b..dbc79c178b 100644 --- a/src/platformsupport/inputmethods/ibus/interfaces/org.freedesktop.IBus.InputContext.xml +++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml diff --git a/src/platformsupport/inputmethods/ibus/interfaces/org.freedesktop.IBus.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.xml index 6ac4891771..6ac4891771 100644 --- a/src/platformsupport/inputmethods/ibus/interfaces/org.freedesktop.IBus.xml +++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.xml diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp new file mode 100644 index 0000000000..eb773c8856 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <private/qplatforminputcontextplugin_qpa_p.h> +#include <QtCore/QStringList> +#include "qibusplatforminputcontext.h" + +QT_BEGIN_NAMESPACE + +class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin +{ +public: + QStringList keys() const; + QIBusPlatformInputContext *create(const QString&, const QStringList&); +}; + +QStringList QIbusPlatformInputContextPlugin::keys() const +{ + return QStringList(QStringLiteral("ibus")); +} + +QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + + if (system.compare(system, QStringLiteral("ibus"), Qt::CaseInsensitive) == 0) + return new QIBusPlatformInputContext; + return 0; +} + +Q_EXPORT_PLUGIN2(ibusplatforminputcontextplugin, QIbusPlatformInputContextPlugin) + +QT_END_NAMESPACE diff --git a/src/platformsupport/inputmethods/ibus/qibusinputcontextproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp index 7adffbc2e2..7adffbc2e2 100644 --- a/src/platformsupport/inputmethods/ibus/qibusinputcontextproxy.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp diff --git a/src/platformsupport/inputmethods/ibus/qibusinputcontextproxy.h b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h index 9a91c4e484..9a91c4e484 100644 --- a/src/platformsupport/inputmethods/ibus/qibusinputcontextproxy.h +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h diff --git a/src/platformsupport/inputmethods/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index af8fd5a1f1..af8fd5a1f1 100644 --- a/src/platformsupport/inputmethods/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp diff --git a/src/platformsupport/inputmethods/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h index 8583118306..322eca4b89 100644 --- a/src/platformsupport/inputmethods/ibus/qibusplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h @@ -46,7 +46,7 @@ class QIBusPlatformInputContextPrivate; class QDBusVariant; -class QIBusPlatformInputContext : public QObject, public QPlatformInputContext +class QIBusPlatformInputContext : public QPlatformInputContext { Q_OBJECT public: diff --git a/src/platformsupport/inputmethods/ibus/qibusproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp index 9d64b603f3..9d64b603f3 100644 --- a/src/platformsupport/inputmethods/ibus/qibusproxy.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp diff --git a/src/platformsupport/inputmethods/ibus/qibusproxy.h b/src/plugins/platforminputcontexts/ibus/qibusproxy.h index 389eec3175..389eec3175 100644 --- a/src/platformsupport/inputmethods/ibus/qibusproxy.h +++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.h diff --git a/src/platformsupport/inputmethods/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index 8d8c61afb7..8d8c61afb7 100644 --- a/src/platformsupport/inputmethods/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp diff --git a/src/platformsupport/inputmethods/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h index c426ff7eda..c426ff7eda 100644 --- a/src/platformsupport/inputmethods/ibus/qibustypes.h +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro new file mode 100644 index 0000000000..198060a96b --- /dev/null +++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS += ibus + diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 3d181dcf0c..316d28ea3f 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -63,7 +63,8 @@ #endif #if defined(XCB_USE_IBUS) -#include "QtPlatformSupport/qibusplatforminputcontext.h" +#include <private/qplatforminputcontextfactory_qpa_p.h> +#include <qplatforminputcontext_qpa.h> #endif #if defined(XCB_USE_GLX) @@ -102,12 +103,15 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters) m_inputContext = 0; #if defined(XCB_USE_IBUS) - QIBusPlatformInputContext *context = new QIBusPlatformInputContext; - if (context->isValid()) { - m_inputContext = context; - } else { - delete context; + QPlatformInputContext *platformInputContext = QPlatformInputContextFactory::create("ibus"); + if (platformInputContext) { + QVariant value; + QMetaObject::invokeMethod(platformInputContext, "isValid", Qt::DirectConnection, Q_RETURN_ARG(QVariant, value)); + if (value.toBool()) + m_inputContext = platformInputContext; } + if (platformInputContext && !m_inputContext) + delete platformInputContext; #endif } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 6f37c078a1..18080dbb0c 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -50,7 +50,7 @@ #include <stdio.h> #if defined(XCB_USE_IBUS) -#include "QtPlatformSupport/qibusplatforminputcontext.h" +#include <qplatforminputcontext_qpa.h> #endif #ifndef XK_ISO_Left_Tab @@ -1029,9 +1029,20 @@ 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; + +#if defined(XCB_USE_IBUS) + if (QObject* inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext()) { + QVariant value; + QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection, + Q_RETURN_ARG(QVariant, value), + Q_ARG(uint, sym), + Q_ARG(uint, code), + Q_ARG(uint, state), + Q_ARG(bool, type == QEvent::KeyPress)); + if (value.toBool()) + return; + } +#endif Qt::KeyboardModifiers modifiers; int qtcode = 0; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 0936cd2102..5203daccdf 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -9,4 +9,7 @@ unix:!symbian { !contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats !symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible symbian:SUBDIRS += s60 -qpa:SUBDIRS += platforms +qpa: { + SUBDIRS += platforms + SUBDIRS += platforminputcontexts +} |