target: fix geometry for x11 floats

This commit is contained in:
Vaxry 2026-02-24 19:01:51 +00:00
parent fbf67ef050
commit c60b3cb2ed
No known key found for this signature in database
GPG key ID: 665806380871D640
2 changed files with 8 additions and 4 deletions

View file

@ -88,7 +88,9 @@ void CDefaultFloatingAlgorithm::newTarget(SP<ITarget> target) {
if (!posOverridden && (!DESIRED_GEOM || !DESIRED_GEOM->pos))
windowGeometry = CBox{WORK_AREA.middle() - windowGeometry.size() / 2.F, windowGeometry.size()};
if (posOverridden || WORK_AREA.containsPoint(windowGeometry.middle()))
if (posOverridden // pos is overridden by a rule
|| (DESIRED_GEOM && DESIRED_GEOM->pos && target->window() && target->window()->m_isX11) // X11 window with a geom
|| WORK_AREA.containsPoint(windowGeometry.middle())) // geometry within work area
target->setPositionGlobal(windowGeometry);
else {
const auto POS = WORK_AREA.middle() - windowGeometry.size() / 2.f;

View file

@ -249,9 +249,11 @@ std::expected<SGeometryRequested, eGeometryFailure> CWindowTarget::desiredGeomet
requested.size = clampSizeForDesired(DESIRED_GEOM.size());
if (m_window->m_isX11) {
Vector2D xy = {DESIRED_GEOM.x, DESIRED_GEOM.y};
xy = g_pXWaylandManager->xwaylandToWaylandCoords(xy);
requested.pos = xy;
Vector2D xy = {DESIRED_GEOM.x, DESIRED_GEOM.y};
xy = g_pXWaylandManager->xwaylandToWaylandCoords(xy);
requested.pos = xy;
DESIRED_GEOM.x = xy.x;
DESIRED_GEOM.y = xy.y;
}
const auto STOREDSIZE = m_window->m_ruleApplicator->persistentSize().valueOrDefault() ? g_pConfigManager->getStoredFloatingSize(m_window.lock()) : std::nullopt;