aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-03-14 14:37:00 +0000
committervaxerski <[email protected]>2023-03-14 14:37:00 +0000
commitf960f72785141639c2f68f05a27edbebeac2210f (patch)
tree4214ae800c5ce6bcf6fd70aa9f8960c3c317bbbb /src
parent0807b8b95f595083a19bb5fe317d7242bcb26654 (diff)
downloadHyprland-f960f72785141639c2f68f05a27edbebeac2210f.tar.gz
Hyprland-f960f72785141639c2f68f05a27edbebeac2210f.zip
input: minor fixes for tiv1
Diffstat (limited to 'src')
-rw-r--r--src/managers/input/InputMethodRelay.cpp13
-rw-r--r--src/protocols/TextInputV1.cpp3
2 files changed, 10 insertions, 6 deletions
diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp
index f84850de..267e90e5 100644
--- a/src/managers/input/InputMethodRelay.cpp
+++ b/src/managers/input/InputMethodRelay.cpp
@@ -45,10 +45,14 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) {
wlr_text_input_v3_send_done(PTI->pWlrInput);
} else {
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_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, "");
+ } 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) {
@@ -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) {
- zwp_text_input_v1_send_delete_surrounding_text(PTI->pV1Input->resourceImpl, 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,
+ 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)
zwp_text_input_v1_send_commit_string(PTI->pV1Input->resourceImpl, PTI->pV1Input->serial, PIMR->m_pWLRIME->current.preedit.text);
diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp
index 341ce27b..71e11ea7 100644
--- a/src/protocols/TextInputV1.cpp
+++ b/src/protocols/TextInputV1.cpp
@@ -133,10 +133,9 @@ static void destroyTI(wl_resource* resource) {
wl_resource_set_user_data(resource, nullptr);
}
- g_pInputManager->m_sIMERelay.removeTextInput(TI->pTextInput);
-
TI->pTextInput->hyprListener_textInputDestroy.emit(nullptr);
+ g_pInputManager->m_sIMERelay.removeTextInput(TI->pTextInput);
g_pProtocolManager->m_pTextInputV1ProtocolManager->removeTI(TI);
}