summaryrefslogtreecommitdiff
path: root/src/layout/DwindleLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-04 15:16:36 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-04 15:16:36 +0200
commit908901fbda5d31387e6883535ee9b3b1940095f3 (patch)
tree58772615fc4b54c4a2f2d69964920857fe044fc9 /src/layout/DwindleLayout.cpp
parent6bfe9162e11b2b4c41a46a9c123e09023134c1cf (diff)
Fix opening floating on another mon
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
-rw-r--r--src/layout/DwindleLayout.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index 15fa1c44..cad67422 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -556,9 +556,14 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
// if it's not, fall back to the center placement
pWindow->m_vRealPosition = PMONITOR->vecPosition + Vector2D((PMONITOR->vecSize.x - desiredGeometry.width) / 2.f, (PMONITOR->vecSize.y - desiredGeometry.height) / 2.f);
} else {
- // if it is, we respect where it wants to put itself.
+ // if it is, we respect where it wants to put itself, but apply monitor offset if outside
// most of these are popups
- pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y);
+
+ if (const auto POPENMON = g_pCompositor->getMonitorFromVector(middlePoint); POPENMON->ID != PMONITOR->ID) {
+ pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition;
+ } else {
+ pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y);
+ }
}
}