layout: use full box for visibility check of floating xdg

Fixes #3069, if an xdg dialog pops up and is partially off bounds, just move it to the center.
This commit is contained in:
vaxerski 2023-08-25 18:10:12 +02:00
parent 870471dd96
commit 9dae8ece71

View file

@ -129,21 +129,11 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
// check if it's visible on any monitor (only for XDG) // check if it's visible on any monitor (only for XDG)
bool visible = pWindow->m_bIsX11; bool visible = pWindow->m_bIsX11;
if (!pWindow->m_bIsX11) { if (!visible) {
for (auto& m : g_pCompositor->m_vMonitors) { visible = g_pCompositor->isPointOnAnyMonitor(Vector2D(desiredGeometry.x, desiredGeometry.y)) &&
if (VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, g_pCompositor->isPointOnAnyMonitor(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y)) &&
m->vecPosition.y + m->vecPosition.y) || g_pCompositor->isPointOnAnyMonitor(Vector2D(desiredGeometry.x, desiredGeometry.y + desiredGeometry.height)) &&
VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, g_pCompositor->isPointOnAnyMonitor(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y + desiredGeometry.height));
m->vecPosition.y + m->vecPosition.y) ||
VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x,
m->vecPosition.y + m->vecPosition.y) ||
VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y,
m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)) {
visible = true;
break;
}
}
} }
// TODO: detect a popup in a more consistent way. // TODO: detect a popup in a more consistent way.