diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-25 18:40:03 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-05-25 18:40:03 +0200 |
| commit | 08d4d987cf9e25332a358667332507fb3491ce9b (patch) | |
| tree | 52dfe1c2fd9bf142b4247e0dfdb3e8ec1ae79ef2 /src/layout/DwindleLayout.cpp | |
| parent | 5635c6385f7bc99c415ef76b3c1b83a210073224 (diff) | |
return nearest mon if point out of range
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
| -rw-r--r-- | src/layout/DwindleLayout.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 0f77aac0..eef98622 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -184,9 +184,14 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) { SDwindleNodeData* OPENINGON; const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor(); - if (PMONITOR->ID == MONFROMCURSOR->ID && PNODE->workspaceID == PMONITOR->activeWorkspace) + if (PMONITOR->ID == MONFROMCURSOR->ID && PNODE->workspaceID == PMONITOR->activeWorkspace) { OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal())); - else + + // happens on reserved area + if (!OPENINGON && g_pCompositor->getWindowsOnWorkspace(PNODE->workspaceID) > 0) + OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace); + + } else OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace); Debug::log(LOG, "OPENINGON: %x, Workspace: %i, Monitor: %i", OPENINGON, PNODE->workspaceID, PMONITOR->ID); @@ -373,6 +378,10 @@ void CHyprDwindleLayout::changeWindowFloatingMode(CWindow* pWindow) { const auto PNODE = getNodeFromWindow(pWindow); if (!PNODE) { + const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.vec() + pWindow->m_vRealSize.vec() / 2.f); + pWindow->m_iMonitorID = PNEWMON->ID; + pWindow->m_iWorkspaceID = PNEWMON->activeWorkspace; + // save real pos cuz the func applies the default 5,5 mid const auto PSAVEDPOS = pWindow->m_vRealPosition.vec(); const auto PSAVEDSIZE = pWindow->m_vRealSize.vec(); |
