dwindle fixes

This commit is contained in:
vaxerski 2022-03-20 18:31:58 +01:00
parent 06114e728d
commit 1f639f2aba
3 changed files with 15 additions and 15 deletions

View file

@ -216,6 +216,17 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
return nullptr; return nullptr;
} }
CWindow* CCompositor::vectorToWindowTiled(const Vector2D& pos) {
const auto PMONITOR = getMonitorFromVector(pos);
for (auto& w : m_lWindows) {
wlr_box box = {w.m_vPosition.x, w.m_vPosition.y, w.m_vSize.x, w.m_vSize.y};
if (wlr_box_contains_point(&box, pos.x, pos.y) && w.m_iWorkspaceID == PMONITOR->activeWorkspace && !w.m_bIsFloating)
return &w;
}
return nullptr;
}
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) { CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
const auto PMONITOR = getMonitorFromVector(pos); const auto PMONITOR = getMonitorFromVector(pos);
// first loop over floating cuz they're above // first loop over floating cuz they're above

View file

@ -71,6 +71,7 @@ public:
bool windowValidMapped(CWindow*); bool windowValidMapped(CWindow*);
CWindow* vectorToWindow(const Vector2D&); CWindow* vectorToWindow(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&); CWindow* vectorToWindowIdeal(const Vector2D&);
CWindow* vectorToWindowTiled(const Vector2D&);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::list<SLayerSurface*>*, Vector2D*); wlr_surface* vectorToLayerSurface(const Vector2D&, std::list<SLayerSurface*>*, Vector2D*);
CWindow* windowFromCursor(); CWindow* windowFromCursor();
CWindow* windowFloatingFromCursor(); CWindow* windowFloatingFromCursor();

View file

@ -137,23 +137,11 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
return; return;
} }
// If it's not, get the last node. // If it's not, get the node under our cursor
const auto PLASTFOCUS = getNodeFromWindow(g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus)); SDwindleNodeData* OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
SDwindleNodeData* OPENINGON = PLASTFOCUS;
if (PLASTFOCUS) {
if (PLASTFOCUS->workspaceID != PNODE->workspaceID) {
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindow(g_pInputManager->getMouseCoordsInternal()));
}
} else {
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindow(g_pInputManager->getMouseCoordsInternal()));
}
if (!OPENINGON) { if (!OPENINGON) {
OPENINGON = getFirstNodeOnWorkspace(PNODE->workspaceID); Debug::log(ERR, "OPENINGON null?????");
}
if (!OPENINGON) {
Debug::log(ERR, "OPENINGON still null?????");
return; return;
} }