MCPcopy Create free account
hub / github.com/KDE/kwin / commitString

Method commitString

src/inputmethod.cpp:505–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505void InputMethod::commitString(quint32 serial, const QString &text)
506{
507 if (auto t2 = waylandServer()->seat()->textInputV2(); t2 && t2->isEnabled()) {
508 t2->commitString(text);
509 t2->setPreEditCursor(0);
510 t2->preEdit({}, {});
511 return;
512 } else if (auto t3 = waylandServer()->seat()->textInputV3(); t3 && t3->isEnabled()) {
513 t3->sendPreEditString(QString(), 0, 0);
514 t3->commitString(text);
515 t3->done();
516 return;
517 } else if (m_internalContext->isEnabled()) {
518 m_internalContext->handlePreeditText({}, 0, 0);
519 m_internalContext->handleCommitString(text);
520 } else {
521 // The application has no way of communicating with the input method.
522 // So instead, try to convert what we get from the input method into
523 // keycodes and send those as fake input to the client.
524
525 const QList<xkb_keysym_t> keySyms = Xkb::textToKeySyms(text);
526
527 // First, send all the extracted keys as pressed keys to the client.
528 for (const xkb_keysym_t &keySym : keySyms) {
529 forwardKeySym(keySym);
530 }
531
532 // reset any modifiers to the actual state
533 input()->keyboard()->xkb()->forwardModifiers();
534 }
535}
536
537void InputMethod::forwardKeySym(int keySym)
538{

Callers 4

testCommitMethod · 0.45
testEventsMethod · 0.45
testEventsMethod · 0.45

Calls 15

waylandServerFunction · 0.85
QStringClass · 0.85
inputFunction · 0.85
textInputV2Method · 0.80
setPreEditCursorMethod · 0.80
preEditMethod · 0.80
textInputV3Method · 0.80
sendPreEditStringMethod · 0.80
handlePreeditTextMethod · 0.80
handleCommitStringMethod · 0.80
xkbMethod · 0.80
seatMethod · 0.45

Tested by 4

testCommitMethod · 0.36
testEventsMethod · 0.36
testEventsMethod · 0.36