diff --git a/src/managers/input/InputMethodPopup.cpp b/src/managers/input/InputMethodPopup.cpp index 3332e9c376f..36f25dd7b32 100644 --- a/src/managers/input/InputMethodPopup.cpp +++ b/src/managers/input/InputMethodPopup.cpp @@ -77,8 +77,10 @@ void CInputPopup::damageEntire() { return; } - Vector2D pos = OWNER->getSurfaceBoxGlobal().value_or(CBox{0, 0, 0, 0}).pos() + lastBoxLocal.pos(); - g_pHyprRenderer->damageBox(pos.x, pos.y, surface.wlr()->current.width, surface.wlr()->current.height); + Vector2D pos = OWNER->getSurfaceBoxGlobal().value_or(CBox{0, 0, 0, 0}).pos() + lastBoxLocal.pos(); + CBox global = {pos, lastPopupSize}; + + g_pHyprRenderer->damageBox(&global); } void CInputPopup::damageSurface() { @@ -119,20 +121,23 @@ void CInputPopup::updateBox() { cursorBoxLocal = {0, 0, (int)parentBox.w, (int)parentBox.h}; } - if (cursorBoxLocal != lastBoxLocal) + Vector2D currentPopupSize = {surface.wlr()->current.width, surface.wlr()->current.height}; + + if (cursorBoxLocal != lastBoxLocal || currentPopupSize != lastPopupSize) damageEntire(); CMonitor* pMonitor = g_pCompositor->getMonitorFromVector(parentBox.middle()); - if (cursorBoxLocal.y + parentBox.y + surface.wlr()->current.height + cursorBoxLocal.height > pMonitor->vecPosition.y + pMonitor->vecSize.y) - cursorBoxLocal.y -= surface.wlr()->current.height; + if (cursorBoxLocal.y + parentBox.y + currentPopupSize.y + cursorBoxLocal.height > pMonitor->vecPosition.y + pMonitor->vecSize.y) + cursorBoxLocal.y -= currentPopupSize.y; else cursorBoxLocal.y += cursorBoxLocal.height; - if (cursorBoxLocal.x + parentBox.x + surface.wlr()->current.width > pMonitor->vecPosition.x + pMonitor->vecSize.x) - cursorBoxLocal.x -= (cursorBoxLocal.x + parentBox.x + surface.wlr()->current.width) - (pMonitor->vecPosition.x + pMonitor->vecSize.x); + if (cursorBoxLocal.x + parentBox.x + currentPopupSize.x > pMonitor->vecPosition.x + pMonitor->vecSize.x) + cursorBoxLocal.x -= (cursorBoxLocal.x + parentBox.x + currentPopupSize.x) - (pMonitor->vecPosition.x + pMonitor->vecSize.x); - lastBoxLocal = cursorBoxLocal; + lastBoxLocal = cursorBoxLocal; + lastPopupSize = currentPopupSize; wlr_input_popup_surface_v2_send_text_input_rectangle(pWlr, cursorBoxLocal.pWlr()); diff --git a/src/managers/input/InputMethodPopup.hpp b/src/managers/input/InputMethodPopup.hpp index 8bcf1101888..71b2fe64d45 100644 --- a/src/managers/input/InputMethodPopup.hpp +++ b/src/managers/input/InputMethodPopup.hpp @@ -32,6 +32,7 @@ class CInputPopup { wlr_input_popup_surface_v2* pWlr = nullptr; CWLSurface surface; CBox lastBoxLocal; + Vector2D lastPopupSize; uint64_t lastMonitor = -1; DYNLISTENER(mapPopup);