diff options
| author | Sungyoon Cho <sungyoon@sungyooncho.dev> | 2024-04-05 01:34:04 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-04 17:34:04 +0100 |
| commit | c4b660a33930a0e60e853b6796c1fd76914b1719 (patch) | |
| tree | d3691bee844298b47a329350562302164beaae29 /src/managers/input/TextInput.cpp | |
| parent | 4f3e90ad2d35db7a79bdf4b64d4c9377f5bb24bf (diff) | |
IME: fix crash on restarting IME (#5428)
Diffstat (limited to 'src/managers/input/TextInput.cpp')
| -rw-r--r-- | src/managers/input/TextInput.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/managers/input/TextInput.cpp b/src/managers/input/TextInput.cpp index 8be13a4c..980d599b 100644 --- a/src/managers/input/TextInput.cpp +++ b/src/managers/input/TextInput.cpp @@ -37,12 +37,7 @@ void CTextInput::initCallbacks() { hyprListener_textInputDestroy.initCallback( isV3() ? &pWlrInput->events.destroy : &pV1Input->sDestroy, [this](void* owner, void* data) { - if (!g_pInputManager->m_sIMERelay.m_pWLRIME) { - // Debug::log(WARN, "Disabling TextInput on no IME!"); - return; - } - - if (pWlrInput && pWlrInput->current_enabled) { + 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); @@ -71,10 +66,10 @@ void CTextInput::onEnabled(wlr_surface* surfV1) { // v1 only, map surface to PTI if (!isV3()) { wlr_surface* pSurface = surfV1; - if (g_pCompositor->m_pLastFocus == pSurface) - enter(pSurface); - else - setFocusedSurface(pSurface); + if (g_pCompositor->m_pLastFocus != pSurface || !pV1Input->active) + return; + + enter(pSurface); } wlr_input_method_v2_send_activate(g_pInputManager->m_sIMERelay.m_pWLRIME); @@ -208,6 +203,9 @@ void CTextInput::leave() { setFocusedSurface(nullptr); + if (!g_pInputManager->m_sIMERelay.m_pWLRIME) + return; + if (!g_pInputManager->m_sIMERelay.m_pWLRIME->active) return; |
