mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 19:26:00 +01:00
IME: fix incorrect popup damage (#5383)
This commit is contained in:
parent
2e5b146e57
commit
04a35891a1
2 changed files with 14 additions and 8 deletions
|
@ -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());
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue