Add qt6 support.
This commit is contained in:
parent
f5adc1bd85
commit
b3b0245ce3
|
@ -11,6 +11,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|||
|
||||
option(ENABLE_QT4 "Enable Qt 4" On)
|
||||
option(ENABLE_QT5 "Enable Qt 5" On)
|
||||
option(ENABLE_QT6 "Enable Qt 5" Off)
|
||||
option(BUILD_ONLY_PLUGIN "Build only plugin" Off)
|
||||
option(BUILD_STATIC_PLUGIN "Build plugin as static" Off)
|
||||
option(WITH_FCITX_PLUGIN_NAME "Enable plugin name with fcitx" On)
|
||||
|
@ -57,6 +58,7 @@ else()
|
|||
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
|
||||
endif()
|
||||
|
||||
set(Fcitx5Qt6_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt6)
|
||||
set(Fcitx5Qt5_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt5)
|
||||
set(Fcitx5Qt4_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/Fcitx5Qt4)
|
||||
|
||||
|
@ -71,6 +73,12 @@ if(ENABLE_QT5)
|
|||
add_subdirectory(qt5)
|
||||
endif()
|
||||
|
||||
if(ENABLE_QT6)
|
||||
find_package(Qt6 ${REQUIRED_QT5_VERSION} CONFIG REQUIRED Core DBus)
|
||||
find_package(Qt6Gui ${REQUIRED_QT5_VERSION} REQUIRED Private)
|
||||
add_subdirectory(qt6)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_ONLY_PLUGIN)
|
||||
find_package(Gettext REQUIRED)
|
||||
add_subdirectory(po)
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QKeyEvent>
|
||||
#include <QPalette>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTextCodec>
|
||||
#include <QWindow>
|
||||
#include <qpa/qplatformcursor.h>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
@ -212,11 +211,8 @@ void QFcitxPlatformInputContext::commitPreedit(QPointer<QObject> input) {
|
|||
}
|
||||
|
||||
bool checkUtf8(const QByteArray &byteArray) {
|
||||
QTextCodec::ConverterState state;
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
const QString text =
|
||||
codec->toUnicode(byteArray.constData(), byteArray.size(), &state);
|
||||
return state.invalidChars == 0;
|
||||
QString s = QString::fromUtf8(byteArray);
|
||||
return !s.contains(QChar::ReplacementCharacter);
|
||||
}
|
||||
|
||||
void QFcitxPlatformInputContext::reset() {
|
||||
|
@ -308,9 +304,9 @@ void QFcitxPlatformInputContext::update(Qt::InputMethodQueries queries) {
|
|||
anchor = cursor;
|
||||
|
||||
// adjust it to real character size
|
||||
QVector<uint> tempUCS4 = text.leftRef(cursor).toUcs4();
|
||||
QVector<uint> tempUCS4 = text.left(cursor).toUcs4();
|
||||
cursor = tempUCS4.size();
|
||||
tempUCS4 = text.leftRef(anchor).toUcs4();
|
||||
tempUCS4 = text.left(anchor).toUcs4();
|
||||
anchor = tempUCS4.size();
|
||||
if (data.surroundingText != text) {
|
||||
data.surroundingText = text;
|
||||
|
@ -548,7 +544,7 @@ void QFcitxPlatformInputContext::deleteSurroundingText(int offset,
|
|||
|
||||
FcitxQtICData *data =
|
||||
static_cast<FcitxQtICData *>(proxy->property("icData").value<void *>());
|
||||
QVector<uint> ucsText = data->surroundingText.toUcs4();
|
||||
auto ucsText = data->surroundingText.toStdU32String();
|
||||
|
||||
int cursor = data->surroundingCursor;
|
||||
// make nchar signed so we are safer
|
||||
|
@ -567,9 +563,9 @@ void QFcitxPlatformInputContext::deleteSurroundingText(int offset,
|
|||
|
||||
// validates
|
||||
if (nchar >= 0 && cursor + offset >= 0 &&
|
||||
cursor + offset + nchar < ucsText.size()) {
|
||||
cursor + offset + nchar < static_cast<int>(ucsText.size())) {
|
||||
// order matters
|
||||
QVector<uint> replacedChars = ucsText.mid(cursor + offset, nchar);
|
||||
auto replacedChars = ucsText.substr(cursor + offset, nchar);
|
||||
nchar = QString::fromUcs4(replacedChars.data(), replacedChars.size())
|
||||
.size();
|
||||
|
||||
|
@ -582,7 +578,7 @@ void QFcitxPlatformInputContext::deleteSurroundingText(int offset,
|
|||
len = -offset;
|
||||
}
|
||||
|
||||
QVector<uint> prefixedChars = ucsText.mid(start, len);
|
||||
auto prefixedChars = ucsText.substr(start, len);
|
||||
offset = QString::fromUcs4(prefixedChars.data(), prefixedChars.size())
|
||||
.size() *
|
||||
(offset >= 0 ? 1 : -1);
|
||||
|
@ -691,7 +687,7 @@ QKeyEvent *QFcitxPlatformInputContext::createKeyEvent(uint keyval, uint state,
|
|||
count++;
|
||||
}
|
||||
|
||||
auto unicode = xkb_keysym_to_utf32(keyval);
|
||||
char32_t unicode = xkb_keysym_to_utf32(keyval);
|
||||
QString text;
|
||||
if (unicode) {
|
||||
text = QString::fromUcs4(&unicode, 1);
|
||||
|
@ -772,9 +768,9 @@ bool QFcitxPlatformInputContext::filterEvent(const QEvent *event) {
|
|||
update(Qt::ImHints);
|
||||
proxy->focusIn();
|
||||
|
||||
auto reply =
|
||||
proxy->processKeyEvent(keyval, keycode, state, isRelease,
|
||||
QDateTime::currentDateTime().toTime_t());
|
||||
auto reply = proxy->processKeyEvent(
|
||||
keyval, keycode, state, isRelease,
|
||||
QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
|
||||
if (Q_UNLIKELY(syncMode_)) {
|
||||
reply.waitForFinished();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
add_subdirectory(dbusaddons)
|
||||
add_subdirectory(platforminputcontext)
|
|
@ -0,0 +1,80 @@
|
|||
ecm_setup_version(PROJECT VARIABLE_PREFIX FCITX5QT6DBUSADDONS
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt6dbusaddons_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt6DBusAddonsConfigVersion.cmake"
|
||||
SOVERSION 1)
|
||||
|
||||
# create a Config.cmake and a ConfigVersion.cmake file and install them
|
||||
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/Fcitx5Qt6DBusAddons")
|
||||
|
||||
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Fcitx5Qt6DBusAddonsConfig.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt6DBusAddonsConfig.cmake"
|
||||
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
||||
set(dbusaddons_SOURCES
|
||||
fcitxqtwatcher.cpp
|
||||
fcitxqtdbustypes.cpp
|
||||
fcitxqtinputcontextproxy.cpp
|
||||
fcitxqtinputcontextproxyimpl.cpp
|
||||
fcitxqtinputmethodproxy.cpp
|
||||
fcitxqtcontrollerproxy.cpp
|
||||
)
|
||||
|
||||
set(dbusaddons_HEADERS
|
||||
fcitxqtwatcher.h
|
||||
fcitxqtdbustypes.h
|
||||
fcitxqtinputcontextproxy.h
|
||||
fcitxqtinputmethodproxy.h
|
||||
fcitxqtcontrollerproxy.h
|
||||
)
|
||||
|
||||
set(fcitxqtdbusaddons_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_library(Fcitx5Qt6DBusAddons ${LIBRARY_TYPE} ${dbusaddons_SOURCES})
|
||||
generate_export_header(Fcitx5Qt6DBusAddons BASE_NAME Fcitx5Qt6DBusAddons)
|
||||
add_library(Fcitx5Qt6::DBusAddons ALIAS Fcitx5Qt6DBusAddons)
|
||||
|
||||
target_include_directories(Fcitx5Qt6DBusAddons PUBLIC "$<BUILD_INTERFACE:${fcitxqtdbusaddons_INCLUDE_DIRS}>")
|
||||
target_include_directories(Fcitx5Qt6DBusAddons INTERFACE "$<INSTALL_INTERFACE:${Fcitx5Qt6_INCLUDE_INSTALL_DIR}/Fcitx5Qt6DBusAddons>")
|
||||
|
||||
set_target_properties(Fcitx5Qt6DBusAddons
|
||||
PROPERTIES VERSION ${FCITX5QT6DBUSADDONS_VERSION}
|
||||
AUTOMOC TRUE
|
||||
SOVERSION ${FCITX5QT6DBUSADDONS_SOVERSION}
|
||||
COMPILE_FLAGS "${LIBRARY_COMPILE_FLAGS}"
|
||||
EXPORT_NAME DBusAddons
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
Fcitx5Qt6DBusAddons
|
||||
PUBLIC
|
||||
Qt6::Core
|
||||
Qt6::DBus
|
||||
)
|
||||
|
||||
if(BUILD_ONLY_PLUGIN)
|
||||
set_target_properties(Fcitx5Qt6DBusAddons PROPERTIES
|
||||
COMPILE_DEFINITIONS "FCITX5QT6DBUSADDONS_STATIC_DEFINE")
|
||||
|
||||
else()
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt6DBusAddonsConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Fcitx5Qt6DBusAddonsConfigVersion.cmake"
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel )
|
||||
|
||||
install(EXPORT Fcitx5Qt6DBusAddonsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Fcitx5Qt6DBusAddonsTargets.cmake NAMESPACE Fcitx5Qt6:: )
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt6dbusaddons_version.h
|
||||
DESTINATION ${Fcitx5Qt6_INCLUDE_INSTALL_DIR} COMPONENT Devel )
|
||||
|
||||
install(TARGETS Fcitx5Qt6DBusAddons EXPORT Fcitx5Qt6DBusAddonsTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
install(FILES ${dbusaddons_HEADERS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/fcitx5qt6dbusaddons_export.h
|
||||
DESTINATION "${Fcitx5Qt6_INCLUDE_INSTALL_DIR}/Fcitx5Qt6DBusAddons")
|
||||
endif()
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Qt5Core @REQUIRED_QT5_VERSION@)
|
||||
find_dependency(Qt5DBus @REQUIRED_QT5_VERSION@)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/Fcitx5Qt5DBusAddonsTargets.cmake")
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtcontrollerproxy.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtcontrollerproxy.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtdbustypes.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtdbustypes.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputcontextproxy.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputcontextproxy.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputcontextproxy_p.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputcontextproxyimpl.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputcontextproxyimpl.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputmethodproxy.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtinputmethodproxy.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtwatcher.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtwatcher.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/dbusaddons/fcitxqtwatcher_p.h
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
qdbusxml2cpp-qt6 -N -p fcitxqtinputcontextproxyimpl -c FcitxQtInputContextProxyImpl interfaces/org.fcitx.Fcitx.InputContext1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
|
||||
qdbusxml2cpp-qt6 -N -p fcitxqtinputmethodproxy -c FcitxQtInputMethodProxy interfaces/org.fcitx.Fcitx.InputMethod1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
|
||||
qdbusxml2cpp-qt6 -N -p fcitxqtcontrollerproxy -c FcitxQtControllerProxy interfaces/org.fcitx.Fcitx.Controller1.xml -i fcitxqtdbustypes.h -i fcitx5qt5dbusaddons_export.h
|
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.fcitx.Fcitx.Controller1">
|
||||
<method name="Exit">
|
||||
</method>
|
||||
<method name="Restart">
|
||||
</method>
|
||||
<method name="Configure">
|
||||
</method>
|
||||
<method name="ConfigureAddon">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="ConfigureIM">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="CurrentUI">
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="AddonForIM">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="Activate">
|
||||
</method>
|
||||
<method name="Toggle">
|
||||
</method>
|
||||
<method name="ResetIMList">
|
||||
</method>
|
||||
<method name="State">
|
||||
<arg type="i" direction="out"/>
|
||||
</method>
|
||||
<method name="ReloadConfig">
|
||||
</method>
|
||||
<method name="ReloadAddonConfig">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="CurrentInputMethod">
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="SetCurrentIM">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="InputMethodGroupInfo">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="s" name="layout" direction="out"/>
|
||||
<arg type="a(ss)" name="items" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="FcitxQtStringKeyValueList" />
|
||||
</method>
|
||||
<method name="InputMethodGroups">
|
||||
<arg type="as" direction="out"/>
|
||||
</method>
|
||||
<method name="AvailableInputMethods">
|
||||
<arg type="a(ssssssb)" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtInputMethodEntryList" />
|
||||
</method>
|
||||
<signal name="InputMethodGroupsChanged">
|
||||
</signal>
|
||||
<method name="AvailableKeyboardLayouts">
|
||||
<arg type="a(ssasa(ssas))" direction="out" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtLayoutInfoList" />
|
||||
</method>
|
||||
<method name="SetInputMethodGroupInfo">
|
||||
<arg type="s" name="name" direction="in"/>
|
||||
<arg type="s" name="layout" direction="in"/>
|
||||
<arg type="a(ss)" name="entries" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="FcitxQtStringKeyValueList" />
|
||||
</method>
|
||||
<method name="AddInputMethodGroup">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="RemoveInputMethodGroup">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="GetConfig">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="v" direction="out"/>
|
||||
<arg type="a(sa(sssva{sv}))" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="FcitxQtConfigTypeList" />
|
||||
</method>
|
||||
<method name="SetConfig">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="v" direction="in"/>
|
||||
</method>
|
||||
<method name="GetAddons">
|
||||
<arg type="a(sssibb)" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtAddonInfoList" />
|
||||
</method>
|
||||
<method name="GetAddonsV2">
|
||||
<arg type="a(sssibbbasas)" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtAddonInfoListV2" />
|
||||
</method>
|
||||
<method name="SetAddonsState">
|
||||
<arg type="a(sb)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtAddonStateList" />
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.fcitx.Fcitx.InputContext1">
|
||||
<method name="FocusIn">
|
||||
</method>
|
||||
<method name="FocusOut">
|
||||
</method>
|
||||
<method name="Reset">
|
||||
</method>
|
||||
<method name="SetCursorRect">
|
||||
<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="SetCursorRectV2">
|
||||
<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"/>
|
||||
<arg name="scale" direction="in" type="d"/>
|
||||
</method>
|
||||
<method name="SetCapability">
|
||||
<arg name="caps" direction="in" type="t"/>
|
||||
</method>
|
||||
<method name="SetSurroundingText">
|
||||
<arg name="text" direction="in" type="s"/>
|
||||
<arg name="cursor" direction="in" type="u"/>
|
||||
<arg name="anchor" direction="in" type="u"/>
|
||||
</method>
|
||||
<method name="SetSurroundingTextPosition">
|
||||
<arg name="cursor" direction="in" type="u"/>
|
||||
<arg name="anchor" direction="in" type="u"/>
|
||||
</method>
|
||||
<method name="DestroyIC">
|
||||
</method>
|
||||
<method name="ProcessKeyEvent">
|
||||
<arg name="keyval" direction="in" type="u"/>
|
||||
<arg name="keycode" direction="in" type="u"/>
|
||||
<arg name="state" direction="in" type="u"/>
|
||||
<arg name="type" direction="in" type="b"/>
|
||||
<arg name="time" direction="in" type="u"/>
|
||||
<arg name="ret" direction="out" type="b"/>
|
||||
</method>
|
||||
<signal name="CommitString">
|
||||
<arg name="str" type="s"/>
|
||||
</signal>
|
||||
<signal name="CurrentIM">
|
||||
<arg name="name" type="s"/>
|
||||
<arg name="uniqueName" type="s"/>
|
||||
<arg name="langCode" type="s"/>
|
||||
</signal>
|
||||
<signal name="UpdateFormattedPreedit">
|
||||
<arg name="str" type="a(si)" />
|
||||
<arg name="cursorpos" type="i"/>
|
||||
<!-- qt4 / 5 seems use in/out differently -->
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtFormattedPreeditList" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FcitxQtFormattedPreeditList" />
|
||||
</signal>
|
||||
<signal name="DeleteSurroundingText">
|
||||
<arg name="offset" type="i"/>
|
||||
<arg name="nchar" type="u"/>
|
||||
</signal>
|
||||
<signal name="ForwardKey">
|
||||
<arg name="keyval" type="u"/>
|
||||
<arg name="state" type="u"/>
|
||||
<arg name="type" type="b"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.fcitx.Fcitx.InputMethod1">
|
||||
<method name="CreateInputContext">
|
||||
<arg type="a(ss)" direction="in"/>
|
||||
<arg type="o" direction="out"/>
|
||||
<arg type="ay" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FcitxQtStringKeyValueList" />
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
|
@ -0,0 +1,59 @@
|
|||
include_directories(${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
||||
|
||||
set(FCITX5_QT_EXTRA_PLUGIN_NAME "")
|
||||
if (WITH_FCITX_PLUGIN_NAME)
|
||||
set(FCITX5_QT_EXTRA_PLUGIN_NAME "\"fcitx\",")
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json")
|
||||
|
||||
set(plugin_SRCS
|
||||
qfcitxplatforminputcontext.cpp
|
||||
qtkey.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(plugin_MOC_HDRS
|
||||
qfcitxplatforminputcontext.h
|
||||
main.h
|
||||
)
|
||||
|
||||
add_library(fcitx5platforminputcontextplugin-qt6 ${PLUGIN_LIBRARY_TYPE} ${plugin_SRCS})
|
||||
set_target_properties(fcitx5platforminputcontextplugin-qt6 PROPERTIES
|
||||
OUTPUT_NAME fcitx5platforminputcontextplugin
|
||||
AUTOMOC TRUE
|
||||
)
|
||||
target_include_directories(fcitx5platforminputcontextplugin-qt6 PRIVATE "${PROJECT_SOURCE_DIR}/common")
|
||||
if (BUILD_ONLY_PLUGIN AND BUILD_STATIC_PLUGIN)
|
||||
target_compile_definitions(fcitx5platforminputcontextplugin-qt6 PRIVATE "-DQT_STATICPLUGIN")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(fcitx5platforminputcontextplugin-qt6 PRIVATE "-DFCITX_PLUGIN_DATA_FILE_PATH=\"${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json\"")
|
||||
if (WITH_FCITX_PLUGIN_NAME)
|
||||
# This is not really necessary, but can trigger a cmake rebuild.
|
||||
target_compile_definitions(fcitx5platforminputcontextplugin-qt6 PRIVATE "-DFCITX5_QT_WITH_FCITX_NAME")
|
||||
endif()
|
||||
|
||||
|
||||
target_link_libraries(fcitx5platforminputcontextplugin-qt6
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::DBus
|
||||
XCB::XCB
|
||||
Fcitx5Qt6::DBusAddons
|
||||
XKBCommon::XKBCommon
|
||||
)
|
||||
|
||||
get_target_property(_QT6_QMAKE_EXECUTABLE Qt6::qmake LOCATION)
|
||||
execute_process(
|
||||
COMMAND ${_QT6_QMAKE_EXECUTABLE} -query "QT_INSTALL_PLUGINS"
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE _QT6PLUGINDIR
|
||||
)
|
||||
if(return_code EQUAL 0)
|
||||
string(STRIP "${_QT6PLUGINDIR}" _QT6PLUGINDIR)
|
||||
else()
|
||||
message(FATAL_ERROR "QMake Qt6 call failed: ${return_code}")
|
||||
endif()
|
||||
set(CMAKE_INSTALL_QT6PLUGINDIR ${_QT6PLUGINDIR} CACHE PATH "Qt6 plugin dir")
|
||||
install(TARGETS fcitx5platforminputcontextplugin-qt6 DESTINATION ${CMAKE_INSTALL_QT6PLUGINDIR}/platforminputcontexts)
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/fcitx5.json.in
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/main.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/main.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/qfcitxplatforminputcontext.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/qfcitxplatforminputcontext.h
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/qtkey.cpp
|
|
@ -0,0 +1 @@
|
|||
../../qt5/platforminputcontext/qtkey.h
|
Loading…
Reference in New Issue