diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0854a9a..78ef79b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,7 @@ set(RIME_SOURCES rimecandidate.cpp rimesession.cpp rimeaction.cpp + rimefactory.cpp ) set(RIME_LINK_LIBRARIES diff --git a/src/rimeengine.cpp b/src/rimeengine.cpp index 090ee37..49fc5b8 100644 --- a/src/rimeengine.cpp +++ b/src/rimeengine.cpp @@ -793,5 +793,3 @@ PropertyPropagatePolicy RimeEngine::getSharedStatePolicy() { } } // namespace fcitx - -FCITX_ADDON_FACTORY(fcitx::RimeEngineFactory) diff --git a/src/rimeengine.h b/src/rimeengine.h index 6bec003..823e7ff 100644 --- a/src/rimeengine.h +++ b/src/rimeengine.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -234,14 +233,6 @@ class RimeEngine final : public InputMethodEngineV2 { std::thread::id mainThreadId_ = std::this_thread::get_id(); RimeState *currentKeyEventState_ = nullptr; }; - -class RimeEngineFactory : public AddonFactory { -public: - AddonInstance *create(AddonManager *manager) override { - registerDomain("fcitx5-rime", FCITX_INSTALL_LOCALEDIR); - return new RimeEngine(manager->instance()); - } -}; } // namespace fcitx FCITX_DECLARE_LOG_CATEGORY(rime); diff --git a/src/rimefactory.cpp b/src/rimefactory.cpp new file mode 100644 index 0000000..91a2f37 --- /dev/null +++ b/src/rimefactory.cpp @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2024-2024 CSSlayer + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "rimefactory.h" +#include "rimeengine.h" +#include + +namespace fcitx { + +AddonInstance *RimeEngineFactory::create(AddonManager *manager) { + registerDomain("fcitx5-rime", FCITX_INSTALL_LOCALEDIR); + return new RimeEngine(manager->instance()); +} + +} // namespace fcitx + +FCITX_ADDON_FACTORY(fcitx::RimeEngineFactory) diff --git a/src/rimefactory.h b/src/rimefactory.h new file mode 100644 index 0000000..3df3928 --- /dev/null +++ b/src/rimefactory.h @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2024-2024 CSSlayer + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ +#ifndef _FCITX_RIMEFACTORY_H_ +#define _FCITX_RIMEFACTORY_H_ + +#include + +namespace fcitx { + +class RimeEngineFactory : public AddonFactory { +public: + AddonInstance *create(AddonManager *manager) override; +}; + +} // namespace fcitx + +#endif