summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-20 18:31:58 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-03-20 18:31:58 +0100
commit1f639f2aba28a7a949a095f1fa2f323027ad4645 (patch)
tree74d1908f015a7125ab99c58d9e0f6b984ee326bd /src
parent06114e728d83217284f373068ca9fa3eba9de5a7 (diff)
dwindle fixes
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp11
-rw-r--r--src/Compositor.hpp1
-rw-r--r--src/layout/DwindleLayout.cpp18
3 files changed, 15 insertions, 15 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 294ea753..d0b1f2e0 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -216,6 +216,17 @@ CWindow* CCompositor::vectorToWindow(const Vector2D& pos) {
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) {
const auto PMONITOR = getMonitorFromVector(pos);
// first loop over floating cuz they're above
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index 030aaa9b..abd66935 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -71,6 +71,7 @@ public:
bool windowValidMapped(CWindow*);
CWindow* vectorToWindow(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&);
+ CWindow* vectorToWindowTiled(const Vector2D&);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::list<SLayerSurface*>*, Vector2D*);
CWindow* windowFromCursor();
CWindow* windowFloatingFromCursor();
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index c69e310f..57f2703f 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -137,23 +137,11 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
return;
}
- // If it's not, get the last node.
- const auto PLASTFOCUS = getNodeFromWindow(g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus));
- 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) {
- OPENINGON = getFirstNodeOnWorkspace(PNODE->workspaceID);
- }
+ // If it's not, get the node under our cursor
+ SDwindleNodeData* OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
if (!OPENINGON) {
- Debug::log(ERR, "OPENINGON still null?????");
+ Debug::log(ERR, "OPENINGON null?????");
return;
}