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/InputMethodRelay.cpp | |
| parent | 4f3e90ad2d35db7a79bdf4b64d4c9377f5bb24bf (diff) | |
IME: fix crash on restarting IME (#5428)
Diffstat (limited to 'src/managers/input/InputMethodRelay.cpp')
| -rw-r--r-- | src/managers/input/InputMethodRelay.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp index 2bd98a79..e348dcaf 100644 --- a/src/managers/input/InputMethodRelay.cpp +++ b/src/managers/input/InputMethodRelay.cpp @@ -49,7 +49,7 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) { Debug::log(LOG, "IME Destroy"); if (PTI) - PTI->enter(PTI->focusedSurface()); + PTI->leave(); }, this, "IMERelay"); @@ -92,8 +92,18 @@ void CInputMethodRelay::onNewIME(wlr_input_method_v2* pIME) { }, this, "IMERelay"); - if (const auto PTI = getFocusedTextInput(); PTI) - PTI->enter(PTI->focusedSurface()); + if (!g_pCompositor->m_pLastFocus) + return; + + for (auto& ti : m_vTextInputs) { + if (ti->client() != wl_resource_get_client(g_pCompositor->m_pLastFocus->resource)) + continue; + + if (ti->isV3()) + ti->enter(g_pCompositor->m_pLastFocus); + else + ti->onEnabled(g_pCompositor->m_pLastFocus); + } } void CInputMethodRelay::setIMEPopupFocus(CInputPopup* pPopup, wlr_surface* pSurface) { |
