mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 10:45:58 +01:00
ime: fix panels overflowing on corners
This commit is contained in:
parent
f960f72785
commit
7e5a3eb045
1 changed files with 11 additions and 1 deletions
|
@ -179,6 +179,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
|
||||||
bool cursorRect = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.features & WLR_TEXT_INPUT_V3_FEATURE_CURSOR_RECTANGLE : true;
|
bool cursorRect = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.features & WLR_TEXT_INPUT_V3_FEATURE_CURSOR_RECTANGLE : true;
|
||||||
const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI);
|
const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI);
|
||||||
auto cursorBox = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.cursor_rectangle : PFOCUSEDTI->pV1Input->cursorRectangle;
|
auto cursorBox = PFOCUSEDTI->pWlrInput ? PFOCUSEDTI->pWlrInput->current.cursor_rectangle : PFOCUSEDTI->pV1Input->cursorRectangle;
|
||||||
|
CMonitor* pMonitor = nullptr;
|
||||||
|
|
||||||
Vector2D parentPos;
|
Vector2D parentPos;
|
||||||
Vector2D parentSize;
|
Vector2D parentSize;
|
||||||
|
@ -189,6 +190,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
|
||||||
if (PLS) {
|
if (PLS) {
|
||||||
parentPos = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition;
|
parentPos = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition;
|
||||||
parentSize = Vector2D(PLS->geometry.width, PLS->geometry.height);
|
parentSize = Vector2D(PLS->geometry.width, PLS->geometry.height);
|
||||||
|
pMonitor = g_pCompositor->getMonitorFromID(PLS->monitorID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(PFOCUSEDSURFACE);
|
const auto PWINDOW = g_pCompositor->getWindowFromSurface(PFOCUSEDSURFACE);
|
||||||
|
@ -196,6 +198,7 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
|
||||||
if (PWINDOW) {
|
if (PWINDOW) {
|
||||||
parentPos = PWINDOW->m_vRealPosition.goalv();
|
parentPos = PWINDOW->m_vRealPosition.goalv();
|
||||||
parentSize = PWINDOW->m_vRealSize.goalv();
|
parentSize = PWINDOW->m_vRealSize.goalv();
|
||||||
|
pMonitor = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,10 +206,17 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pPopup) {
|
||||||
cursorBox = {0, 0, (int)parentSize.x, (int)parentSize.y};
|
cursorBox = {0, 0, (int)parentSize.x, (int)parentSize.y};
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: anti-overflow
|
if (!pMonitor)
|
||||||
|
return;
|
||||||
|
|
||||||
wlr_box finalBox = cursorBox;
|
wlr_box finalBox = cursorBox;
|
||||||
|
|
||||||
|
if (cursorBox.y + parentPos.y + pPopup->pSurface->surface->current.height > pMonitor->vecPosition.y + pMonitor->vecSize.y)
|
||||||
|
finalBox.y -= pPopup->pSurface->surface->current.height + finalBox.height;
|
||||||
|
|
||||||
|
if (cursorBox.x + parentPos.x + pPopup->pSurface->surface->current.width > pMonitor->vecPosition.x + pMonitor->vecSize.x)
|
||||||
|
finalBox.x -= (cursorBox.x + parentPos.x + pPopup->pSurface->surface->current.width) - (pMonitor->vecPosition.x + pMonitor->vecSize.x);
|
||||||
|
|
||||||
pPopup->x = finalBox.x;
|
pPopup->x = finalBox.x;
|
||||||
pPopup->y = finalBox.y + finalBox.height;
|
pPopup->y = finalBox.y + finalBox.height;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue