diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index c93a2178b5..6f5c1b9511 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -170,8 +170,7 @@ void showOpenVrKeyboard(bool show = true) { } } -void finishOpenVrKeyboardInput() { - auto offscreenUi = DependencyManager::get(); +void updateFromOpenVrKeyboardInput() { auto chars = _overlay->GetKeyboardText(textArray, 8192); auto newText = QString(QByteArray(textArray, chars)); _keyboardFocusObject->setProperty("text", newText); @@ -181,6 +180,10 @@ void finishOpenVrKeyboardInput() { //QInputMethodEvent event(_existingText, QList()); //event.setCommitString(newText, 0, _existingText.size()); //qApp->sendEvent(_keyboardFocusObject, &event); +} +void finishOpenVrKeyboardInput() { + auto offscreenUi = DependencyManager::get(); + updateFromOpenVrKeyboardInput(); // Simulate an enter press on the top level window to trigger the action if (0 == (_currentHints & Qt::ImhMultiLine)) { qApp->sendEvent(offscreenUi->getWindow(), &QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::KeyboardModifiers(), QString("\n"))); @@ -261,6 +264,11 @@ void handleOpenVrEvents() { QMetaObject::invokeMethod(qApp, "quit"); break; + case vr::VREvent_KeyboardCharInput: + // Make the focused field match the keyboard results, inclusive of combining characters and such. + updateFromOpenVrKeyboardInput(); + break; + case vr::VREvent_KeyboardDone: finishOpenVrKeyboardInput();