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);
337 void(
const std::string &display,
338 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>> oldMask,
339 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>> newMask));
361 void exit(
int exitCode);
370 FCITXCORE_DEPRECATED
void configureAddon(
const std::string &addon);
371 FCITXCORE_DEPRECATED
void configureInputMethod(
const std::string &imName);
374 std::string currentUI();
377 std::string addonForInputMethod(
const std::string &imName);
393 void resetInputMethodList();
401 void reloadAddonConfig(
const std::string &addonName);
406 std::string currentInputMethod();
409 void setCurrentInputMethod(
const std::string &imName);
421 void setCurrentInputMethod(
InputContext *ic,
const std::string &imName,
431 bool enumerateGroup(
bool forward);
434 void enumerate(
bool forward);
446 FocusGroup *defaultFocusGroup(
const std::string &displayHint = {});
456 void setXkbParameters(
const std::string &display,
const std::string &rule,
457 const std::string &model,
const std::string &options);
460 void updateXkbStateMask(
const std::string &display, uint32_t depressed_mods,
461 uint32_t latched_mods, uint32_t locked_mods);
464 void clearXkbStateMask(
const std::string &display);
475 std::optional<std::tuple<uint32_t, uint32_t, uint32_t>>
476 xkbStateMask(
const std::string &display)
const;
508 const std::string &message);
516 bool checkUpdate()
const;
519 static const char *version();
546 void setRunning(
bool running);
552 bool isRunning()
const;
560 InputMethodMode inputMethodMode()
const;
569 void setInputMethodMode(InputMethodMode mode);
575 bool isRestartRequested()
const;
577 bool virtualKeyboardAutoShow()
const;
579 void setVirtualKeyboardAutoShow(
bool autoShow);
581 bool virtualKeyboardAutoHide()
const;
583 void setVirtualKeyboardAutoHide(
bool autoHide);
585 VirtualKeyboardFunctionMode virtualKeyboardFunctionMode()
const;
587 void setVirtualKeyboardFunctionMode(VirtualKeyboardFunctionMode mode);
597 void setBinaryMode();
609 bool canRestart()
const;
613 InstancePrivate *privateData();
618 bool canTrigger()
const;
621 bool canChangeGroup()
const;
633 std::unique_ptr<InstancePrivate> d_ptr;
638 #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.