input: minor fixes for tiv1

This commit is contained in:
vaxerski 2023-03-14 14:37:00 +00:00
parent 0807b8b95f
commit f960f72785
2 changed files with 10 additions and 6 deletions

View file

@ -45,10 +45,14 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
wlr_text_input_v3_send_done(PTI->pWlrInput); wlr_text_input_v3_send_done(PTI->pWlrInput);
} else { } else {
if (PIMR->m_pWLRIME->current.preedit.text) { if (PIMR->m_pWLRIME->current.preedit.text) {
zwp_text_input_v1_send_preedit_cursor(PTI->pV1Input->resourceImpl, 0); zwp_text_input_v1_send_preedit_cursor(PTI->pV1Input->resourceImpl, PIMR->m_pWLRIME->current.preedit.cursor_begin);
zwp_text_input_v1_send_preedit_styling(PTI->pV1Input->resourceImpl, 0, std::string(PIMR->m_pWLRIME->current.preedit.text).length() - 1, zwp_text_input_v1_send_preedit_styling(PTI->pV1Input->resourceImpl, 0, std::string(PIMR->m_pWLRIME->current.preedit.text).length() - 1,
ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_ACTIVE); ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_NONE);
zwp_text_input_v1_send_preedit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, PIMR->m_pWLRIME->current.preedit.text, ""); zwp_text_input_v1_send_preedit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, PIMR->m_pWLRIME->current.preedit.text, "");
} else {
zwp_text_input_v1_send_preedit_cursor(PTI->pV1Input->resourceImpl, PIMR->m_pWLRIME->current.preedit.cursor_begin);
zwp_text_input_v1_send_preedit_styling(PTI->pV1Input->resourceImpl, 0, 0, ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_NONE);
zwp_text_input_v1_send_preedit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, "", "");
} }
if (PIMR->m_pWLRIME->current.commit_text) { if (PIMR->m_pWLRIME->current.commit_text) {
@ -56,8 +60,9 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
} }
if (PIMR->m_pWLRIME->current.delete_.before_length || PIMR->m_pWLRIME->current.delete_.after_length) { if (PIMR->m_pWLRIME->current.delete_.before_length || PIMR->m_pWLRIME->current.delete_.after_length) {
zwp_text_input_v1_send_delete_surrounding_text(PTI->pV1Input->resourceImpl, PIMR->m_pWLRIME->current.delete_.before_length, zwp_text_input_v1_send_delete_surrounding_text(PTI->pV1Input->resourceImpl,
PIMR->m_pWLRIME->current.delete_.after_length); std::string(PIMR->m_pWLRIME->current.preedit.text).length() - PIMR->m_pWLRIME->current.delete_.before_length,
PIMR->m_pWLRIME->current.delete_.after_length + PIMR->m_pWLRIME->current.delete_.before_length);
if (PIMR->m_pWLRIME->current.preedit.text) if (PIMR->m_pWLRIME->current.preedit.text)
zwp_text_input_v1_send_commit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, PIMR->m_pWLRIME->current.preedit.text); zwp_text_input_v1_send_commit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, PIMR->m_pWLRIME->current.preedit.text);

View file

@ -133,10 +133,9 @@ static void destroyTI(wl_resource* resource) {
wl_resource_set_user_data(resource, nullptr); wl_resource_set_user_data(resource, nullptr);
} }
g_pInputManager->m_sIMERelay.removeTextInput(TI->pTextInput);
TI->pTextInput->hyprListener_textInputDestroy.emit(nullptr); TI->pTextInput->hyprListener_textInputDestroy.emit(nullptr);
g_pInputManager->m_sIMERelay.removeTextInput(TI->pTextInput);
g_pProtocolManager->m_pTextInputV1ProtocolManager->removeTI(TI); g_pProtocolManager->m_pTextInputV1ProtocolManager->removeTI(TI);
} }