From 5c1097cbc19131a7770b2a3f01f6f24e626991d2 Mon Sep 17 00:00:00 2001 From: joshua <54235339+sujoshua@users.noreply.github.com> Date: Tue, 19 Mar 2024 23:54:33 +0800 Subject: IME: Improve handling of text-input and ime-relay (#5147) * input: Handling multiple surfaces for the text-input-v1 protocol implementation and imporve InputMethodRelay logic fixes #2708 * clang-format * minor style nits --------- Co-authored-by: Vaxry --- src/protocols/TextInputV1.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/protocols/TextInputV1.cpp') diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp index d69a79ca..8d1f6f97 100644 --- a/src/protocols/TextInputV1.cpp +++ b/src/protocols/TextInputV1.cpp @@ -113,8 +113,6 @@ void CTextInputV1ProtocolManager::removeTI(STextInputV1* pTI) { // if ((*TI)->resourceImpl) // wl_resource_destroy((*TI)->resourceImpl); - g_pInputManager->m_sIMERelay.removeTextInput((*TI)->pTextInput); - std::erase_if(m_pClients, [&](const auto& other) { return other.get() == pTI; }); } @@ -165,7 +163,11 @@ void CTextInputV1ProtocolManager::createTI(wl_client* client, wl_resource* resou void CTextInputV1ProtocolManager::handleActivate(wl_client* client, wl_resource* resource, wl_resource* seat, wl_resource* surface) { const auto PTI = tiFromResource(resource); - PTI->pTextInput->hyprListener_textInputEnable.emit(nullptr); + if (!surface) { + Debug::log(WARN, "Text-input-v1 PTI{:x}: No surface to activate text input on!", (uintptr_t)PTI); + return; + } + PTI->pTextInput->hyprListener_textInputEnable.emit(surface); } void CTextInputV1ProtocolManager::handleDeactivate(wl_client* client, wl_resource* resource, wl_resource* seat) { -- cgit v1.2.3