diff options
author | Sungyoon Cho <[email protected]> | 2024-04-06 23:54:02 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-06 15:54:02 +0100 |
commit | 04d067d78b0074ff0000b4ce2d8741881b1ace25 (patch) | |
tree | 34d1c5b6947b830446f5160ace7551a2bb348529 /src/managers/input/TextInput.cpp | |
parent | 1596e2d1f7db76c4a367a6beb814d79db019d8d2 (diff) | |
download | Hyprland-04d067d78b0074ff0000b4ce2d8741881b1ace25.tar.gz Hyprland-04d067d78b0074ff0000b4ce2d8741881b1ace25.zip |
IME: fix race condition on closing window (#5455)
Diffstat (limited to 'src/managers/input/TextInput.cpp')
-rw-r--r-- | src/managers/input/TextInput.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp index 980d599b..be26d39c 100644 --- a/src/managers/input/TextInput.cpp +++ b/src/managers/input/TextInput.cpp @@ -37,11 +37,8 @@ void CTextInput::initCallbacks() { hyprListener_textInputDestroy.initCallback( isV3() ? &pWlrInput->events.destroy : &pV1Input->sDestroy, [this](void* owner, void* data) { - if (pWlrInput && pWlrInput->current_enabled && g_pInputManager->m_sIMERelay.m_pWLRIME) { - wlr_input_method_v2_send_deactivate(g_pInputManager->m_sIMERelay.m_pWLRIME); - - g_pInputManager->m_sIMERelay.commitIMEState(this); - } + if (pWlrInput && pWlrInput->current_enabled && focusedSurface()) + g_pInputManager->m_sIMERelay.deactivateIME(this); hyprListener_textInputCommit.removeCallback(); hyprListener_textInputDestroy.removeCallback(); @@ -72,8 +69,7 @@ void CTextInput::onEnabled(wlr_surface* surfV1) { enter(pSurface); } - wlr_input_method_v2_send_activate(g_pInputManager->m_sIMERelay.m_pWLRIME); - g_pInputManager->m_sIMERelay.commitIMEState(this); + g_pInputManager->m_sIMERelay.activateIME(this); } void CTextInput::onDisabled() { @@ -91,11 +87,7 @@ void CTextInput::onDisabled() { hyprListener_surfaceDestroyed.removeCallback(); hyprListener_surfaceUnmapped.removeCallback(); - if (!g_pInputManager->m_sIMERelay.m_pWLRIME->active) - return; - - wlr_input_method_v2_send_deactivate(g_pInputManager->m_sIMERelay.m_pWLRIME); - g_pInputManager->m_sIMERelay.commitIMEState(this); + g_pInputManager->m_sIMERelay.deactivateIME(this); } void CTextInput::onCommit() { @@ -203,14 +195,7 @@ void CTextInput::leave() { setFocusedSurface(nullptr); - if (!g_pInputManager->m_sIMERelay.m_pWLRIME) - return; - - if (!g_pInputManager->m_sIMERelay.m_pWLRIME->active) - return; - - wlr_input_method_v2_send_deactivate(g_pInputManager->m_sIMERelay.m_pWLRIME); - g_pInputManager->m_sIMERelay.commitIMEState(this); + g_pInputManager->m_sIMERelay.deactivateIME(this); } wlr_surface* CTextInput::focusedSurface() { |