File tree Expand file tree Collapse file tree 10 files changed +105
-7
lines changed Expand file tree Collapse file tree 10 files changed +105
-7
lines changed Original file line number Diff line number Diff line change 1717
1818 - name : Lint
1919 run : |
20- find src keyboard -name '*.cpp' -o -name '*.h' | xargs clang-format -Werror --dry-run
21- swift-format lint -rs src keyboard
20+ find src keyboard iosfrontend uipanel -name '*.cpp' -o -name '*.h' | xargs clang-format -Werror --dry-run
21+ swift-format lint -rs src keyboard iosfrontend
2222
2323 build :
2424 needs : lint
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ find_host_package(Gettext)
5959add_subdirectory (fcitx5)
6060
6161add_subdirectory (iosfrontend)
62+ add_subdirectory (uipanel)
6263
6364add_subdirectory (engines)
6465
Original file line number Diff line number Diff line change 44namespace fcitx {
55
66IosFrontend::IosFrontend (Instance *instance)
7- : instance_(instance),
8- focusGroup_ (" ios" , instance->inputContextManager ()) {
7+ : instance_(instance), focusGroup_(" ios" , instance->inputContextManager ()) {
98 createInputContext ();
109}
1110
@@ -28,7 +27,7 @@ void IosFrontend::focusIn(id client) {
2827void IosFrontend::focusOut () { ic_->focusOut (); }
2928
3029IosInputContext::IosInputContext (IosFrontend *frontend,
31- InputContextManager &inputContextManager)
30+ InputContextManager &inputContextManager)
3231 : InputContext(inputContextManager, " " ), frontend_(frontend) {
3332 CapabilityFlags flags = CapabilityFlag::Preedit;
3433 setCapabilityFlags (flags);
Original file line number Diff line number Diff line change 11#pragma once
22
3- #include < objc/objc.h>
43#include < fcitx-config/configuration.h>
54#include < fcitx/addonfactory.h>
65#include < fcitx/addoninstance.h>
76#include < fcitx/addonmanager.h>
87#include < fcitx/focusgroup.h>
98#include < fcitx/instance.h>
9+ #include < objc/objc.h>
1010
1111namespace fcitx {
1212
@@ -43,7 +43,7 @@ class IosFrontendFactory : public AddonFactory {
4343class IosInputContext : public InputContext {
4444 public:
4545 IosInputContext (IosFrontend *frontend,
46- InputContextManager &inputContextManager);
46+ InputContextManager &inputContextManager);
4747 ~IosInputContext ();
4848
4949 const char *frontend () const override { return " ios" ; }
Original file line number Diff line number Diff line change @@ -18,5 +18,6 @@ target_link_libraries(keyboard PRIVATE
1818 spell
1919 iosfrontend
2020 SwiftFrontend
21+ uipanel
2122 "${ENGINE} "
2223)
Original file line number Diff line number Diff line change 11#include " ../fcitx5/src/modules/spell/spell.h"
22#include " ../iosfrontend/iosfrontend.h"
3+ #include " ../uipanel/uipanel.h"
34#include " nativestreambuf.h"
45#include < fcitx-utils/event.h>
56#include < fcitx-utils/eventdispatcher.h>
@@ -23,12 +24,15 @@ namespace fs = std::filesystem;
2324
2425fcitx::SpellModuleFactory SpellModuleFactory;
2526fcitx::IosFrontendFactory IosFrontendFactory;
27+ fcitx::UIPanelFactory UIPanelFactory;
2628
2729fcitx::StaticAddonRegistry addons = {
2830 std::make_pair<std::string, fcitx::AddonFactory *>(" spell" ,
2931 &SpellModuleFactory),
3032 std::make_pair<std::string, fcitx::AddonFactory *>(" iosfrontend" ,
3133 &IosFrontendFactory),
34+ std::make_pair<std::string, fcitx::AddonFactory *>(" uipanel" ,
35+ &UIPanelFactory),
3236 std::make_pair<std::string, fcitx::AddonFactory *>(ENGINE_ADDON,
3337 &EngineFactory),
3438};
Original file line number Diff line number Diff line change 1+ add_library (uipanel STATIC uipanel.cpp)
2+ target_link_libraries (uipanel Fcitx5::Core)
3+
4+ configure_file (uipanel.conf.in.in uipanel.conf.in @ONLY)
5+ fcitx5_translate_desktop_file(${CMAKE_CURRENT_BINARY_DIR} /uipanel.conf.in uipanel.conf)
6+
7+ add_custom_command (
8+ TARGET uipanel
9+ POST_BUILD COMMAND /bin/sh -c
10+ \"
11+ ${CMAKE_COMMAND} -E copy
12+ ${CMAKE_CURRENT_BINARY_DIR} /uipanel.conf
13+ ${PROJECT_BINARY_DIR} /keyboard/$<CONFIG>${CMAKE_XCODE_EFFECTIVE_PLATFORMS} /keyboard.appex/share/fcitx5/addon/uipanel.conf
14+ \"
15+ )
Original file line number Diff line number Diff line change 1+ [Addon]
2+ Name=UIPanel
3+ Type=StaticLibrary
4+ Library=libuipanel
5+ Category=UI
6+ Version=@PROJECT_VERSION@
7+ Configurable=True
Original file line number Diff line number Diff line change 1+ #include < fcitx/inputpanel.h>
2+
3+ #include " uipanel.h"
4+
5+ namespace fcitx {
6+
7+ UIPanel::UIPanel (Instance *instance) : instance_(instance) {}
8+
9+ void UIPanel::update (UserInterfaceComponent component,
10+ InputContext *inputContext) {
11+ switch (component) {
12+ case UserInterfaceComponent::InputPanel: {
13+ const InputPanel &inputPanel = inputContext->inputPanel ();
14+ int size = 0 ;
15+ if (const auto &list = inputPanel.candidateList ()) {
16+ size = list->size ();
17+ for (int i = 0 ; i < size; i++) {
18+ const auto &candidate = list->candidate (i);
19+ FCITX_INFO ()
20+ << instance_->outputFilter (inputContext, candidate.text ())
21+ .toString ();
22+ }
23+ }
24+ break ;
25+ }
26+ case UserInterfaceComponent::StatusArea:
27+ break ;
28+ }
29+ }
30+
31+ } // namespace fcitx
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < fcitx/addonfactory.h>
4+ #include < fcitx/addoninstance.h>
5+ #include < fcitx/addonmanager.h>
6+ #include < fcitx/instance.h>
7+
8+ namespace fcitx {
9+
10+ class UIPanel final : public UserInterface {
11+ public:
12+ UIPanel (Instance *);
13+ virtual ~UIPanel () = default ;
14+
15+ void reloadConfig () override {}
16+ const Configuration *getConfig () const override { return nullptr ; }
17+ void setConfig (const RawConfig &config) override {}
18+ void setSubConfig (const std::string &path,
19+ const RawConfig &config) override {}
20+
21+ Instance *instance () { return instance_; }
22+
23+ bool available () override { return true ; }
24+ void suspend () override {}
25+ void resume () override {}
26+ void update (UserInterfaceComponent component,
27+ InputContext *inputContext) override ;
28+
29+ private:
30+ Instance *instance_;
31+ };
32+
33+ class UIPanelFactory : public AddonFactory {
34+ public:
35+ AddonInstance *create (AddonManager *manager) override {
36+ return new UIPanel (manager->instance ());
37+ }
38+ };
39+
40+ } // namespace fcitx
You can’t perform that action at this time.
0 commit comments