49 #define STR(x) STRX(x) 50 #define TAG __FILE__ "(" STR(__LINE__) ")" << __func__ << ":" 52 #include <qbbeventthread.h> 57 #include <QCoreApplication> 59 #include <QInputMethodEvent> 61 #include <QTextCharFormat> 63 #include <QVariantHash> 64 #include <QWaitCondition> 67 #include "imf/imf_client.h" 68 #include "imf/input_control.h" 70 #include <sys/keycodes.h> 75 #define qs(x) QString::fromLatin1(x) 76 #define iarg(name) event->mArgs[qs(#name)] = QVariant::fromValue(name) 77 #define parg(name) event->mArgs[qs(#name)] = QVariant::fromValue((void*)name) 81 spannable_string_t* toSpannableString(
QString const&
text);
82 static const input_session_t *sInputSession = 0;
83 bool isSessionOkay(input_session_t *ic)
85 return ic !=0 && sInputSession != 0 && ic->component_id == sInputSession->component_id;
91 ImfClearMetaKeyStates,
93 ImfDeleteSurroundingText,
95 ImfFinishComposingText,
100 ImfGetTextAfterCursor,
101 ImfGetTextBeforeCursor,
102 ImfPerformEditorAction,
103 ImfReportFullscreenMode,
106 ImfSetComposingRegion,
136 void setResult(
QVariant const& result)
155 class ImfEvent :
public QEvent 158 ImfEvent(input_session_t* session,
ImfEventType type, ImfEventResult* result) :
167 input_session_t* mSession;
170 ImfEventResult *mResult;
172 static int sUserEventType;
176 static int32_t imfBeginBatchEdit(input_session_t* ic)
178 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 182 if (!isSessionOkay(ic))
185 ImfEventResult result;
186 ImfEvent*
event =
new ImfEvent(ic, ImfBeginBatchEdit, &result);
190 int32_t ret = result.getResult().toInt();
195 static int32_t imfClearMetaKeyStates(input_session_t* ic, int32_t states)
197 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 201 if (!isSessionOkay(ic))
204 ImfEventResult result;
205 ImfEvent*
event =
new ImfEvent(ic, ImfClearMetaKeyStates, &result);
211 int32_t ret = result.getResult().toInt();
216 static int32_t imfCommitText(input_session_t* ic, spannable_string_t* text, int32_t new_cursor_position)
218 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 222 if (!isSessionOkay(ic))
225 ImfEventResult result;
226 ImfEvent*
event =
new ImfEvent(ic, ImfCommitText, &result);
228 iarg(new_cursor_position);
233 int32_t ret = result.getResult().toInt();
238 static int32_t imfDeleteSurroundingText(input_session_t* ic, int32_t left_length, int32_t right_length)
240 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 244 if (!isSessionOkay(ic))
247 ImfEventResult result;
248 ImfEvent*
event =
new ImfEvent(ic, ImfDeleteSurroundingText, &result);
255 int32_t ret = result.getResult().toInt();
260 static int32_t imfEndBatchEdit(input_session_t* ic)
262 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 266 if (!isSessionOkay(ic))
269 ImfEventResult result;
270 ImfEvent*
event =
new ImfEvent(ic, ImfEndBatchEdit, &result);
275 int32_t ret = result.getResult().toInt();
280 static int32_t imfFinishComposingText(input_session_t* ic)
282 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 286 if (!isSessionOkay(ic))
289 ImfEventResult result;
290 ImfEvent*
event =
new ImfEvent(ic, ImfFinishComposingText, &result);
295 int32_t ret = result.getResult().toInt();
300 static int32_t imfGetCursorCapsMode(input_session_t* ic, int32_t req_modes)
302 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 306 if (!isSessionOkay(ic))
309 ImfEventResult result;
310 ImfEvent*
event =
new ImfEvent(ic, ImfGetCursorCapsMode, &result);
315 int32_t ret = result.getResult().value<
int>();
319 static int32_t imfGetCursorPosition(input_session_t* ic)
321 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 325 if (!isSessionOkay(ic))
328 ImfEventResult result;
329 ImfEvent*
event =
new ImfEvent(ic, ImfGetCursorPosition, &result);
334 int32_t ret = result.getResult().toInt();
339 static extracted_text_t* imfGetExtractedText(input_session_t* ic, extracted_text_request_t* request, int32_t flags)
341 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 345 if (!isSessionOkay(ic)) {
346 extracted_text_t *et = (extracted_text_t *)
calloc(
sizeof(extracted_text_t),1);
347 et->text = (spannable_string_t *)
calloc(
sizeof(spannable_string_t),1);
351 ImfEventResult result;
352 ImfEvent*
event =
new ImfEvent(ic, ImfGetExtractedText, &result);
359 void* ret = result.getResult().value<
void*>();
360 return (extracted_text_t*)ret;
363 static spannable_string_t* imfGetSelectedText(input_session_t* ic, int32_t flags)
365 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 369 if (!isSessionOkay(ic))
370 return toSpannableString(
"");
372 ImfEventResult result;
373 ImfEvent*
event =
new ImfEvent(ic, ImfGetSelectedText, &result);
379 void* ret = result.getResult().value<
void*>();
380 return (spannable_string_t*)ret;
383 static spannable_string_t* imfGetTextAfterCursor(input_session_t* ic, int32_t n, int32_t flags)
385 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 389 if (!isSessionOkay(ic))
390 return toSpannableString(
"");
392 ImfEventResult result;
393 ImfEvent*
event =
new ImfEvent(ic, ImfGetTextAfterCursor, &result);
400 void* ret = result.getResult().value<
void*>();
401 return (spannable_string_t*)ret;
404 static spannable_string_t* imfGetTextBeforeCursor(input_session_t* ic, int32_t n, int32_t flags)
406 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 410 if (!isSessionOkay(ic))
411 return toSpannableString(
"");
413 ImfEventResult result;
414 ImfEvent*
event =
new ImfEvent(ic, ImfGetTextBeforeCursor, &result);
421 void* ret = result.getResult().value<
void*>();
422 return (spannable_string_t*)ret;
425 static int32_t imfPerformEditorAction(input_session_t* ic, int32_t editor_action)
427 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 431 if (!isSessionOkay(ic))
434 ImfEventResult result;
435 ImfEvent*
event =
new ImfEvent(ic, ImfPerformEditorAction, &result);
441 int32_t ret = result.getResult().value<
int>();
445 static int32_t imfReportFullscreenMode(input_session_t* ic, int32_t
enabled)
447 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 451 if (!isSessionOkay(ic))
454 ImfEventResult result;
455 ImfEvent*
event =
new ImfEvent(ic, ImfReportFullscreenMode, &result);
461 int32_t ret = result.getResult().value<
int>();
465 static int32_t imfSendEvent(input_session_t* ic, event_t *
event)
467 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 471 if (!isSessionOkay(ic))
474 ImfEvent* imfEvent =
new ImfEvent(ic, ImfSendEvent, 0);
482 static int32_t imfSendAsyncEvent(input_session_t* ic, event_t * event)
484 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 488 if (!isSessionOkay(ic))
491 ImfEvent* imfEvent =
new ImfEvent(ic, ImfSendAsyncEvent, 0);
499 static int32_t imfSetComposingRegion(input_session_t* ic, int32_t start, int32_t
end)
501 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 505 if (!isSessionOkay(ic))
508 ImfEventResult result;
509 ImfEvent*
event =
new ImfEvent(ic, ImfSetComposingRegion, &result);
516 int32_t ret = result.getResult().value<
int>();
520 static int32_t imfSetComposingText(input_session_t* ic, spannable_string_t* text, int32_t new_cursor_position)
522 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 526 if (!isSessionOkay(ic))
529 ImfEventResult result;
530 ImfEvent*
event =
new ImfEvent(ic, ImfSetComposingText, &result);
532 iarg(new_cursor_position);
537 int32_t ret = result.getResult().value<
int>();
541 static int32_t imfSetSelection(input_session_t* ic, int32_t start, int32_t end)
543 #if defined(QBBINPUTCONTEXT_IMF_EVENT_DEBUG) 547 if (!isSessionOkay(ic))
550 ImfEventResult result;
551 ImfEvent*
event =
new ImfEvent(ic, ImfSetSelection, &result);
558 int32_t ret = result.getResult().value<
int>();
562 static connection_interface_t ic_funcs = {
564 imfClearMetaKeyStates,
566 imfDeleteSurroundingText,
568 imfFinishComposingText,
569 imfGetCursorCapsMode,
570 imfGetCursorPosition,
573 imfGetTextAfterCursor,
574 imfGetTextBeforeCursor,
575 imfPerformEditorAction,
576 imfReportFullscreenMode,
580 imfSetComposingRegion,
587 initEvent(event_t *pEvent,
const input_session_t *pSession, EventType eventType,
int eventId)
589 static int s_transactionId;
592 memset(pEvent, 0,
sizeof(event_t));
593 pEvent->event_type = eventType;
594 pEvent->event_id = eventId;
595 pEvent->pid = getpid();
596 pEvent->component_id = pSession->component_id;
597 pEvent->transaction_id = ++s_transactionId;
600 spannable_string_t* toSpannableString(
QString const& text)
602 #if defined(QBBINPUTCONTEXT_DEBUG) 606 spannable_string_t *pString = (spannable_string_t *)malloc(
sizeof(spannable_string_t));
607 pString->str = (
wchar_t *)malloc(
sizeof(
wchar_t) * text.length()+1);
608 pString->length = text.length();
609 pString->spans = NULL;
610 pString->spans_count = 0;
612 QChar const* pData = text.constData();
613 wchar_t* pDst = pString->str;
628 static const input_session_t *(*p_ictrl_open_session)(connection_interface_t *) = 0;
639 static bool s_imfDisabled = getenv(
"DISABLE_IMF") != NULL;
640 static bool s_imfReady =
false;
645 else if ( s_imfReady ) {
650 void *handle = dlopen(
"libinput_client.so.1", 0);
654 p_ictrl_open_session = (
const input_session_t* (*)(connection_interface_t*))dlsym(handle,
"ictrl_open_session");
662 qCritical() <<
TAG <<
"libinput_client.so.1 is not present - IMF services are disabled.";
663 s_imfDisabled =
true;
672 s_imfDisabled =
true;
673 qCritical() <<
TAG <<
"libinput_client.so.1 did not contain the correct symbols, library mismatch? IMF services are disabled.";
687 mVirtualKeyboard(keyboard)
689 #if defined(QBBINPUTCONTEXT_DEBUG) 698 qCritical(
"imf_client_init failed - IMF services will be unavailable");
708 #if defined(QBBINPUTCONTEXT_DEBUG) 719 #define getarg(type, name) type name = imfEvent->mArgs[qs(#name)].value<type>() 720 #define getparg(type, name) type name = (type)(imfEvent->mArgs[qs(#name)].value<void*>()) 725 if (event->
type() == ImfEvent::sUserEventType) {
727 ImfEvent* imfEvent =
static_cast<ImfEvent*
>(
event);
728 switch (imfEvent->mImfType) {
729 case ImfBeginBatchEdit:
736 case ImfClearMetaKeyStates:
747 getarg(int32_t, new_cursor_position);
753 case ImfDeleteSurroundingText:
755 getarg(int32_t, left_length);
756 getarg(int32_t, right_length);
762 case ImfEndBatchEdit:
769 case ImfFinishComposingText:
776 case ImfGetCursorCapsMode:
778 getarg(int32_t, req_modes);
784 case ImfGetCursorPosition:
791 case ImfGetExtractedText:
793 getparg(extracted_text_request_t*, request);
800 case ImfGetSelectedText:
808 case ImfGetTextAfterCursor:
817 case ImfGetTextBeforeCursor:
826 case ImfPerformEditorAction:
828 getarg(int32_t, editor_action);
834 case ImfReportFullscreenMode:
849 case ImfSendAsyncEvent:
856 case ImfSetComposingRegion:
865 case ImfSetComposingText:
868 getarg(int32_t, new_cursor_position);
874 case ImfSetSelection:
893 return tr(
"PlayBook IMF");
903 #if defined(QBBINPUTCONTEXT_DEBUG) 907 switch (event->type()) {
921 #if defined(QBBINPUTCONTEXT_DEBUG) 929 #if defined(QBBINPUTCONTEXT_DEBUG) 937 #if defined(QBBINPUTCONTEXT_DEBUG) 945 #if defined(QBBINPUTCONTEXT_DEBUG) 953 #if defined(QBBINPUTCONTEXT_DEBUG) 962 #if defined(QBBINPUTCONTEXT_DEBUG) 979 #if defined(QBBINPUTCONTEXT_DEBUG) 989 #if defined(QBBINPUTCONTEXT_DEBUG) 1000 #if defined(QBBINPUTCONTEXT_DEBUG) 1008 #if defined(QBBINPUTCONTEXT_DEBUG) 1015 if (sInputSession) {
1023 #if defined(QBBINPUTCONTEXT_DEBUG) 1036 return sInputSession != 0;
1053 #if defined(QBBINPUTCONTEXT_DEBUG) 1054 qDebug() <<
"QBB: requesting virtual keyboard";
1062 caret_event_t caretEvent;
1063 memset(&caretEvent, 0,
sizeof(caret_event_t));
1064 initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED);
1074 #if defined(QBBINPUTCONTEXT_DEBUG) 1075 qDebug() <<
"QBB: hiding virtual keyboard";
1087 #if defined(QBBINPUTCONTEXT_DEBUG) 1091 if (!sInputSession) {
1092 qWarning() <<
TAG <<
"Attempt to dispatch a focus event with no input session.";
1103 focus_event_t focusEvent;
1104 memset(&focusEvent, 0,
sizeof(focusEvent));
1105 initEvent(&focusEvent.event, sInputSession, EVENT_FOCUS,
id);
1106 focusEvent.style = DEFAULT_STYLE;
1109 focusEvent.style |= NO_PREDICTION | NO_AUTO_CORRECTION;
1111 focusEvent.style |= NO_AUTO_TEXT;
1123 int key = (flags & KEY_SYM_VALID) ? sym : cap;
1124 bool navKey =
false;
1126 case KEYCODE_RETURN:
1132 case KEYCODE_BACKSPACE:
1133 case KEYCODE_DELETE:
1141 key = NAVIGATE_LEFT;
1145 key = NAVIGATE_RIGHT;
1153 key = NAVIGATE_DOWN;
1156 case KEYCODE_CAPS_LOCK:
1157 case KEYCODE_LEFT_SHIFT:
1158 case KEYCODE_RIGHT_SHIFT:
1159 case KEYCODE_LEFT_CTRL:
1160 case KEYCODE_RIGHT_CTRL:
1161 case KEYCODE_LEFT_ALT:
1162 case KEYCODE_RIGHT_ALT:
1164 case KEYCODE_LEFT_HYPER:
1165 case KEYCODE_RIGHT_HYPER:
1166 case KEYCODE_INSERT:
1170 case KEYCODE_PG_DOWN:
1176 if ( mod & KEYMOD_CTRL ) {
1187 if (!(flags & KEY_DOWN))
1193 if ( flags & KEY_DOWN ) {
1194 navigation_event_t navEvent;
1195 initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key);
1196 navEvent.magnitude = 1;
1197 #if defined(QBBINPUTCONTEXT_DEBUG) 1198 qDebug() <<
TAG <<
"dispatch navigation event " <<
key;
1205 initEvent(&keyEvent.event, sInputSession, EVENT_KEY, flags & KEY_DOWN ? IMF_KEY_DOWN : IMF_KEY_UP);
1206 keyEvent.key_code =
key;
1207 keyEvent.character = 0;
1208 keyEvent.meta_key_state = 0;
1211 #if defined(QBBINPUTCONTEXT_DEBUG) 1235 action_event_t actionEvent;
1236 memset(&actionEvent, 0,
sizeof(actionEvent));
1237 initEvent(&actionEvent.event, sInputSession, EVENT_ACTION, ACTION_END_COMPOSITION);
1258 int32_t result = -1;
1259 switch (event->event_type) {
1260 case EVENT_SPELL_CHECK: {
1261 #if defined(QBBINPUTCONTEXT_DEBUG) 1268 case EVENT_NAVIGATION: {
1269 #if defined(QBBINPUTCONTEXT_DEBUG) 1273 int key =
event->event_id == NAVIGATE_UP ? KEYCODE_UP :
1274 event->event_id == NAVIGATE_DOWN ? KEYCODE_DOWN :
1275 event->event_id == NAVIGATE_LEFT ? KEYCODE_LEFT :
1276 event->event_id == NAVIGATE_RIGHT ? KEYCODE_RIGHT : 0;
1278 QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, key, 0, 0, 0);
1279 QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, key, 0, 0, 0);
1285 #if defined(QBBINPUTCONTEXT_DEBUG) 1288 key_event_t* kevent = (key_event_t*) event;
1290 QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
1291 QBBEventThread::injectKeyboardEvent(KEY_SYM_VALID | KEY_CAP_VALID, kevent->key_code, 0, 0, kevent->key_code);
1304 case EVENT_USER_ACTION:
1306 case EVENT_INVOKE_LATER:
1307 qCritical() <<
TAG <<
"Unsupported event type: " <<
event->event_type;
1310 qCritical() <<
TAG <<
"Unknown event type: " <<
event->event_type;
1321 #if defined(QBBINPUTCONTEXT_DEBUG) 1325 if (!isSessionOkay(ic))
1335 #if defined(QBBINPUTCONTEXT_DEBUG) 1339 if (!isSessionOkay(ic))
1343 qCritical() <<
TAG <<
"onClearMetaKeyStates is unsupported.";
1350 if (!isSessionOkay(ic))
1355 #if defined(QBBINPUTCONTEXT_DEBUG) 1356 qDebug() <<
TAG <<
"Committing [" << commitString <<
"]";
1361 event.setCommitString(commitString, 0, 0);
1371 #if defined(QBBINPUTCONTEXT_DEBUG) 1372 qDebug() <<
TAG <<
"L:" << left_length <<
" R:" << right_length;
1375 if (!isSessionOkay(ic))
1379 QBBEventThread::injectKeyboardEvent(KEY_DOWN | KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
1380 QBBEventThread::injectKeyboardEvent(KEY_CAP_VALID, KEYCODE_DELETE, 0, 0, 0);
1385 int replacementLength = left_length + right_length;
1386 int replacementStart = -left_length;
1390 event.setCommitString(
QLatin1String(
""), replacementStart, replacementLength);
1398 #if defined(QBBINPUTCONTEXT_DEBUG) 1402 if (!isSessionOkay(ic))
1410 #if defined(QBBINPUTCONTEXT_DEBUG) 1414 if (!isSessionOkay(ic))
1432 #if defined(QBBINPUTCONTEXT_DEBUG) 1436 if (!isSessionOkay(ic))
1440 qCritical() <<
TAG <<
"onGetCursorCapsMode is unsupported.";
1447 #if defined(QBBINPUTCONTEXT_DEBUG) 1451 if (!isSessionOkay(ic))
1462 #if defined(QBBINPUTCONTEXT_DEBUG) 1466 if (!isSessionOkay(ic)) {
1467 extracted_text_t *et = (extracted_text_t *)
calloc(
sizeof(extracted_text_t),1);
1468 et->text = (spannable_string_t *)
calloc(
sizeof(spannable_string_t),1);
1473 extracted_text_t *et = (extracted_text_t *)
calloc(
sizeof(extracted_text_t),1);
1474 et->text = (spannable_string_t *)
calloc(
sizeof(spannable_string_t),1);
1482 #if defined(QBBINPUTCONTEXT_DEBUG) 1486 if (!isSessionOkay(ic))
1487 return toSpannableString(
"");
1490 return toSpannableString(text);
1496 #if defined(QBBINPUTCONTEXT_DEBUG) 1500 if (!isSessionOkay(ic))
1501 return toSpannableString(
"");
1512 #if defined(QBBINPUTCONTEXT_DEBUG) 1516 if (!isSessionOkay(ic))
1517 return toSpannableString(
"");
1533 #if defined(QBBINPUTCONTEXT_DEBUG) 1537 if (!isSessionOkay(ic))
1541 qCritical() <<
TAG <<
"onPerformEditorAction is unsupported.";
1549 #if defined(QBBINPUTCONTEXT_DEBUG) 1553 if (!isSessionOkay(ic))
1557 qCritical() <<
TAG <<
"onReportFullscreenMode is unsupported.";
1564 #if defined(QBBINPUTCONTEXT_DEBUG) 1568 if (!isSessionOkay(ic))
1576 #if defined(QBBINPUTCONTEXT_DEBUG) 1580 if (!isSessionOkay(ic))
1588 #if defined(QBBINPUTCONTEXT_DEBUG) 1592 if (!isSessionOkay(ic))
1606 text = text.
mid(start, end - start);
1611 event.setCommitString(empty, start -
mLastCaretPos, end - start);
1626 #if defined(QBBINPUTCONTEXT_DEBUG) 1630 if (!isSessionOkay(ic))
1651 #if defined(QBBINPUTCONTEXT_DEBUG) 1655 if (!isSessionOkay(ic))
1659 qCritical() <<
TAG <<
"onSetSelection is unsupported.";
The QVariant class acts like a union for the most common Qt data types.
extracted_text_t * onGetExtractedText(input_session_t *ic, extracted_text_request_t *request, int32_t flags)
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
virtual void widgetDestroyed(QWidget *widget)
This virtual function is called when the specified widget is destroyed.
#define getparg(type, name)
static const input_session_t *(* p_ictrl_open_session)(connection_interface_t *)=0
virtual void update()
This virtual function is called when a state in the focus widget has changed.
virtual bool hideKeyboard()=0
void push_back(const T &t)
This function is provided for STL compatibility.
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
#define QT_END_NAMESPACE
This macro expands to.
The QMutex class provides access serialization between threads.
QPointer< QWidget > widget
virtual void mouseHandler(int x, QMouseEvent *event)
This function can be reimplemented in a subclass to handle mouse press, release, double-click, and move events within the preedit text.
int32_t onFinishComposingText(input_session_t *ic)
static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier=Qt::NoModifier, int delay=-1)
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int32_t onSetSelection(input_session_t *ic, int32_t start, int32_t end)
bool isNull() const
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false...
static void(* p_imf_client_disconnect)()=0
static void postEvent(QObject *receiver, QEvent *event)
Adds the event event, with the object receiver as the receiver of the event, to an event queue and re...
int32_t onSendAsyncEvent(input_session_t *ic, event_t *event)
int32_t onPerformEditorAction(input_session_t *ic, int32_t editor_action)
int length() const
Returns the number of characters in this string.
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
int32_t onSetComposingText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
int32_t onGetCursorCapsMode(input_session_t *ic, int32_t req_modes)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool dispatchFocusEvent(FocusEventId id, int hints=Qt::ImhNone)
virtual void reset()
This function can be reimplemented in a subclass to reset the state of the input method.
spannable_string_t * onGetTextBeforeCursor(input_session_t *ic, int32_t n, int32_t flags)
QWidget * focusWidget() const
Returns the widget that has an input focus for this input context.
The QString class provides a Unicode character string.
virtual QString identifierName()
This function must be implemented in any subclasses to return the identifier name of the input method...
The QObject class is the base class of all Qt objects.
QBBAbstractVirtualKeyboard & mVirtualKeyboard
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
int32_t onGetCursorPosition(input_session_t *ic)
The QChar class provides a 16-bit Unicode character.
virtual QList< QAction * > actions()
This is a preliminary interface for Qt 4.
bool eventFilter(QObject *obj, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object...
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
static bool imfAvailable()
Q_CORE_EXPORT void qDebug(const char *,...)
int32_t processEvent(event_t *event)
QBBInputContext(QBBAbstractVirtualKeyboard &keyboard, QObject *parent=0)
int32_t onBeginBatchEdit(input_session_t *ic)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static int32_t(* p_ictrl_get_num_active_sessions)()=0
virtual void widgetDestroyed(QWidget *w)
This virtual function is called when the specified widget is destroyed.
static bool s_imfInitFailed
virtual void update()
This virtual function is called when a state in the focus widget has changed.
int32_t onEndBatchEdit(input_session_t *ic)
Q_CORE_EXPORT void qWarning(const char *,...)
virtual QFont font() const
Returns the font of the current input widget.
int32_t onReportFullscreenMode(input_session_t *ic, int32_t enabled)
virtual void mouseHandler(int x, QMouseEvent *event)
This function can be reimplemented in a subclass to handle mouse press, release, double-click, and move events within the preedit text.
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
int32_t onSendEvent(input_session_t *ic, event_t *event)
bool dispatchCloseSoftwareInputPanel()
virtual QFont font() const
Returns the font of the current input widget.
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
The QMouseEvent class contains parameters that describe a mouse event.
virtual bool filterEvent(const QEvent *event)
This function can be reimplemented in a subclass to filter input events.
static int32_t(* p_vkb_init_selection_service)()=0
virtual QString language()
This function must be implemented in any subclasses to return a language code (e. ...
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
int32_t onDeleteSurroundingText(input_session_t *ic, int32_t left_length, int32_t right_length)
void setComposingText(QString const &composingText)
virtual void setFocusWidget(QWidget *widget)
Sets the widget that has an input focus for this input context.
Type
This enum type defines the valid event types in Qt.
int32_t onClearMetaKeyStates(input_session_t *ic, int32_t states)
The QFont class specifies a font used for drawing text.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
virtual QList< QAction * > actions()
This is a preliminary interface for Qt 4.
void sendEvent(const QInputMethodEvent &event)
Sends an input method event specified by event to the current focus widget.
void setFontUnderline(bool underline)
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-und...
virtual bool isComposing() const
This function indicates whether InputMethodStart event had been sent to the current focus widget...
#define getarg(type, name)
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
static int32_t(* p_ictrl_dispatch_event)(event_t *)=0
int32_t onCommitText(input_session_t *ic, spannable_string_t *text, int32_t new_cursor_position)
virtual bool showKeyboard()=0
static int registerEventType(int hint=-1)
Registers and returns a custom event type.
int32_t onSetComposingRegion(input_session_t *ic, int32_t start, int32_t end)
spannable_string_t * onGetTextAfterCursor(input_session_t *ic, int32_t n, int32_t flags)
static void(* p_ictrl_close_session)(input_session_t *)=0
The QInputContext class abstracts the input method dependent data and composing state.
static const KeyPair *const end
static int32_t(* p_imf_client_init)()=0
virtual void setFocusWidget(QWidget *w)
Sets the widget that has an input focus for this input context.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
spannable_string_t * onGetSelectedText(input_session_t *ic, int32_t flags)
bool dispatchRequestSoftwareInputPanel()
Q_CORE_EXPORT void qCritical(const char *,...)
The QList class is a template class that provides lists.
QString languageId() const