Skip to content

Commit e7c2830

Browse files
committed
move static addons to v2
1 parent 257744b commit e7c2830

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

common/common.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "common.h"
22
#include "../engines/fcitx5-hallelujah/src/factory.h"
33
#include "../fcitx5/src/lib/fcitx/addoninstance.h"
4-
#include "../iosfrontend/iosfrontend.h"
5-
#include "../iosnotifications/iosnotifications.h"
6-
#include "../uipanel/uipanel.h"
4+
#include "../fcitx5/src/lib/fcitx/addonmanager.h"
75
#include "nativestreambuf.h"
86
#include <filesystem>
97

@@ -15,23 +13,17 @@ fcitx::HallelujahFactory HallelujahFactory;
1513

1614
namespace fs = std::filesystem;
1715

18-
static fcitx::IosFrontendFactory IosFrontendFactory;
19-
static fcitx::IosNotificationsFactory IosNotificationsFactory;
20-
static fcitx::UIPanelFactory UIPanelFactory;
21-
2216
static fcitx::StaticAddonRegistry addons = {
2317
#ifdef HALLELUJAH
2418
std::make_pair<std::string, fcitx::AddonFactory *>("hallelujah",
2519
&HallelujahFactory),
2620
#endif
27-
std::make_pair<std::string, fcitx::AddonFactory *>("iosfrontend",
28-
&IosFrontendFactory),
29-
std::make_pair<std::string, fcitx::AddonFactory *>(
30-
"notifications", &IosNotificationsFactory),
31-
std::make_pair<std::string, fcitx::AddonFactory *>("uipanel",
32-
&UIPanelFactory),
3321
};
3422

23+
FCITX_IMPORT_ADDON_FACTORY(addons, iosfrontend);
24+
FCITX_IMPORT_ADDON_FACTORY(addons, notifications);
25+
FCITX_IMPORT_ADDON_FACTORY(addons, uipanel);
26+
3527
#ifdef HALLELUJAH
3628
FCITX_IMPORT_ADDON_FACTORY(addons, spell);
3729
#endif

iosfrontend/iosfrontend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ void IosInputContext::updatePreeditImpl() {
5353
preedit.cursor());
5454
}
5555
} // namespace fcitx
56+
57+
FCITX_ADDON_FACTORY_V2(iosfrontend, fcitx::IosFrontendFactory);

iosnotifications/iosnotifications.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ void Notifications::closeNotification(uint64_t internalId) {
2929
FCITX_INFO() << "closeNotification " << internalId;
3030
}
3131
} // namespace fcitx
32+
33+
FCITX_ADDON_FACTORY_V2(notifications, fcitx::IosNotificationsFactory);

uipanel/uipanel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ void UIPanel::updateStatusArea(InputContext *ic) {
7474

7575
} // namespace fcitx
7676

77+
FCITX_ADDON_FACTORY_V2(uipanel, fcitx::UIPanelFactory);
78+
7779
void selectCandidate(int index) {
7880
with_fcitx([index] {
7981
auto ic = instance->mostRecentInputContext();

0 commit comments

Comments
 (0)