88#include " config.h"
99
1010#include < pwd.h>
11- #include < fstream>
11+ #include < unistd.h>
12+ #include < cstdint>
13+ #include < memory>
1214#include < set>
1315#include < sstream>
16+ #include < stdexcept>
17+ #include < string>
18+ #include < tuple>
19+ #include < unordered_set>
20+ #include < utility>
21+ #include < vector>
1422#include < format>
23+ #include " fcitx-config/configuration.h"
1524#include " fcitx-config/dbushelper.h"
25+ #include " fcitx-config/rawconfig.h"
1626#include " fcitx-utils/dbus/bus.h"
27+ #include " fcitx-utils/dbus/message.h"
28+ #include " fcitx-utils/dbus/objectvtable.h"
1729#include " fcitx-utils/dbus/variant.h"
30+ #include " fcitx-utils/eventloopinterface.h"
1831#include " fcitx-utils/i18n.h"
32+ #include " fcitx-utils/log.h"
33+ #include " fcitx-utils/misc.h"
1934#include " fcitx-utils/stringutils.h"
35+ #include " fcitx-utils/unixfd.h"
36+ #include " fcitx/addoninfo.h"
37+ #include " fcitx/addoninstance.h"
2038#include " fcitx/addonmanager.h"
2139#include " fcitx/focusgroup.h"
2240#include " fcitx/inputcontextmanager.h"
2745#include " dbusmodule.h"
2846#include " keyboard_public.h"
2947#ifdef ENABLE_X11
48+ #include < xcb/xcb.h>
49+ #include < xcb/xproto.h>
3050#include " xcb_public.h"
3151#endif
3252#ifdef WAYLAND_FOUND
@@ -143,24 +163,28 @@ class Controller1 : public ObjectVTable<Controller1> {
143163 });
144164 }
145165 void configure () { instance_->configure (); }
146- void configureAddon (const std::string &) { instance_->configure (); }
147- void configureInputMethod (const std::string &) { instance_->configure (); }
166+ void configureAddon (const std::string & /* unused*/ ) {
167+ instance_->configure ();
168+ }
169+ void configureInputMethod (const std::string & /* unused*/ ) {
170+ instance_->configure ();
171+ }
148172 std::string currentUI () { return instance_->currentUI (); }
149173 std::string addonForInputMethod (const std::string &imName) {
150174 return instance_->addonForInputMethod (imName);
151175 }
152- void activate () { return instance_->activate (); }
153- void deactivate () { return instance_->deactivate (); }
154- void toggle () { return instance_->toggle (); }
155- void resetInputMethodList () { return instance_->resetInputMethodList (); }
176+ void activate () { instance_->activate (); }
177+ void deactivate () { instance_->deactivate (); }
178+ void toggle () { instance_->toggle (); }
179+ void resetInputMethodList () { instance_->resetInputMethodList (); }
156180 int state () { return instance_->state (); }
157- void reloadConfig () { return instance_->reloadConfig (); }
181+ void reloadConfig () { instance_->reloadConfig (); }
158182 void reloadAddonConfig (const std::string &addonName) {
159- return instance_->reloadAddonConfig (addonName);
183+ instance_->reloadAddonConfig (addonName);
160184 }
161185 std::string currentInputMethod () { return instance_->currentInputMethod (); }
162186 void setCurrentInputMethod (const std::string &imName) {
163- return instance_->setCurrentInputMethod (imName);
187+ instance_->setCurrentInputMethod (imName);
164188 }
165189
166190 std::vector<std::string> inputMethodGroups () {
@@ -463,9 +487,9 @@ class Controller1 : public ObjectVTable<Controller1> {
463487 continue ;
464488 }
465489 bool enabled = info->isDefaultEnabled ();
466- if (disabledSet.count (info->uniqueName ())) {
490+ if (disabledSet.contains (info->uniqueName ())) {
467491 enabled = false ;
468- } else if (enabledSet.count (info->uniqueName ())) {
492+ } else if (enabledSet.contains (info->uniqueName ())) {
469493 enabled = true ;
470494 }
471495 result.emplace_back (info->uniqueName (), info->name ().match (),
@@ -502,9 +526,9 @@ class Controller1 : public ObjectVTable<Controller1> {
502526 continue ;
503527 }
504528 bool enabled = info->isDefaultEnabled ();
505- if (disabledSet.count (info->uniqueName ())) {
529+ if (disabledSet.contains (info->uniqueName ())) {
506530 enabled = false ;
507- } else if (enabledSet.count (info->uniqueName ())) {
531+ } else if (enabledSet.contains (info->uniqueName ())) {
508532 enabled = true ;
509533 }
510534 result.emplace_back (info->uniqueName (), info->name ().match (),
@@ -629,7 +653,7 @@ class Controller1 : public ObjectVTable<Controller1> {
629653 std::stringstream ss;
630654 instance_->inputContextManager ().foreachGroup ([&ss](FocusGroup *group) {
631655 ss << " Group [" << group->display () << " ] has " << group->size ()
632- << " InputContext(s)" << std::endl ;
656+ << " InputContext(s)" << ' \n ' ;
633657 group->foreach ([&ss](InputContext *ic) {
634658 ss << " IC [" ;
635659 for (auto v : ic->uuid ()) {
@@ -639,12 +663,12 @@ class Controller1 : public ObjectVTable<Controller1> {
639663 << " frontend:" << ic->frontendName () << " cap:"
640664 << std::format (" {:x}" ,
641665 static_cast <uint64_t >(ic->capabilityFlags ()))
642- << " focus:" << ic->hasFocus () << std::endl ;
666+ << " focus:" << ic->hasFocus () << ' \n ' ;
643667 return true ;
644668 });
645669 return true ;
646670 });
647- ss << " Input Context without group" << std::endl ;
671+ ss << " Input Context without group" << ' \n ' ;
648672 instance_->inputContextManager ().foreach ([&ss](InputContext *ic) {
649673 if (ic->focusGroup ()) {
650674 return true ;
@@ -658,7 +682,7 @@ class Controller1 : public ObjectVTable<Controller1> {
658682 }
659683 ss << " ] program:" << ic->program ()
660684 << " frontend:" << ic->frontendName ()
661- << " focus:" << ic->hasFocus () << std::endl ;
685+ << " focus:" << ic->hasFocus () << ' \n ' ;
662686 return true ;
663687 });
664688 return ss.str ();
@@ -677,7 +701,7 @@ class Controller1 : public ObjectVTable<Controller1> {
677701
678702 bool canRestart () { return instance_->canRestart (); }
679703
680- void save () { return instance_->save (); }
704+ void save () { instance_->save (); }
681705
682706 void setLogRule (const std::string &rule) { Log::setLogRule (rule); }
683707
0 commit comments