Fcitx
event.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2016 CSSlayer <wengxt@gmail.com>
3  *
4  * SPDX-License-Identifier: LGPL-2.1-or-later
5  *
6  */
7 #ifndef _FCITX_EVENT_H_
8 #define _FCITX_EVENT_H_
9 
10 #include <cstddef>
11 #include <cstdint>
12 #include <memory>
13 #include <string>
14 #include <utility>
16 #include <fcitx-utils/key.h>
17 #include <fcitx-utils/macros.h>
18 #include <fcitx/fcitxcore_export.h>
19 #include <fcitx/userinterface.h>
20 #include "fcitx/inputmethodgroup.h"
21 
22 /// \addtogroup FcitxCore
23 /// \{
24 /// \file
25 /// \brief Input Method event for Fcitx.
26 
27 namespace fcitx {
28 
29 class InputContext;
30 class FocusGroup;
31 
32 enum class ResetReason {
33  ChangeByInactivate FCITXCORE_DEPRECATED,
34  LostFocus FCITXCORE_DEPRECATED,
35  SwitchIM FCITXCORE_DEPRECATED,
36  Client
37 };
38 
39 /**
40  * The reason why input method is switched to another.
41  */
43  /// Switched by trigger key
44  Trigger,
45  /// Switched by deactivate key
46  Deactivate,
47  /// Switched by alternative trigger key
48  AltTrigger,
49  /// Switched by activate key
50  Activate,
51  /// Switched by enumerate key
52  Enumerate,
53  /// Switched by group change
55  /// Switched by capability change (e.g. password field)
57  /// miscellaneous reason
58  Other,
59 };
60 
61 enum class InputMethodMode { PhysicalKeyboard, OnScreenKeyboard };
62 
63 /**
64  * Type of input method events.
65  */
66 enum class EventType : uint32_t {
67  EventTypeFlag = 0xfffff000,
68  UserTypeFlag = 0xffff0000,
69  // send by frontend, captured by core, input method, or module
70  InputContextEventFlag = 0x0001000,
71  // send by im, captured by frontend, or module
72  InputMethodEventFlag = 0x0002000,
73 
74  /**
75  * captured by everything
76  */
77  InstanceEventFlag = 0x0003000,
78  InputContextCreated = InputContextEventFlag | 0x1,
79  InputContextDestroyed = InputContextEventFlag | 0x2,
80  /**
81  * FocusInEvent is generated when client gets focused.
82  *
83  * @see FocusInEvent
84  */
85  InputContextFocusIn = InputContextEventFlag | 0x3,
86  /**
87  * when using lost focus
88  * this might be variance case to case. the default behavior is to commit
89  * the preedit, and resetIM.
90  *
91  * Controlled by [Output/DontCommitPreeditWhenUnfocus], this option will not
92  * work for application switch doesn't support async commit.
93  *
94  * So OnClose is called when preedit IS committed (not like
95  * CChangeByInactivate,
96  * this behavior cannot be overridden), it give im a chance to choose
97  * remember this
98  * word or not.
99  *
100  * Input method need to notice, that the commit is already DONE, do not do
101  * extra commit.
102  *
103  * @see FocusOutEvent
104  */
105  InputContextFocusOut = InputContextEventFlag | 0x4,
106  /**
107  * Key event is generated when client press or release a key.
108  * @see KeyEvent
109  */
110  InputContextKeyEvent = InputContextEventFlag | 0x5,
111  /**
112  * ResetEvent is generated
113  *
114  */
115  InputContextReset = InputContextEventFlag | 0x6,
116  InputContextSurroundingTextUpdated = InputContextEventFlag | 0x7,
117  InputContextCapabilityChanged = InputContextEventFlag | 0x8,
118  InputContextCursorRectChanged = InputContextEventFlag | 0x9,
119  InputContextCapabilityAboutToChange = InputContextEventFlag | 0xD,
120  /**
121  * when user switch to a different input method by hand
122  * such as ctrl+shift by default, or by ui,
123  * default behavior is reset IM.
124  */
125  InputContextSwitchInputMethod = InputContextEventFlag | 0xA,
126 
127  // Two convenient event after input method is actually activate and
128  // deactivated. Useful for UI to update after specific input method get
129  // activated and deactivated. Will not be emitted if the input method is not
130  // a valid one.
131  InputContextInputMethodActivated = InputContextEventFlag | 0xB,
132  InputContextInputMethodDeactivated = InputContextEventFlag | 0xC,
133  /**
134  * InvokeAction event is generated when client click on the preedit.
135  *
136  * Not all client support this feature.
137  *
138  * @since 5.0.11
139  */
140  InputContextInvokeAction = InputContextEventFlag | 0xE,
141 
142  InputContextVirtualKeyboardEvent = InputContextEventFlag | 0xF,
143 
144  InputContextForwardKey = InputMethodEventFlag | 0x1,
145  InputContextCommitString = InputMethodEventFlag | 0x2,
146  InputContextDeleteSurroundingText = InputMethodEventFlag | 0x3,
147  InputContextUpdatePreedit = InputMethodEventFlag | 0x4,
148  InputContextUpdateUI = InputMethodEventFlag | 0x5,
149  InputContextCommitStringWithCursor = InputMethodEventFlag | 0x6,
150  InputContextFlushUI = InputMethodEventFlag | 0x7,
151 
152  /**
153  * This is generated when input method group changed.
154  * This would also trigger InputContextSwitchInputMethod afterwards.
155  */
157  /**
158  * InputMethodGroupAboutToChangeEvent is generated when input method group
159  * is about to be changed.
160  *
161  * @see InputMethodGroupAboutToChange
162  */
164  /**
165  * UIChangedEvent is posted when the UI implementation is changed.
166  */
168  /**
169  * CheckUpdateEvent is posted when the Instance is requested to check for
170  * newly installed addons and input methods.
171  *
172  * This can be used for addons to pick up new input methods if it provides
173  * input method at runtime.
174  */
176  /**
177  * FocusGroupFocusChanged is posted when a focus group changed its focused
178  * input context.
179  *
180  * This is a more fine grained control over focus in and focus out event.
181  * This is more useful for UI to keep track of what input context is being
182  * focused.
183  *
184  * @see FocusInEvent
185  * @see FocusOutEvent
186  */
188  /**
189  * Input method mode changed
190  */
192  /**
193  * Global config is reloaded
194  *
195  * This only fires after fcitx has entered running state.
196  * The initial load will not trigger this event.
197  * @see GlobalConfig
198  * @since 5.1.0
199  */
201  /**
202  * Virtual keyboard visibility changed
203  *
204  * @see UserInterfaceManager
205  * @since 5.1.0
206  */
208 };
209 
210 template <EventType T>
212 
213 template <EventType T>
214 using EventFor = typename EventForType<T>::type;
215 
216 #define FCITX_DEFINE_EVENT_TYPE(KLASS, TYPE) \
217  template <> \
218  struct EventForType<EventType::TYPE> { \
219  using type = KLASS; \
220  }
221 
222 /**
223  * Base class for fcitx event.
224  */
225 class FCITXCORE_EXPORT Event {
226 public:
227  Event(EventType type) : type_(type) {}
228  virtual ~Event();
229 
230  /**
231  * Type of event, can be used to decide event class.
232  *
233  * @return fcitx::EventType
234  */
235  EventType type() const { return type_; }
236 
237  void accept() { accepted_ = true; }
238  /**
239  * Return value used by Instance::postEvent.
240  *
241  * @see Instance::postEvent
242  * @return bool
243  */
244  bool accepted() const { return accepted_; }
245 
246  /**
247  * Whether a event is filtered by handler.
248  *
249  * If event is filtered, it will not send to another handler.
250  * For now only keyevent from input context can be filtered.
251  *
252  * @return bool
253  */
254  virtual bool filtered() const { return false; }
255 
256  /**
257  * A helper function to check if a event is input context event.
258  *
259  * @return bool
260  */
261  bool isInputContextEvent() const {
262  auto flag = static_cast<uint32_t>(EventType::InputContextEventFlag);
263  auto mask = static_cast<uint32_t>(EventType::EventTypeFlag);
264  return (static_cast<uint32_t>(type_) & mask) == flag;
265  }
266 
267 protected:
268  EventType type_;
269  bool accepted_ = false;
270 };
271 
272 class FCITXCORE_EXPORT InputContextEvent : public Event {
273 public:
275  : Event(type), ic_(context) {}
276 
277  InputContext *inputContext() const { return ic_; }
278 
279 protected:
280  InputContext *ic_;
281 };
282 
283 class FCITXCORE_EXPORT KeyEventBase : public InputContextEvent {
284 public:
285  KeyEventBase(EventType type, InputContext *context, Key rawKey,
286  bool isRelease = false, int time = 0);
287  KeyEventBase(const KeyEventBase &) = default;
288 
289  /**
290  * Normalized key event.
291  *
292  * @return fcitx::Key
293  */
294  Key key() const { return key_; }
295 
296  /**
297  * It will automatically be called if input method layout does not match the
298  * system keyboard layout.
299  *
300  * @param key p_key:...
301  */
302  void setKey(const Key &key) {
303  key_ = key;
304  forward_ = true;
305  }
306 
307  /**
308  * It is designed for faking the key event. Normally should not be used.
309  *
310  * @param key key event to override.
311  * @since 5.0.4
312  */
313  void setRawKey(const Key &key) {
314  rawKey_ = key;
315  key_ = key.normalize();
316  forward_ = true;
317  }
318 
319  /**
320  * It is designed for overriding the key forward option. Normally should not
321  * be used.
322  *
323  * @param forward
324  * @since 5.0.4
325  */
326  void setForward(bool forward) { forward_ = forward; }
327 
328  /**
329  * Key event regardless of keyboard layout conversion.
330  *
331  * @return fcitx::Key
332  */
333  Key origKey() const { return origKey_; }
334 
335  /**
336  * Key event after layout conversion.
337  *
338  * Basically it is the "unnormalized" key event.
339  *
340  * @return fcitx::Key
341  */
342  Key rawKey() const { return rawKey_; }
343  bool isRelease() const { return isRelease_; }
344  int time() const { return time_; }
345 
346  /**
347  * If true, the key that produce character will commit a string.
348  *
349  * This is currently used by internal keyboard layout translation.
350  *
351  * @return bool
352  */
353  bool forward() const { return forward_; }
354 
355  /**
356  * Whether this key event is derived from a virtual keyboard
357  *
358  * @return bool
359  * @since 5.1.2
360  */
361  bool isVirtual() const { return origKey_.isVirtual(); }
362 
363 protected:
364  Key key_, origKey_, rawKey_;
365  bool isRelease_;
366  int time_;
367  bool forward_ = false;
368 };
369 
370 class FCITXCORE_EXPORT KeyEvent : public KeyEventBase {
371 public:
372  KeyEvent(InputContext *context, Key rawKey, bool isRelease = false,
373  int time = 0)
375  isRelease, time) {}
376 
377  void filter() { filtered_ = true; }
378  bool filtered() const override { return filtered_; }
379  void filterAndAccept() {
380  filter();
381  accept();
382  }
383 
384 private:
385  bool filtered_ = false;
386 };
387 
389 
390 class FCITXCORE_EXPORT VirtualKeyboardEvent : public InputContextEvent {
391 public:
392  VirtualKeyboardEvent(InputContext *context, bool isRelease, int time = 0);
394 
395  int time() const;
396 
397  void setKey(Key key);
398  const Key &key() const;
399 
400  void setPosition(float x, float y);
401  float x() const;
402  float y() const;
403 
404  void setLongPress(bool longPress);
405  bool isLongPress() const;
406 
407  void setUserAction(uint64_t actionId);
408  uint64_t userAction() const;
409 
410  void setText(std::string text);
411  const std::string &text() const;
412 
413  std::unique_ptr<KeyEvent> toKeyEvent() const;
414 
415 protected:
416  FCITX_DECLARE_PRIVATE(VirtualKeyboardEvent);
417  std::unique_ptr<VirtualKeyboardEventPrivate> d_ptr;
418 };
419 
420 class FCITXCORE_EXPORT ForwardKeyEvent : public KeyEventBase {
421 public:
422  ForwardKeyEvent(InputContext *context, Key rawKey, bool isRelease = false,
423  int time = 0)
424  : KeyEventBase(EventType::InputContextForwardKey, context, rawKey,
425  isRelease, time) {}
426 };
427 
428 class FCITXCORE_EXPORT CommitStringEvent : public InputContextEvent {
429 public:
430  CommitStringEvent(const std::string &text, InputContext *context)
431  : InputContextEvent(context, EventType::InputContextCommitString),
432  text_(text) {}
433 
434  const std::string &text() const { return text_; }
435 
436 protected:
437  std::string text_;
438 };
439 
440 /**
441  * Event for commit string with cursor
442  *
443  * @see InputContext::commitStringWithCursor
444  * @since 5.1.2
445  */
446 class FCITXCORE_EXPORT CommitStringWithCursorEvent : public InputContextEvent {
447 public:
448  CommitStringWithCursorEvent(std::string text, size_t cursor,
449  InputContext *context)
450  : InputContextEvent(context,
451  EventType::InputContextCommitStringWithCursor),
452  text_(std::move(text)), cursor_(cursor) {}
453 
454  const std::string &text() const { return text_; }
455  size_t cursor() const { return cursor_; }
456 
457 protected:
458  std::string text_;
459  size_t cursor_;
460 };
461 
462 class FCITXCORE_EXPORT InvokeActionEvent : public InputContextEvent {
463 public:
464  enum class Action { LeftClick, RightClick };
465  InvokeActionEvent(Action action, int cursor, InputContext *context)
467  action_(action), cursor_(cursor) {}
468 
469  Action action() const { return action_; }
470  int cursor() const { return cursor_; }
471 
472  void filter() {
473  filtered_ = true;
474  accept();
475  }
476  bool filtered() const override { return filtered_; }
477 
478 protected:
479  Action action_;
480  int cursor_;
481  bool filtered_ = false;
482 };
483 
485  : public InputContextEvent {
486 public:
488  const std::string &oldIM,
489  InputContext *context)
491  reason_(reason), oldInputMethod_(oldIM) {}
492 
493  InputMethodSwitchedReason reason() const { return reason_; }
494  const std::string &oldInputMethod() const { return oldInputMethod_; }
495 
496 protected:
498  std::string oldInputMethod_;
499 };
500 
501 class FCITXCORE_EXPORT ResetEvent : public InputContextEvent {
502 public:
503  FCITXCORE_DEPRECATED ResetEvent(ResetReason reason, InputContext *context)
505  reason_(reason) {}
506  ResetEvent(InputContext *context)
508  reason_(ResetReason::Client) {}
509 
510  FCITXCORE_DEPRECATED ResetReason reason() const { return reason_; }
511 
512 protected:
513  ResetReason reason_;
514 };
515 
516 class FCITXCORE_EXPORT InputContextUpdateUIEvent : public InputContextEvent {
517 public:
519  InputContext *context, bool immediate = false)
520  : InputContextEvent(context, EventType::InputContextUpdateUI),
521  component_(component), immediate_(immediate) {}
522 
523  UserInterfaceComponent component() const { return component_; }
524  bool immediate() const { return immediate_; }
525 
526 protected:
527  UserInterfaceComponent component_;
528  bool immediate_;
529 };
530 
531 /**
532  * Events triggered that user interface manager that flush the UI update.
533  *
534  * @since 5.1.2
535  */
536 class FCITXCORE_EXPORT InputContextFlushUIEvent : public InputContextEvent {
537 public:
539  InputContext *context)
540  : InputContextEvent(context, EventType::InputContextFlushUI),
541  component_(component) {}
542 
543  UserInterfaceComponent component() const { return component_; }
544 
545 protected:
546  UserInterfaceComponent component_;
547 };
548 
549 class FCITXCORE_EXPORT VirtualKeyboardVisibilityChangedEvent : public Event {
550 public:
553 };
554 
555 class FCITXCORE_EXPORT InputMethodNotificationEvent : public InputContextEvent {
556 public:
557  InputMethodNotificationEvent(EventType type, const std::string &name,
558  InputContext *context)
559  : InputContextEvent(context, type), name_(name) {}
560 
561  const std::string &name() const { return name_; }
562 
563 protected:
564  std::string name_;
565 };
566 
567 class FCITXCORE_EXPORT InputMethodActivatedEvent
569 public:
570  InputMethodActivatedEvent(const std::string &name, InputContext *context)
572  EventType::InputContextInputMethodActivated, name, context) {}
573 };
574 
575 class FCITXCORE_EXPORT InputMethodDeactivatedEvent
577 public:
578  InputMethodDeactivatedEvent(const std::string &name, InputContext *context)
580  EventType::InputContextInputMethodDeactivated, name, context) {}
581 };
582 
583 #define FCITX_DEFINE_SIMPLE_EVENT(NAME, TYPE, ARGS...) \
584  struct FCITXCORE_EXPORT NAME##Event : public InputContextEvent { \
585  NAME##Event(InputContext *ic) \
586  : InputContextEvent(ic, EventType::TYPE) {} \
587  }
588 
589 FCITX_DEFINE_SIMPLE_EVENT(InputContextCreated, InputContextCreated);
590 FCITX_DEFINE_SIMPLE_EVENT(InputContextDestroyed, InputContextDestroyed);
591 FCITX_DEFINE_SIMPLE_EVENT(FocusIn, InputContextFocusIn);
592 FCITX_DEFINE_SIMPLE_EVENT(FocusOut, InputContextFocusOut);
593 FCITX_DEFINE_SIMPLE_EVENT(SurroundingTextUpdated,
594  InputContextSurroundingTextUpdated);
595 FCITX_DEFINE_SIMPLE_EVENT(CursorRectChanged, InputContextCursorRectChanged);
596 FCITX_DEFINE_SIMPLE_EVENT(UpdatePreedit, InputContextUpdatePreedit);
597 
598 class FCITXCORE_EXPORT InputMethodGroupChangedEvent : public Event {
599 public:
602 };
603 
604 class FCITXCORE_EXPORT InputMethodGroupAboutToChangeEvent : public Event {
605 public:
608 };
609 
610 class FCITXCORE_EXPORT UIChangedEvent : public Event {
611 public:
613 };
614 
615 class FCITXCORE_EXPORT CheckUpdateEvent : public Event {
616 public:
618 
619  /// Make checking update short circuit. If anything need a refresh, just
620  /// simply break.
621  void setHasUpdate() {
622  filtered_ = true;
623  accept();
624  }
625  bool filtered() const override { return filtered_; }
626 
627 private:
628  bool filtered_ = false;
629 };
630 
631 /**
632  * Notify a focus change for focus group.
633  *
634  * @since 5.0.11
635  */
636 class FCITXCORE_EXPORT FocusGroupFocusChangedEvent : public Event {
637 public:
639  InputContext *newFocus)
640  : Event(EventType::FocusGroupFocusChanged), group_(group),
641  oldFocus_(oldFocus), newFocus_(newFocus) {}
642 
643  FocusGroup *group() const { return group_; }
644  InputContext *oldFocus() const { return oldFocus_; };
645  InputContext *newFocus() const { return newFocus_; };
646 
647 private:
648  FocusGroup *group_;
649  InputContext *oldFocus_;
650  InputContext *newFocus_;
651 };
652 
653 /**
654  * Notify the input method mode is changed.
655  *
656  * @see Instance::InputMethodMode
657  * @since 5.1.0
658  */
659 class FCITXCORE_EXPORT InputMethodModeChangedEvent : public Event {
660 public:
662 };
663 
664 /**
665  * Notify the global config is reloaded.
666  *
667  * @see GlobalConfig
668  * @since 5.1.0
669  */
670 class FCITXCORE_EXPORT GlobalConfigReloadedEvent : public Event {
671 public:
673 };
674 
675 class FCITXCORE_EXPORT CapabilityEvent : public InputContextEvent {
676 public:
678  CapabilityFlags newFlags)
679  : InputContextEvent(ic, type), oldFlags_(oldFlags),
680  newFlags_(newFlags) {}
681 
682  auto oldFlags() const { return oldFlags_; }
683  auto newFlags() const { return newFlags_; }
684 
685 protected:
686  const CapabilityFlags oldFlags_;
687  const CapabilityFlags newFlags_;
688 };
689 
690 class FCITXCORE_EXPORT CapabilityChangedEvent : public CapabilityEvent {
691 public:
693  CapabilityFlags newFlags)
694  : CapabilityEvent(ic, EventType::InputContextCapabilityChanged,
695  oldFlags, newFlags) {}
696 };
697 
698 class FCITXCORE_EXPORT CapabilityAboutToChangeEvent : public CapabilityEvent {
699 public:
701  CapabilityFlags newFlags)
702  : CapabilityEvent(ic, EventType::InputContextCapabilityAboutToChange,
703  oldFlags, newFlags) {}
704 };
705 
706 FCITX_DEFINE_EVENT_TYPE(InputContextCreatedEvent, InputContextCreated);
707 FCITX_DEFINE_EVENT_TYPE(InputContextDestroyedEvent, InputContextDestroyed);
708 FCITX_DEFINE_EVENT_TYPE(FocusInEvent, InputContextFocusIn);
709 FCITX_DEFINE_EVENT_TYPE(FocusOutEvent, InputContextFocusOut);
710 FCITX_DEFINE_EVENT_TYPE(KeyEvent, InputContextKeyEvent);
711 FCITX_DEFINE_EVENT_TYPE(ResetEvent, InputContextReset);
712 FCITX_DEFINE_EVENT_TYPE(SurroundingTextUpdatedEvent,
713  InputContextSurroundingTextUpdated);
714 FCITX_DEFINE_EVENT_TYPE(CursorRectChangedEvent, InputContextCursorRectChanged);
715 FCITX_DEFINE_EVENT_TYPE(CapabilityChangedEvent, InputContextCapabilityChanged);
716 FCITX_DEFINE_EVENT_TYPE(CapabilityAboutToChangeEvent,
717  InputContextCapabilityAboutToChange);
718 FCITX_DEFINE_EVENT_TYPE(InputContextSwitchInputMethodEvent,
720 FCITX_DEFINE_EVENT_TYPE(InputMethodActivatedEvent,
721  InputContextInputMethodActivated);
722 FCITX_DEFINE_EVENT_TYPE(InputMethodDeactivatedEvent,
723  InputContextInputMethodDeactivated);
724 FCITX_DEFINE_EVENT_TYPE(InvokeActionEvent, InputContextInvokeAction);
725 FCITX_DEFINE_EVENT_TYPE(VirtualKeyboardEvent, InputContextVirtualKeyboardEvent);
726 FCITX_DEFINE_EVENT_TYPE(ForwardKeyEvent, InputContextForwardKey);
727 FCITX_DEFINE_EVENT_TYPE(CommitStringEvent, InputContextCommitString);
728 FCITX_DEFINE_EVENT_TYPE(UpdatePreeditEvent, InputContextUpdatePreedit);
729 FCITX_DEFINE_EVENT_TYPE(InputContextUpdateUIEvent, InputContextUpdateUI);
730 FCITX_DEFINE_EVENT_TYPE(CommitStringWithCursorEvent,
731  InputContextCommitStringWithCursor);
732 FCITX_DEFINE_EVENT_TYPE(InputContextFlushUIEvent, InputContextFlushUI);
734 FCITX_DEFINE_EVENT_TYPE(InputMethodGroupAboutToChangeEvent,
736 FCITX_DEFINE_EVENT_TYPE(UIChangedEvent, UIChanged);
737 FCITX_DEFINE_EVENT_TYPE(CheckUpdateEvent, CheckUpdate);
741 FCITX_DEFINE_EVENT_TYPE(VirtualKeyboardVisibilityChangedEvent,
743 
744 } // namespace fcitx
745 
746 #endif // _FCITX_EVENT_H_
InputMethodGroupAboutToChangeEvent is generated when input method group is about to be changed...
Describe a Key in fcitx.
Definition: key.h:41
bool accepted() const
Return value used by Instance::postEvent.
Definition: event.h:244
EventType
Type of input method events.
Definition: event.h:66
Switched by alternative trigger key.
void setHasUpdate()
Make checking update short circuit.
Definition: event.h:621
ResetEvent is generated.
FocusInEvent is generated when client gets focused.
Notify a focus change for focus group.
Definition: event.h:636
This is generated when input method group changed.
when user switch to a different input method by hand such as ctrl+shift by default, or by ui, default behavior is reset IM.
InputMethodSwitchedReason
The reason why input method is switched to another.
Definition: event.h:42
Definition: action.cpp:17
void setKey(const Key &key)
It will automatically be called if input method layout does not match the system keyboard layout...
Definition: event.h:302
Key key() const
Normalized key event.
Definition: event.h:294
bool isVirtual() const
Whether this key event is derived from a virtual keyboard.
Definition: event.h:361
virtual bool filtered() const
Whether a event is filtered by handler.
Definition: event.h:254
bool filtered() const override
Whether a event is filtered by handler.
Definition: event.h:378
Base class for fcitx event.
Definition: event.h:225
Virtual keyboard visibility changed.
Enum type for input context capability.
Switched by capability change (e.g. password field)
Base class for User Interface addon.
Global config is reloaded.
Events triggered that user interface manager that flush the UI update.
Definition: event.h:536
InvokeAction event is generated when client click on the preedit.
bool filtered() const override
Whether a event is filtered by handler.
Definition: event.h:625
FocusGroupFocusChanged is posted when a focus group changed its focused input context.
UserInterfaceComponent
Definition: userinterface.h:21
Key rawKey() const
Key event after layout conversion.
Definition: event.h:342
Notify the input method mode is changed.
Definition: event.h:659
CheckUpdateEvent is posted when the Instance is requested to check for newly installed addons and inp...
Input method mode changed.
bool filtered() const override
Whether a event is filtered by handler.
Definition: event.h:476
bool isInputContextEvent() const
A helper function to check if a event is input context event.
Definition: event.h:261
UIChangedEvent is posted when the UI implementation is changed.
Key origKey() const
Key event regardless of keyboard layout conversion.
Definition: event.h:333
Class provides bit flag support for Enum.
Definition: flags.h:33
Event for commit string with cursor.
Definition: event.h:446
EventType type() const
Type of event, can be used to decide event class.
Definition: event.h:235
An input context represents a client of Fcitx.
Definition: inputcontext.h:50
Key event is generated when client press or release a key.
Class to represent a key.
void setRawKey(const Key &key)
It is designed for faking the key event.
Definition: event.h:313
bool forward() const
If true, the key that produce character will commit a string.
Definition: event.h:353
void setForward(bool forward)
It is designed for overriding the key forward option.
Definition: event.h:326
Notify the global config is reloaded.
Definition: event.h:670
when using lost focus this might be variance case to case.
Key normalize() const
Normalize a key, usually used when key is from frontend.
Definition: key.cpp:493