diff options
author | Sungyoon Cho <[email protected]> | 2024-09-02 01:44:33 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-01 18:44:33 +0200 |
commit | 8bbeee20414bc0e20992076632d7d44ede443a1c (patch) | |
tree | 30548b0059272d09995291a27454a67dd92910ac | |
parent | 7a24e564f43d4c24abf2ec4e5351007df2f8926c (diff) | |
download | Hyprland-8bbeee20414bc0e20992076632d7d44ede443a1c.tar.gz Hyprland-8bbeee20414bc0e20992076632d7d44ede443a1c.zip |
textinput: send deactivate to ime on destory ti (#7614)
-rw-r--r-- | src/managers/input/TextInput.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp index 5bff9fed..711935a7 100644 --- a/src/managers/input/TextInput.cpp +++ b/src/managers/input/TextInput.cpp @@ -23,9 +23,7 @@ void CTextInput::initCallbacks() { listeners.disable = INPUT->events.disable.registerListener([this](std::any p) { onDisabled(); }); listeners.commit = INPUT->events.onCommit.registerListener([this](std::any p) { onCommit(); }); listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) { - const auto INPUT = pV3Input.lock(); - if (INPUT && INPUT->current.enabled && focusedSurface()) - g_pInputManager->m_sIMERelay.deactivateIME(this); + g_pInputManager->m_sIMERelay.deactivateIME(this); g_pInputManager->m_sIMERelay.removeTextInput(this); }); } else { @@ -40,6 +38,7 @@ void CTextInput::initCallbacks() { listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) { listeners.surfaceUnmap.reset(); listeners.surfaceDestroy.reset(); + g_pInputManager->m_sIMERelay.deactivateIME(this); g_pInputManager->m_sIMERelay.removeTextInput(this); }); } @@ -192,7 +191,7 @@ wl_client* CTextInput::client() { } void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) { - if (isV3()) { + if (isV3() && !pV3Input.expired()) { const auto INPUT = pV3Input.lock(); if (INPUT->current.surrounding.updated) @@ -202,7 +201,7 @@ void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) { if (INPUT->current.contentType.updated) ime->textContentType(INPUT->current.contentType.hint, INPUT->current.contentType.purpose); - } else { + } else if (!pV1Input.expired()) { const auto INPUT = pV1Input.lock(); if (INPUT->pendingSurrounding.isPending) |