7 #ifndef _FCITX_INSTANCE_H_ 8 #define _FCITX_INSTANCE_H_ 18 #include <fcitx-utils/eventdispatcher.h> 19 #include <fcitx-utils/handlertable.h> 20 #include <fcitx-utils/macros.h> 22 #include <fcitx/fcitxcore_export.h> 23 #include <fcitx/globalconfig.h> 26 #define FCITX_INVALID_COMPOSE_RESULT 0xffffffff 31 class InstancePrivate;
34 class InputContextManager;
35 class InputMethodManager;
36 class InputMethodEngine;
37 class InputMethodEntry;
38 class TempModeManager;
39 class UserInterfaceManager;
43 using EventHandler = std::function<void(Event &event)>;
48 enum class VirtualKeyboardFunctionMode : uint32_t { Full = 1, Limited = 2 };
53 enum class EventWatcherPhase {
83 Default = PostInputMethod
109 bool initialized()
const {
return !!d_ptr; }
124 void setSignalPipe(
int fd);
143 bool willTryReplace()
const;
154 bool exitWhenMainDisplayDisconnected()
const;
161 bool exiting()
const;
197 bool postEvent(
Event &event);
198 bool postEvent(
Event &&event) {
return postEvent(event); }
206 bool postEvent(
Event &event)
const;
207 bool postEvent(
Event &&event)
const {
return postEvent(event); }
218 FCITX_NODISCARD std::unique_ptr<HandlerTableEntry<EventHandler>>
219 watchEvent(
EventType type, EventWatcherPhase phase, EventHandler callback);
221 template <EventType T,
typename Callback>
222 FCITX_NODISCARD std::unique_ptr<HandlerTableEntry<EventHandler>>
223 watchEvent(EventWatcherPhase phase, Callback &&callback) {
224 return watchEvent(T, phase,
225 [callback = std::forward<Callback>(callback)](
226 Event &event)
mutable {
227 callback(
static_cast<EventFor<T> &
>(event));
278 FCITXCORE_DEPRECATED uint32_t processCompose(
InputContext *ic,
293 std::optional<std::string> processComposeString(
InputContext *ic,
314 const std::string &orig);
339 void(
const std::string &display,
340 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>> oldMask,
341 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>> newMask));
363 void exit(
int exitCode);
372 FCITXCORE_DEPRECATED
void configureAddon(
const std::string &addon);
373 FCITXCORE_DEPRECATED
void configureInputMethod(
const std::string &imName);
376 std::string currentUI();
379 std::string addonForInputMethod(
const std::string &imName);
395 void resetInputMethodList();
403 void reloadAddonConfig(
const std::string &addonName);
408 std::string currentInputMethod();
411 void setCurrentInputMethod(
const std::string &imName);
423 void setCurrentInputMethod(
InputContext *ic,
const std::string &imName,
433 bool enumerateGroup(
bool forward);
436 void enumerate(
bool forward);
448 FocusGroup *defaultFocusGroup(
const std::string &displayHint = {});
458 void setXkbParameters(
const std::string &display,
const std::string &rule,
459 const std::string &model,
const std::string &options);
462 void updateXkbStateMask(
const std::string &display, uint32_t depressed_mods,
463 uint32_t latched_mods, uint32_t locked_mods);
466 void clearXkbStateMask(
const std::string &display);
477 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>>
478 xkbStateMask(
const std::string &display)
const;
510 const std::string &message);
518 bool checkUpdate()
const;
521 static const char *version();
548 void setRunning(
bool running);
554 bool isRunning()
const;
562 InputMethodMode inputMethodMode()
const;
571 void setInputMethodMode(InputMethodMode mode);
577 bool isRestartRequested()
const;
579 bool virtualKeyboardAutoShow()
const;
581 void setVirtualKeyboardAutoShow(
bool autoShow);
583 bool virtualKeyboardAutoHide()
const;
585 void setVirtualKeyboardAutoHide(
bool autoHide);
587 VirtualKeyboardFunctionMode virtualKeyboardFunctionMode()
const;
589 void setVirtualKeyboardFunctionMode(VirtualKeyboardFunctionMode mode);
599 void setBinaryMode();
611 bool canRestart()
const;
615 InstancePrivate *privateData();
620 bool canTrigger()
const;
623 bool canChangeGroup()
const;
635 std::unique_ptr<InstancePrivate> d_ptr;
640 #endif // _FCITX_INSTANCE_H_ Base class for all object supports connection.
EventType
Type of input method events.
An instance represents a standalone Fcitx instance.
Formatted string commonly used in user interface.
Manage registered TempMode objects for an Instance.
#define FCITX_DECLARE_SIGNAL(CLASS_NAME, NAME,...)
Declare signal by type.
InputMethodSwitchedReason
The reason why input method is switched to another.
Utilities to enable use object with signal.
A class represents a formatted string.
Base class for fcitx event.
A thread safe class to post event to a certain EventLoop.
CheckUpdateEvent is posted when the Instance is requested to check for newly installed addons and inp...
Input Method event for Fcitx.
An input context represents a client of Fcitx.