summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforminputcontexts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforminputcontexts')
-rw-r--r--src/plugins/platforminputcontexts/CMakeLists.txt3
-rw-r--r--src/plugins/platforminputcontexts/compose/.prev_CMakeLists.txt24
-rw-r--r--src/plugins/platforminputcontexts/compose/CMakeLists.txt17
-rw-r--r--src/plugins/platforminputcontexts/compose/compose.pro19
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp60
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h41
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp46
-rw-r--r--src/plugins/platforminputcontexts/ibus/CMakeLists.txt13
-rw-r--r--src/plugins/platforminputcontexts/ibus/ibus.pro23
-rw-r--r--src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml18
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp49
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h57
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp253
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h43
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxy.cpp3
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxy.h19
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxyportal.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusproxyportal.h2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp84
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.h88
-rw-r--r--src/plugins/platforminputcontexts/platforminputcontexts.pro11
22 files changed, 352 insertions, 525 deletions
diff --git a/src/plugins/platforminputcontexts/CMakeLists.txt b/src/plugins/platforminputcontexts/CMakeLists.txt
index b5150df4f3..78b3ec99d9 100644
--- a/src/plugins/platforminputcontexts/CMakeLists.txt
+++ b/src/plugins/platforminputcontexts/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from platforminputcontexts.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(QT_FEATURE_xkbcommon)
add_subdirectory(compose)
diff --git a/src/plugins/platforminputcontexts/compose/.prev_CMakeLists.txt b/src/plugins/platforminputcontexts/compose/.prev_CMakeLists.txt
deleted file mode 100644
index e4a4856bf5..0000000000
--- a/src/plugins/platforminputcontexts/compose/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-# Generated from compose.pro.
-
-#####################################################################
-## QComposePlatformInputContextPlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(QComposePlatformInputContextPlugin
- OUTPUT_NAME composeplatforminputcontextplugin
- TYPE platforminputcontexts
- SOURCES
- qcomposeplatforminputcontext.cpp qcomposeplatforminputcontext.h
- qcomposeplatforminputcontextmain.cpp
- LIBRARIES
- XKB::XKB
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
-)
-
-#### Keys ignored in scope 1:.:.:compose.pro:<TRUE>:
-# OTHER_FILES = "$$PWD/compose.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforminputcontexts/compose/CMakeLists.txt b/src/plugins/platforminputcontexts/compose/CMakeLists.txt
index 90a149f7ac..9e71a7a07c 100644
--- a/src/plugins/platforminputcontexts/compose/CMakeLists.txt
+++ b/src/plugins/platforminputcontexts/compose/CMakeLists.txt
@@ -1,27 +1,24 @@
-# Generated from compose.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QComposePlatformInputContextPlugin Plugin:
#####################################################################
-qt_find_package(XKB) # special case
-pkg_get_variable(PKG_X11_PREFIX x11 prefix) # special case
+qt_find_package(XKB)
+pkg_get_variable(PKG_X11_PREFIX x11 prefix)
qt_internal_add_plugin(QComposePlatformInputContextPlugin
OUTPUT_NAME composeplatforminputcontextplugin
- TYPE platforminputcontexts
+ PLUGIN_TYPE platforminputcontexts
+ DEFAULT_IF FALSE
SOURCES
qcomposeplatforminputcontext.cpp qcomposeplatforminputcontext.h
qcomposeplatforminputcontextmain.cpp
LIBRARIES
- XKB::XKB
- PUBLIC_LIBRARIES
Qt::Core
Qt::CorePrivate
Qt::Gui
Qt::GuiPrivate
+ XKB::XKB
)
-
-#### Keys ignored in scope 1:.:.:compose.pro:<TRUE>:
-# OTHER_FILES = "$$PWD/compose.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro
deleted file mode 100644
index 2e2f8600c3..0000000000
--- a/src/plugins/platforminputcontexts/compose/compose.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = composeplatforminputcontextplugin
-
-QT += core-private gui-private
-
-SOURCES += $$PWD/qcomposeplatforminputcontextmain.cpp \
- $$PWD/qcomposeplatforminputcontext.cpp
-
-HEADERS += $$PWD/qcomposeplatforminputcontext.h
-
-QMAKE_USE_PRIVATE += xkbcommon
-
-include($$OUT_PWD/../../../gui/qtgui-config.pri)
-
-OTHER_FILES += $$PWD/compose.json
-
-PLUGIN_TYPE = platforminputcontexts
-PLUGIN_EXTENDS = -
-PLUGIN_CLASS_NAME = QComposePlatformInputContextPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
index 4e9828663f..3e74189076 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
@@ -1,44 +1,9 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcomposeplatforminputcontext.h"
#include <QtCore/QCoreApplication>
+#include <QtCore/qvarlengtharray.h>
#include <QtGui/QKeyEvent>
#include <QtGui/QGuiApplication>
@@ -71,10 +36,16 @@ void QComposeInputContext::ensureInitialized()
}
m_initialized = true;
- const char *locale = setlocale(LC_CTYPE, "");
- if (!locale)
- locale = setlocale(LC_CTYPE, nullptr);
- qCDebug(lcXkbCompose) << "detected locale (LC_CTYPE):" << locale;
+ // Get locale from user env settings, see also
+ // https://xkbcommon.org/doc/current/group__compose.html#compose-locale
+ const char *locale = getenv("LC_ALL");
+ if (!locale || !*locale)
+ locale = getenv("LC_CTYPE");
+ if (!locale || !*locale)
+ locale = getenv("LANG");
+ if (!locale || !*locale)
+ locale = "C";
+ qCDebug(lcXkbCompose) << "detected locale:" << locale;
m_composeTable = xkb_compose_table_new_from_locale(m_XkbContext, locale, XKB_COMPOSE_COMPILE_NO_FLAGS);
if (m_composeTable)
@@ -137,8 +108,7 @@ bool QComposeInputContext::filterEvent(const QEvent *event)
case XKB_COMPOSE_NOTHING:
return false;
default:
- Q_UNREACHABLE();
- return false;
+ Q_UNREACHABLE_RETURN(false);
}
}
@@ -164,3 +134,5 @@ void QComposeInputContext::update(Qt::InputMethodQueries q)
}
QT_END_NAMESPACE
+
+#include "moc_qcomposeplatforminputcontext.cpp"
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
index 29e862ecc1..79b98de3fa 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOMPOSEPLATFORMINPUTCONTEXT_H
#define QCOMPOSEPLATFORMINPUTCONTEXT_H
@@ -74,7 +38,6 @@ protected:
private:
bool m_initialized = false;
- xkb_context *m_context = nullptr;
xkb_compose_table *m_composeTable = nullptr;
xkb_compose_state *m_composeState = nullptr;
QObject *m_focusObject = nullptr;
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
index d062d4fd6a..804ced957b 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatforminputcontextplugin_p.h>
@@ -45,6 +9,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QComposePlatformInputContextPlugin : public QPlatformInputContextPlugin
{
Q_OBJECT
@@ -58,8 +24,8 @@ QComposeInputContext *QComposePlatformInputContextPlugin::create(const QString &
{
Q_UNUSED(paramList);
- if (system.compare(system, QLatin1String("compose"), Qt::CaseInsensitive) == 0
- || system.compare(system, QLatin1String("xim"), Qt::CaseInsensitive) == 0)
+ if (system.compare(system, "compose"_L1, Qt::CaseInsensitive) == 0
+ || system.compare(system, "xim"_L1, Qt::CaseInsensitive) == 0)
return new QComposeInputContext;
return nullptr;
}
diff --git a/src/plugins/platforminputcontexts/ibus/CMakeLists.txt b/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
index 686f028c6a..54847e86fd 100644
--- a/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
+++ b/src/plugins/platforminputcontexts/ibus/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from ibus.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## QIbusPlatformInputContextPlugin Plugin:
@@ -6,7 +7,8 @@
qt_internal_add_plugin(QIbusPlatformInputContextPlugin
OUTPUT_NAME ibusplatforminputcontextplugin
- TYPE platforminputcontexts
+ PLUGIN_TYPE platforminputcontexts
+ DEFAULT_IF FALSE
SOURCES
main.cpp
qibusinputcontextproxy.cpp qibusinputcontextproxy.h
@@ -15,14 +17,9 @@ qt_internal_add_plugin(QIbusPlatformInputContextPlugin
qibusproxyportal.cpp qibusproxyportal.h
qibustypes.cpp qibustypes.h
LIBRARIES
- XKB::XKB
- PUBLIC_LIBRARIES
Qt::Core
Qt::DBus
Qt::Gui
Qt::GuiPrivate
+ XKB::XKB
)
-
-#### Keys ignored in scope 1:.:.:ibus.pro:<TRUE>:
-# OTHER_FILES = "$$PWD/ibus.json"
-# PLUGIN_EXTENDS = "-"
diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro
deleted file mode 100644
index a3220fd547..0000000000
--- a/src/plugins/platforminputcontexts/ibus/ibus.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGET = ibusplatforminputcontextplugin
-
-QT += dbus gui-private
-QMAKE_USE_PRIVATE += xkbcommon
-SOURCES += $$PWD/qibusplatforminputcontext.cpp \
- $$PWD/qibusproxy.cpp \
- $$PWD/qibusproxyportal.cpp \
- $$PWD/qibusinputcontextproxy.cpp \
- $$PWD/qibustypes.cpp \
- $$PWD/main.cpp
-
-HEADERS += $$PWD/qibusplatforminputcontext.h \
- $$PWD/qibusproxy.h \
- $$PWD/qibusproxyportal.h \
- $$PWD/qibusinputcontextproxy.h \
- $$PWD/qibustypes.h
-
-OTHER_FILES += $$PWD/ibus.json
-
-PLUGIN_TYPE = platforminputcontexts
-PLUGIN_EXTENDS = -
-PLUGIN_CLASS_NAME = QIbusPlatformInputContextPlugin
-load(qt_plugin)
diff --git a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml
index 9c67a38c57..30fa7431c3 100644
--- a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml
+++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml
@@ -2,6 +2,12 @@
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.IBus.InputContext">
+ <property name="ClientCommitPreedit" type="(b)" access="readwrite">
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="QIBusPropTypeClientCommitPreedit"/>
+ </property>
+ <property name='ContentType' type='(uu)' access='readwrite'>
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="QIBusPropTypeContentType"/>
+ </property>
<method name="ProcessKeyEvent">
<arg name="keyval" direction="in" type="u"/>
<arg name="keycode" direction="in" type="u"/>
@@ -14,6 +20,12 @@
<arg name="w" direction="in" type="i"/>
<arg name="h" direction="in" type="i"/>
</method>
+ <method name='SetCursorLocationRelative'>
+ <arg name="x" direction="in" type="i"/>
+ <arg name="y" direction="in" type="i"/>
+ <arg name="w" direction="in" type="i"/>
+ <arg name="h" direction="in" type="i"/>
+ </method>
<method name="FocusIn"/>
<method name="FocusOut"/>
<method name="Reset"/>
@@ -56,6 +68,12 @@
<arg name="cursor_pos" type="u"/>
<arg name="visible" type="b"/>
</signal>
+ <signal name="UpdatePreeditTextWithMode">
+ <arg name="text" type="v"/>
+ <arg name="cursor_pos" type="u"/>
+ <arg name="visible" type="b"/>
+ <arg name="mode" type="u"/>
+ </signal>
<signal name="ShowPreeditText"/>
<signal name="HidePreeditText"/>
<signal name="UpdateAuxiliaryText">
diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp
index 0a7da3b14c..d74be4bedf 100644
--- a/src/plugins/platforminputcontexts/ibus/main.cpp
+++ b/src/plugins/platforminputcontexts/ibus/main.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qpa/qplatforminputcontextplugin_p.h>
#include <QtCore/QStringList>
@@ -45,6 +9,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin
{
Q_OBJECT
@@ -58,13 +24,16 @@ QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString
{
Q_UNUSED(paramList);
- if (system.compare(system, QLatin1String("ibus"), Qt::CaseInsensitive) == 0) {
+ if (system.compare(system, "ibus"_L1, Qt::CaseInsensitive) == 0) {
qDBusRegisterMetaType<QIBusAttribute>();
qDBusRegisterMetaType<QIBusAttributeList>();
qDBusRegisterMetaType<QIBusText>();
+ qDBusRegisterMetaType<QIBusPropTypeClientCommitPreedit>();
+ qDBusRegisterMetaType<QIBusPropTypeContentType>();
return new QIBusPlatformInputContext;
}
- return 0;
+
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
index 793c9dd95c..248abbc32b 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2023 The Qt Company Ltd and other contributors.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
index 396a213aaa..82e78aa35b 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h
@@ -2,14 +2,14 @@
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2023 The Qt Company Ltd and other contributors.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef QIBUSINPUTCONTEXTPROXY_H_1394889529
-#define QIBUSINPUTCONTEXTPROXY_H_1394889529
+#ifndef QIBUSINPUTCONTEXTPROXY_H
+#define QIBUSINPUTCONTEXTPROXY_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -20,6 +20,9 @@
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
+// Added for QIBusPropTypeClientCommitPreedit and QIBusPropTypeContentType
+#include "qibustypes.h"
+
/*
* Proxy class for interface org.freedesktop.IBus.InputContext
*/
@@ -35,95 +38,114 @@ public:
~QIBusInputContextProxy();
+ Q_PROPERTY(QIBusPropTypeClientCommitPreedit ClientCommitPreedit READ clientCommitPreedit WRITE setClientCommitPreedit)
+ inline QIBusPropTypeClientCommitPreedit clientCommitPreedit() const
+ { return qvariant_cast< QIBusPropTypeClientCommitPreedit >(property("ClientCommitPreedit")); }
+ inline void setClientCommitPreedit(const QIBusPropTypeClientCommitPreedit &value)
+ { setProperty("ClientCommitPreedit", QVariant::fromValue(value)); }
+
+ Q_PROPERTY(QIBusPropTypeContentType ContentType READ contentType WRITE setContentType)
+ inline QIBusPropTypeContentType contentType() const
+ { return qvariant_cast< QIBusPropTypeContentType >(property("ContentType")); }
+ inline void setContentType(const QIBusPropTypeContentType &value)
+ { setProperty("ContentType", QVariant::fromValue(value)); }
+
public Q_SLOTS: // METHODS
inline QDBusPendingReply<> Destroy()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Destroy"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Destroy"), argumentList);
}
inline QDBusPendingReply<> Disable()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Disable"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Disable"), argumentList);
}
inline QDBusPendingReply<> Enable()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Enable"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Enable"), argumentList);
}
inline QDBusPendingReply<> FocusIn()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("FocusIn"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("FocusIn"), argumentList);
}
inline QDBusPendingReply<> FocusOut()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("FocusOut"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("FocusOut"), argumentList);
}
inline QDBusPendingReply<QDBusVariant> GetEngine()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetEngine"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("GetEngine"), argumentList);
}
inline QDBusPendingReply<bool> IsEnabled()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("IsEnabled"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("IsEnabled"), argumentList);
}
inline QDBusPendingReply<bool> ProcessKeyEvent(uint keyval, uint keycode, uint state)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(keyval) << QVariant::fromValue(keycode) << QVariant::fromValue(state);
- return asyncCallWithArgumentList(QLatin1String("ProcessKeyEvent"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("ProcessKeyEvent"), argumentList);
}
inline QDBusPendingReply<> PropertyActivate(const QString &name, int state)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(name) << QVariant::fromValue(state);
- return asyncCallWithArgumentList(QLatin1String("PropertyActivate"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("PropertyActivate"), argumentList);
}
inline QDBusPendingReply<> Reset()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Reset"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Reset"), argumentList);
}
inline QDBusPendingReply<> SetCapabilities(uint caps)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(caps);
- return asyncCallWithArgumentList(QLatin1String("SetCapabilities"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("SetCapabilities"), argumentList);
}
inline QDBusPendingReply<> SetCursorLocation(int x, int y, int w, int h)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h);
- return asyncCallWithArgumentList(QLatin1String("SetCursorLocation"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("SetCursorLocation"), argumentList);
+ }
+
+ inline QDBusPendingReply<> SetCursorLocationRelative(int x, int y, int w, int h)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h);
+ return asyncCallWithArgumentList(QStringLiteral("SetCursorLocationRelative"), argumentList);
}
inline QDBusPendingReply<> SetEngine(const QString &name)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(name);
- return asyncCallWithArgumentList(QLatin1String("SetEngine"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("SetEngine"), argumentList);
}
inline QDBusPendingReply<> SetSurroundingText(const QDBusVariant &text, uint cursor_pos, uint anchor_pos)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(text) << QVariant::fromValue(cursor_pos) << QVariant::fromValue(anchor_pos);
- return asyncCallWithArgumentList(QLatin1String("SetSurroundingText"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("SetSurroundingText"), argumentList);
}
Q_SIGNALS: // SIGNALS
@@ -147,6 +169,7 @@ Q_SIGNALS: // SIGNALS
void UpdateAuxiliaryText(const QDBusVariant &text, bool visible);
void UpdateLookupTable(const QDBusVariant &table, bool visible);
void UpdatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible);
+ void UpdatePreeditTextWithMode(const QDBusVariant &text, uint cursor_pos, bool visible, uint mode);
void UpdateProperty(const QDBusVariant &prop);
};
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index c50f03de05..00c7884cda 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -1,67 +1,37 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qibusplatforminputcontext.h"
-#include <QtDebug>
+#include <QDebug>
#include <QTextCharFormat>
#include <QGuiApplication>
+#include <QWindow>
+#include <QEvent>
+#include <QFile>
+#include <QFileInfo>
+#include <QStandardPaths>
#include <QDBusVariant>
-#include <qwindow.h>
-#include <qevent.h>
+#include <QDBusPendingReply>
+#include <QDBusReply>
+#include <QDBusServiceWatcher>
+
+#include "qibusproxy.h"
+#include "qibusproxyportal.h"
+#include "qibusinputcontextproxy.h"
+#include "qibustypes.h"
#include <qpa/qplatformcursor.h>
#include <qpa/qplatformscreen.h>
#include <qpa/qwindowsysteminterface_p.h>
-#include <QtGui/private/qguiapplication_p.h>
+#include <private/qguiapplication_p.h>
+#include <private/qxkbcommon_p.h>
-#include <QtGui/private/qxkbcommon_p.h>
-
-#include "qibusproxy.h"
-#include "qibusproxyportal.h"
-#include "qibusinputcontextproxy.h"
-#include "qibustypes.h"
+#include <memory>
#include <sys/types.h>
#include <signal.h>
-#include <QtDBus>
#ifndef IBUS_RELEASE_MASK
#define IBUS_RELEASE_MASK (1 << 30)
@@ -73,30 +43,41 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
enum { debug = 0 };
class QIBusPlatformInputContextPrivate
{
+ Q_DISABLE_COPY_MOVE(QIBusPlatformInputContextPrivate)
public:
+ // This enum might be synced with IBusPreeditFocusMode
+ // in ibustypes.h of IBUS project
+ enum PreeditFocusMode {
+ PREEDIT_CLEAR = 0,
+ PREEDIT_COMMIT = 1,
+ };
+
QIBusPlatformInputContextPrivate();
~QIBusPlatformInputContextPrivate()
{
- delete context;
- delete bus;
- delete portalBus;
- delete connection;
+ // dereference QDBusConnection to actually disconnect
+ serviceWatcher.setConnection(QDBusConnection(QString()));
+ context = nullptr;
+ portalBus = nullptr;
+ bus = nullptr;
+ QDBusConnection::disconnectFromBus("QIBusProxy"_L1);
}
static QString getSocketPath();
- QDBusConnection *createConnection();
+ void createConnection();
void initBus();
void createBusProxy();
- QDBusConnection *connection;
- QIBusProxy *bus;
- QIBusProxyPortal *portalBus; // bus and portalBus are alternative.
- QIBusInputContextProxy *context;
+ std::unique_ptr<QIBusProxy> bus;
+ std::unique_ptr<QIBusProxyPortal> portalBus; // bus and portalBus are alternative.
+ std::unique_ptr<QIBusInputContextProxy> context;
QDBusServiceWatcher serviceWatcher;
bool usePortal; // return value of shouldConnectIbusPortal
@@ -106,6 +87,7 @@ public:
QList<QInputMethodEvent::Attribute> attributes;
bool needsSurroundingText;
QLocale locale;
+ PreeditFocusMode preeditFocusMode = PREEDIT_COMMIT; // for backward compatibility
};
@@ -177,8 +159,6 @@ void QIBusPlatformInputContext::invokeAction(QInputMethod::Action a, int)
void QIBusPlatformInputContext::reset()
{
- QPlatformInputContext::reset();
-
if (!d->busConnected)
return;
@@ -189,8 +169,6 @@ void QIBusPlatformInputContext::reset()
void QIBusPlatformInputContext::commit()
{
- QPlatformInputContext::commit();
-
if (!d->busConnected)
return;
@@ -201,10 +179,18 @@ void QIBusPlatformInputContext::commit()
return;
}
- if (!d->predit.isEmpty()) {
- QInputMethodEvent event;
- event.setCommitString(d->predit);
- QCoreApplication::sendEvent(input, &event);
+ if (d->preeditFocusMode == QIBusPlatformInputContextPrivate::PREEDIT_COMMIT) {
+ if (!d->predit.isEmpty()) {
+ QInputMethodEvent event;
+ event.setCommitString(d->predit);
+ QCoreApplication::sendEvent(input, &event);
+ }
+ } else {
+ if (!d->predit.isEmpty()) {
+ // Clear the existing preedit
+ QInputMethodEvent event;
+ QCoreApplication::sendEvent(input, &event);
+ }
}
d->context->Reset();
@@ -239,7 +225,6 @@ void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
d->context->SetSurroundingText(dbusText, cursorPosition, anchorPosition);
}
- QPlatformInputContext::update(q);
}
void QIBusPlatformInputContext::cursorRectChanged()
@@ -248,16 +233,37 @@ void QIBusPlatformInputContext::cursorRectChanged()
return;
QRect r = qApp->inputMethod()->cursorRectangle().toRect();
- if(!r.isValid())
+ if (!r.isValid())
return;
QWindow *inputWindow = qApp->focusWindow();
if (!inputWindow)
return;
- r.moveTopLeft(inputWindow->mapToGlobal(r.topLeft()));
+ if (!inputWindow->screen())
+ return;
+
+ if (QGuiApplication::platformName().startsWith("wayland"_L1)) {
+ auto margins = inputWindow->frameMargins();
+ r.translate(margins.left(), margins.top());
+ qreal scale = inputWindow->devicePixelRatio();
+ QRect newRect = QRect(r.x() * scale, r.y() * scale, r.width() * scale, r.height() * scale);
+ if (debug)
+ qDebug() << "microFocus" << newRect;
+ d->context->SetCursorLocationRelative(newRect.x(), newRect.y(),
+ newRect.width(), newRect.height());
+ return;
+ }
+
+ // x11/xcb
+ auto screenGeometry = inputWindow->screen()->geometry();
+ auto point = inputWindow->mapToGlobal(r.topLeft());
+ qreal scale = inputWindow->devicePixelRatio();
+ auto native = (point - screenGeometry.topLeft()) * scale + screenGeometry.topLeft();
+ QRect newRect(native, r.size() * scale);
if (debug)
- qDebug() << "microFocus" << r;
- d->context->SetCursorLocation(r.x(), r.y(), r.width(), r.height());
+ qDebug() << "microFocus" << newRect;
+ d->context->SetCursorLocation(newRect.x(), newRect.y(),
+ newRect.width(), newRect.height());
}
void QIBusPlatformInputContext::setFocusObject(QObject *object)
@@ -268,7 +274,7 @@ void QIBusPlatformInputContext::setFocusObject(QObject *object)
// It would seem natural here to call FocusOut() on the input method if we
// transition from an IME accepted focus object to one that does not accept it.
// Mysteriously however that is not sufficient to fix bug QTBUG-63066.
- if (!inputMethodAccepted())
+ if (object && !inputMethodAccepted())
return;
if (debug)
@@ -328,6 +334,15 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint
d->predit = t.text;
}
+void QIBusPlatformInputContext::updatePreeditTextWithMode(const QDBusVariant &text, uint cursorPos, bool visible, uint mode)
+{
+ updatePreeditText(text, cursorPos, visible);
+ if (mode > 0)
+ d->preeditFocusMode = QIBusPlatformInputContextPrivate::PreeditFocusMode::PREEDIT_COMMIT;
+ else
+ d->preeditFocusMode = QIBusPlatformInputContextPrivate::PreeditFocusMode::PREEDIT_CLEAR;
+}
+
void QIBusPlatformInputContext::forwardKeyEvent(uint keyval, uint keycode, uint state)
{
if (!qApp)
@@ -504,7 +519,7 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal
if (!filtered) {
#ifndef QT_NO_CONTEXTMENU
if (type == QEvent::KeyPress && qtcode == Qt::Key_Menu
- && window != NULL) {
+ && window != nullptr) {
const QPoint globalPos = window->screen()->handle()->cursor()->pos();
const QPoint pos = window->mapFromGlobal(globalPos);
QWindowSystemInterfacePrivate::ContextMenuEvent contextMenuEvent(window, false, pos,
@@ -534,12 +549,12 @@ void QIBusPlatformInputContext::socketChanged(const QString &str)
m_timer.stop();
- if (d->context)
- disconnect(d->context);
- if (d->bus && d->bus->isValid())
- disconnect(d->bus);
- if (d->connection)
- d->connection->disconnectFromBus(QLatin1String("QIBusProxy"));
+ // dereference QDBusConnection to actually disconnect
+ d->serviceWatcher.setConnection(QDBusConnection(QString()));
+ d->context = nullptr;
+ d->bus = nullptr;
+ d->busConnected = false;
+ QDBusConnection::disconnectFromBus("QIBusProxy"_L1);
m_timer.start(100);
}
@@ -591,37 +606,34 @@ void QIBusPlatformInputContext::globalEngineChanged(const QString &engine_name)
void QIBusPlatformInputContext::connectToContextSignals()
{
if (d->bus && d->bus->isValid()) {
- connect(d->bus, SIGNAL(GlobalEngineChanged(QString)), this, SLOT(globalEngineChanged(QString)));
+ connect(d->bus.get(), SIGNAL(GlobalEngineChanged(QString)), this, SLOT(globalEngineChanged(QString)));
}
if (d->context) {
- connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
- connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
- connect(d->context, SIGNAL(ForwardKeyEvent(uint,uint,uint)), this, SLOT(forwardKeyEvent(uint,uint,uint)));
- connect(d->context, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
- connect(d->context, SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
- connect(d->context, SIGNAL(HidePreeditText()), this, SLOT(hidePreeditText()));
- connect(d->context, SIGNAL(ShowPreeditText()), this, SLOT(showPreeditText()));
+ connect(d->context.get(), SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
+ connect(d->context.get(), SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
+ connect(d->context.get(), SIGNAL(UpdatePreeditTextWithMode(QDBusVariant,uint,bool,uint)), this, SLOT(updatePreeditTextWithMode(QDBusVariant,uint,bool,uint)));
+ connect(d->context.get(), SIGNAL(ForwardKeyEvent(uint,uint,uint)), this, SLOT(forwardKeyEvent(uint,uint,uint)));
+ connect(d->context.get(), SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
+ connect(d->context.get(), SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
+ connect(d->context.get(), SIGNAL(HidePreeditText()), this, SLOT(hidePreeditText()));
+ connect(d->context.get(), SIGNAL(ShowPreeditText()), this, SLOT(showPreeditText()));
}
}
-static inline bool checkRunningUnderFlatpak()
+static inline bool checkNeedPortalSupport()
{
- return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
+ return QFileInfo::exists("/.flatpak-info"_L1) || qEnvironmentVariableIsSet("SNAP");
}
static bool shouldConnectIbusPortal()
{
// honor the same env as ibus-gtk
- return (checkRunningUnderFlatpak() || !qgetenv("IBUS_USE_PORTAL").isNull());
+ return (checkNeedPortalSupport() || qEnvironmentVariableIsSet("IBUS_USE_PORTAL"));
}
QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
- : connection(0),
- bus(0),
- portalBus(0),
- context(0),
- usePortal(shouldConnectIbusPortal()),
+ : usePortal(shouldConnectIbusPortal()),
valid(false),
busConnected(false),
needsSurroundingText(false)
@@ -645,42 +657,43 @@ QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate()
void QIBusPlatformInputContextPrivate::initBus()
{
- connection = createConnection();
+ createConnection();
busConnected = false;
createBusProxy();
}
void QIBusPlatformInputContextPrivate::createBusProxy()
{
- if (!connection || !connection->isConnected())
+ QDBusConnection connection("QIBusProxy"_L1);
+ if (!connection.isConnected())
return;
const char* ibusService = usePortal ? "org.freedesktop.portal.IBus" : "org.freedesktop.IBus";
QDBusReply<QDBusObjectPath> ic;
if (usePortal) {
- portalBus = new QIBusProxyPortal(QLatin1String(ibusService),
- QLatin1String("/org/freedesktop/IBus"),
- *connection);
+ portalBus = std::make_unique<QIBusProxyPortal>(QLatin1StringView(ibusService),
+ "/org/freedesktop/IBus"_L1,
+ connection);
if (!portalBus->isValid()) {
qWarning("QIBusPlatformInputContext: invalid portal bus.");
return;
}
- ic = portalBus->CreateInputContext(QLatin1String("QIBusInputContext"));
+ ic = portalBus->CreateInputContext("QIBusInputContext"_L1);
} else {
- bus = new QIBusProxy(QLatin1String(ibusService),
- QLatin1String("/org/freedesktop/IBus"),
- *connection);
+ bus = std::make_unique<QIBusProxy>(QLatin1StringView(ibusService),
+ "/org/freedesktop/IBus"_L1,
+ connection);
if (!bus->isValid()) {
qWarning("QIBusPlatformInputContext: invalid bus.");
return;
}
- ic = bus->CreateInputContext(QLatin1String("QIBusInputContext"));
+ ic = bus->CreateInputContext("QIBusInputContext"_L1);
}
serviceWatcher.removeWatchedService(ibusService);
- serviceWatcher.setConnection(*connection);
+ serviceWatcher.setConnection(connection);
serviceWatcher.addWatchedService(ibusService);
if (!ic.isValid()) {
@@ -688,7 +701,7 @@ void QIBusPlatformInputContextPrivate::createBusProxy()
return;
}
- context = new QIBusInputContextProxy(QLatin1String(ibusService), ic.value().path(), *connection);
+ context = std::make_unique<QIBusInputContextProxy>(QLatin1StringView(ibusService), ic.value().path(), connection);
if (!context->isValid()) {
qWarning("QIBusPlatformInputContext: invalid input context.");
@@ -705,6 +718,8 @@ void QIBusPlatformInputContextPrivate::createBusProxy()
};
context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS|IBUS_CAP_SURROUNDING_TEXT);
+ context->setClientCommitPreedit(QIBusPropTypeClientCommitPreedit(true));
+
if (debug)
qDebug(">>>> bus connected!");
busConnected = true;
@@ -745,19 +760,21 @@ QString QIBusPlatformInputContextPrivate::getSocketPath()
qDebug() << "host=" << host << "displayNumber" << displayNumber;
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
- QLatin1String("/ibus/bus/") +
- QLatin1String(QDBusConnection::localMachineId()) +
- QLatin1Char('-') + QString::fromLocal8Bit(host) + QLatin1Char('-') + QString::fromLocal8Bit(displayNumber);
+ "/ibus/bus/"_L1 +
+ QLatin1StringView(QDBusConnection::localMachineId()) +
+ u'-' + QString::fromLocal8Bit(host) + u'-' + QString::fromLocal8Bit(displayNumber);
}
-QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
+void QIBusPlatformInputContextPrivate::createConnection()
{
- if (usePortal)
- return new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SessionBus, QLatin1String("QIBusProxy")));
- QFile file(getSocketPath());
+ if (usePortal) {
+ QDBusConnection::connectToBus(QDBusConnection::SessionBus, "QIBusProxy"_L1);
+ return;
+ }
+ QFile file(getSocketPath());
if (!file.open(QFile::ReadOnly))
- return 0;
+ return;
QByteArray address;
int pid = -1;
@@ -776,9 +793,11 @@ QDBusConnection *QIBusPlatformInputContextPrivate::createConnection()
if (debug)
qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid;
if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0)
- return 0;
+ return;
- return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), QLatin1String("QIBusProxy")));
+ QDBusConnection::connectToBus(QString::fromLatin1(address), "QIBusProxy"_L1);
}
QT_END_NAMESPACE
+
+#include "moc_qibusplatforminputcontext.cpp"
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index e9c9c55f6a..ef8c0b7c8f 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIBUSPLATFORMINPUTCONTEXT_H
#define QIBUSPLATFORMINPUTCONTEXT_H
@@ -50,6 +14,8 @@
#include <QTimer>
#include <QWindow>
+#include "qibustypes.h"
+
QT_BEGIN_NAMESPACE
class QIBusPlatformInputContextPrivate;
@@ -102,6 +68,7 @@ public:
public Q_SLOTS:
void commitText(const QDBusVariant &text);
void updatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible);
+ void updatePreeditTextWithMode(const QDBusVariant &text, uint cursor_pos, bool visible, uint mode);
void forwardKeyEvent(uint keyval, uint keycode, uint state);
void cursorRectChanged();
void deleteSurroundingText(int offset, uint n_chars);
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
index 6b46e106ab..8f104a782d 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp
@@ -13,6 +13,8 @@
#include "qibusproxy.h"
+#include <QDBusReply>
+
/*
* Implementation of interface class QIBusProxy
*/
@@ -96,3 +98,4 @@ void QIBusProxy::globalEngineChanged(const QString &engine_name)
emit GlobalEngineChanged(engine_name);
}
+#include "moc_qibusproxy.cpp"
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.h b/src/plugins/platforminputcontexts/ibus/qibusproxy.h
index c9876deebf..73aff1a3d9 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxy.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.h
@@ -11,14 +11,15 @@
#ifndef QIBUSPROXY_H_1308831142
#define QIBUSPROXY_H_1308831142
-#include <QtCore/QObject>
-#include <QtCore/QByteArray>
-#include <QtCore/QList>
-#include <QtCore/QMap>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
-#include <QtCore/QVariant>
-#include <QtDBus/QtDBus>
+#include <QObject>
+#include <QByteArray>
+#include <QList>
+#include <QMap>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+#include <QDBusAbstractInterface>
+#include <QDBusPendingReply>
#include "qibustypes.h"
@@ -109,7 +110,7 @@ public Q_SLOTS: // METHODS
#endif
QIBusEngineDesc getGlobalEngine();
-private:
+private Q_SLOTS:
void globalEngineChanged(const QString &engine_name);
Q_SIGNALS: // SIGNALS
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxyportal.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxyportal.cpp
index 50482e2d9a..dc5b37aa6e 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxyportal.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxyportal.cpp
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p qibusproxyportal -c QIBusProxyPortal interfaces/org.freedesktop.IBus.Portal.xml
*
- * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2023 The Qt Company Ltd and other contributors.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxyportal.h b/src/plugins/platforminputcontexts/ibus/qibusproxyportal.h
index bdd1d9c395..450205f12a 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusproxyportal.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusproxyportal.h
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -p qibusproxyportal -c QIBusProxyPortal interfaces/org.freedesktop.IBus.Portal.xml
*
- * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2023 The Qt Company Ltd and other contributors.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index 443df271a8..ab1a244b6d 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -1,44 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qibustypes.h"
-#include <QtDBus>
+
#include <QHash>
QT_BEGIN_NAMESPACE
@@ -214,7 +178,7 @@ QList<QInputMethodEvent::Attribute> QIBusAttributeList::imAttributes() const
QHash<QPair<int, int>, QTextCharFormat> rangeAttrs;
const int numAttributes = attributes.size();
- // Merge text fomats for identical ranges into a single QTextFormat.
+ // Merge text formats for identical ranges into a single QTextFormat.
for (int i = 0; i < numAttributes; ++i) {
const QIBusAttribute &attr = attributes.at(i);
const QTextCharFormat &format = attr.format();
@@ -358,4 +322,44 @@ newest:
argument.endStructure();
}
+QIBusPropTypeClientCommitPreedit::QIBusPropTypeClientCommitPreedit(bool inClientCommitPreedit)
+ : clientCommitPreedit(inClientCommitPreedit)
+{
+}
+
+void QIBusPropTypeClientCommitPreedit::serializeTo(QDBusArgument &argument) const
+{
+ argument.beginStructure();
+ argument << clientCommitPreedit;
+ argument.endStructure();
+}
+
+void QIBusPropTypeClientCommitPreedit::deserializeFrom(const QDBusArgument &argument)
+{
+ argument.beginStructure();
+ argument >> clientCommitPreedit;
+ argument.endStructure();
+}
+
+QIBusPropTypeContentType::QIBusPropTypeContentType(unsigned int inPurpose, unsigned int inHints)
+ : purpose(inPurpose)
+ , hints(inHints)
+{
+}
+
+void QIBusPropTypeContentType::serializeTo(QDBusArgument &argument) const
+{
+ argument.beginStructure();
+ argument << purpose << hints;
+ argument.endStructure();
+}
+
+void QIBusPropTypeContentType::deserializeFrom(const QDBusArgument &argument)
+{
+ argument.beginStructure();
+ argument >> purpose;
+ argument >> hints;
+ argument.endStructure();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h
index e6bff1ef81..b697e432a0 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.h
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QIBUSTYPES_H
#define QIBUSTYPES_H
@@ -92,7 +56,7 @@ public:
quint32 start;
quint32 end;
};
-Q_DECLARE_TYPEINFO(QIBusAttribute, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIBusAttribute, Q_RELOCATABLE_TYPE);
class QIBusAttributeList : private QIBusSerializable
{
@@ -106,7 +70,7 @@ public:
QList<QIBusAttribute> attributes;
};
-Q_DECLARE_TYPEINFO(QIBusAttributeList, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIBusAttributeList, Q_RELOCATABLE_TYPE);
class QIBusText : private QIBusSerializable
{
@@ -119,7 +83,7 @@ public:
QString text;
QIBusAttributeList attributes;
};
-Q_DECLARE_TYPEINFO(QIBusText, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIBusText, Q_RELOCATABLE_TYPE);
class QIBusEngineDesc : private QIBusSerializable
{
@@ -147,7 +111,7 @@ public:
QString textdomain;
QString iconpropkey;
};
-Q_DECLARE_TYPEINFO(QIBusEngineDesc, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIBusEngineDesc, Q_RELOCATABLE_TYPE);
inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusAttribute &attribute)
{ attribute.serializeTo(argument); return argument; }
@@ -169,6 +133,44 @@ inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusEngineDesc
inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusEngineDesc &desc)
{ desc.deserializeFrom(argument); return argument; }
+class QIBusPropTypeClientCommitPreedit
+{
+public:
+ QIBusPropTypeClientCommitPreedit() {};
+
+ QIBusPropTypeClientCommitPreedit(bool inClientCommitPreedit);
+
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
+
+ bool clientCommitPreedit;
+};
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusPropTypeClientCommitPreedit &data)
+{ data.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusPropTypeClientCommitPreedit &data)
+{ data.deserializeFrom(argument); return argument; }
+
+class QIBusPropTypeContentType
+{
+public:
+ QIBusPropTypeContentType() {};
+
+ QIBusPropTypeContentType(unsigned int inPurpose, unsigned int inHint);
+
+ void serializeTo(QDBusArgument &argument) const;
+ void deserializeFrom(const QDBusArgument &argument);
+
+ unsigned int purpose;
+ unsigned int hints;
+};
+inline QDBusArgument &operator<<(QDBusArgument &argument, const QIBusPropTypeContentType &data)
+{ data.serializeTo(argument); return argument; }
+inline const QDBusArgument &operator>>(const QDBusArgument &argument, QIBusPropTypeContentType &data)
+{ data.deserializeFrom(argument); return argument; }
+
+Q_DECLARE_TYPEINFO(QIBusPropTypeClientCommitPreedit, Q_RELOCATABLE_TYPE);
+Q_DECLARE_TYPEINFO(QIBusPropTypeContentType, Q_RELOCATABLE_TYPE);
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QIBusAttribute)
@@ -176,4 +178,6 @@ Q_DECLARE_METATYPE(QIBusAttributeList)
Q_DECLARE_METATYPE(QIBusText)
Q_DECLARE_METATYPE(QIBusEngineDesc)
+Q_DECLARE_METATYPE(QIBusPropTypeClientCommitPreedit)
+Q_DECLARE_METATYPE(QIBusPropTypeContentType)
#endif
diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro
deleted file mode 100644
index 56a39a49e7..0000000000
--- a/src/plugins/platforminputcontexts/platforminputcontexts.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = subdirs
-QT_FOR_CONFIG += gui-private
-
-qtConfig(xkbcommon) {
- SUBDIRS += compose
-
- qtHaveModule(dbus) {
- !macos:!win32:SUBDIRS += ibus
- }
-}
-