aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-03-14 13:51:08 +0000
committervaxerski <[email protected]>2023-03-14 13:51:08 +0000
commit0807b8b95f595083a19bb5fe317d7242bcb26654 (patch)
treec35a7c9aede6327e88b44ffbfac0d1170d0f89e2 /src
parent5dc1a5fec631ddd0136af28c901e8c962548d497 (diff)
downloadHyprland-0807b8b95f595083a19bb5fe317d7242bcb26654.tar.gz
Hyprland-0807b8b95f595083a19bb5fe317d7242bcb26654.zip
tiv1: minor fixes for crashes
Diffstat (limited to 'src')
-rw-r--r--src/managers/input/InputMethodRelay.cpp4
-rw-r--r--src/protocols/TextInputV1.cpp4
-rw-r--r--src/protocols/TextInputV1.hpp2
3 files changed, 9 insertions, 1 deletions
diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp
index f8fa6b09..f84850de 100644
--- a/src/managers/input/InputMethodRelay.cpp
+++ b/src/managers/input/InputMethodRelay.cpp
@@ -371,7 +371,7 @@ void CInputMethodRelay::createNewTextInput(wlr_text_input_v3* pInput, STextInput
return;
}
- if (!PINPUT->pWlrInput->current_enabled) {
+ if (!(PINPUT->pWlrInput ? PINPUT->pWlrInput->current_enabled : PINPUT->pV1Input->active)) {
Debug::log(WARN, "Disabled TextInput commit?");
return;
}
@@ -486,6 +486,7 @@ void CInputMethodRelay::onKeyboardFocus(wlr_surface* pSurface) {
else {
zwp_text_input_v1_send_leave(ti.pV1Input->resourceImpl);
ti.pV1Input->focusedSurface = nullptr;
+ ti.pV1Input->active = false;
}
} else {
continue;
@@ -500,6 +501,7 @@ void CInputMethodRelay::onKeyboardFocus(wlr_surface* pSurface) {
else {
zwp_text_input_v1_send_enter(ti.pV1Input->resourceImpl, pSurface->resource);
ti.pV1Input->focusedSurface = pSurface;
+ ti.pV1Input->active = true;
}
} else {
setPendingSurface(&ti, pSurface);
diff --git a/src/protocols/TextInputV1.cpp b/src/protocols/TextInputV1.cpp
index f50f3298..341ce27b 100644
--- a/src/protocols/TextInputV1.cpp
+++ b/src/protocols/TextInputV1.cpp
@@ -113,6 +113,8 @@ 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; });
}
@@ -131,6 +133,8 @@ static void destroyTI(wl_resource* resource) {
wl_resource_set_user_data(resource, nullptr);
}
+ g_pInputManager->m_sIMERelay.removeTextInput(TI->pTextInput);
+
TI->pTextInput->hyprListener_textInputDestroy.emit(nullptr);
g_pProtocolManager->m_pTextInputV1ProtocolManager->removeTI(TI);
diff --git a/src/protocols/TextInputV1.hpp b/src/protocols/TextInputV1.hpp
index 9057e132..f714b24c 100644
--- a/src/protocols/TextInputV1.hpp
+++ b/src/protocols/TextInputV1.hpp
@@ -24,6 +24,8 @@ struct STextInputV1 {
uint32_t serial = 0;
+ bool active = false;
+
struct SPendingSurr {
bool isPending = false;
std::string text = "";