From 23c5760538c8db68c0b0d3b170c6e812f50a1bb4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 23 Aug 2022 11:16:27 +0200 Subject: [PATCH] IME Popup damage fixes --- src/helpers/WLClasses.hpp | 1 + src/managers/input/InputMethodRelay.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 4c769202..57e01099 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -306,6 +306,7 @@ struct SIMEPopup { int x, y; int realX, realY; bool visible; + Vector2D lastSize; DYNLISTENER(mapPopup); DYNLISTENER(unmapPopup); diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp index 4f18781a..e697c44f 100644 --- a/src/managers/input/InputMethodRelay.cpp +++ b/src/managers/input/InputMethodRelay.cpp @@ -125,6 +125,9 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) { if (!pPopup->pSurface->mapped) return; + // damage last known pos & size + g_pHyprRenderer->damageBox(pPopup->realX, pPopup->realY, pPopup->lastSize.x, pPopup->lastSize.y); + const auto PFOCUSEDTI = getFocusedTextInput(); if (!PFOCUSEDTI || !PFOCUSEDTI->pWlrInput->focused_surface) @@ -167,6 +170,8 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) { pPopup->realX = finalBox.x + parentPos.x; pPopup->realY = finalBox.y + parentPos.y + finalBox.height; + pPopup->lastSize = Vector2D(pPopup->pSurface->surface->current.width, pPopup->pSurface->surface->current.height); + wlr_input_popup_surface_v2_send_text_input_rectangle(pPopup->pSurface, &finalBox); damagePopup(pPopup); @@ -189,6 +194,8 @@ void Events::listener_unmapInputPopup(void* owner, void* data) { Debug::log(LOG, "Unmapped an IME Popup"); + g_pHyprRenderer->damageBox(PPOPUP->realX, PPOPUP->realY, PPOPUP->lastSize.x, PPOPUP->lastSize.y); + g_pInputManager->m_sIMERelay.updateInputPopup(PPOPUP); }