7 #ifndef _FCITX_INSTANCE_H_ 8 #define _FCITX_INSTANCE_H_ 15 #include <fcitx-utils/eventdispatcher.h> 16 #include <fcitx-utils/handlertable.h> 17 #include <fcitx-utils/macros.h> 19 #include <fcitx/fcitxcore_export.h> 20 #include <fcitx/globalconfig.h> 23 #define FCITX_INVALID_COMPOSE_RESULT 0xffffffff 28 class InstancePrivate;
31 class InputContextManager;
32 class InputMethodManager;
33 class InputMethodEngine;
34 class InputMethodEntry;
35 class TempModeManager;
36 class UserInterfaceManager;
40 using EventHandler = std::function<void(Event &event)>;
45 enum class VirtualKeyboardFunctionMode : uint32_t { Full = 1, Limited = 2 };
50 enum class EventWatcherPhase {
80 Default = PostInputMethod
106 bool initialized()
const {
return !!d_ptr; }
121 void setSignalPipe(
int fd);
140 bool willTryReplace()
const;
151 bool exitWhenMainDisplayDisconnected()
const;
158 bool exiting()
const;
194 bool postEvent(
Event &event);
195 bool postEvent(
Event &&event) {
return postEvent(event); }
203 bool postEvent(
Event &event)
const;
204 bool postEvent(
Event &&event)
const {
return postEvent(event); }
215 FCITX_NODISCARD std::unique_ptr<HandlerTableEntry<EventHandler>>
216 watchEvent(
EventType type, EventWatcherPhase phase, EventHandler callback);
218 template <EventType T,
typename Callback>
219 FCITX_NODISCARD std::unique_ptr<HandlerTableEntry<EventHandler>>
220 watchEvent(EventWatcherPhase phase, Callback &&callback) {
221 return watchEvent(T, phase,
222 [callback = std::forward<Callback>(callback)](
223 Event &event)
mutable {
224 callback(
static_cast<EventFor<T> &
>(event));
275 FCITXCORE_DEPRECATED uint32_t processCompose(
InputContext *ic,
290 std::optional<std::string> processComposeString(
InputContext *ic,
311 const std::string &orig);
353 void exit(
int exitCode);
362 FCITXCORE_DEPRECATED
void configureAddon(
const std::string &addon);
363 FCITXCORE_DEPRECATED
void configureInputMethod(
const std::string &imName);
366 std::string currentUI();
369 std::string addonForInputMethod(
const std::string &imName);
385 void resetInputMethodList();
393 void reloadAddonConfig(
const std::string &addonName);
398 std::string currentInputMethod();
401 void setCurrentInputMethod(
const std::string &imName);
413 void setCurrentInputMethod(
InputContext *ic,
const std::string &imName,
423 bool enumerateGroup(
bool forward);
426 void enumerate(
bool forward);
438 FocusGroup *defaultFocusGroup(
const std::string &displayHint = {});
448 void setXkbParameters(
const std::string &display,
const std::string &rule,
449 const std::string &model,
const std::string &options);
452 void updateXkbStateMask(
const std::string &display, uint32_t depressed_mods,
453 uint32_t latched_mods, uint32_t locked_mods);
456 void clearXkbStateMask(
const std::string &display);
488 const std::string &message);
496 bool checkUpdate()
const;
499 static const char *version();
526 void setRunning(
bool running);
532 bool isRunning()
const;
540 InputMethodMode inputMethodMode()
const;
549 void setInputMethodMode(InputMethodMode mode);
555 bool isRestartRequested()
const;
557 bool virtualKeyboardAutoShow()
const;
559 void setVirtualKeyboardAutoShow(
bool autoShow);
561 bool virtualKeyboardAutoHide()
const;
563 void setVirtualKeyboardAutoHide(
bool autoHide);
565 VirtualKeyboardFunctionMode virtualKeyboardFunctionMode()
const;
567 void setVirtualKeyboardFunctionMode(VirtualKeyboardFunctionMode mode);
577 void setBinaryMode();
589 bool canRestart()
const;
593 InstancePrivate *privateData();
598 bool canTrigger()
const;
601 bool canChangeGroup()
const;
613 std::unique_ptr<InstancePrivate> d_ptr;
618 #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.